Skip to content
Back to skills

Angular Components

ASecurity

Set `changeDetection: ChangeDetectionStrategy.OnPush` in every component decorator. OnPush limits checks to relevant changes, including signal updates read by the template, changed input references, and events handled by the component. ```ts import { ChangeDetectionStrategy, Component, signal, } from '@angular/core'; @Component({ selector: 'app-counter', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: ` <p>Count: {{ count() }}</p> <button type="button...

  • 584 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
developmentangular

Works with

  • cli

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill angular-components --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Angular Components?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Angular Components
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-angular-components-21e26744/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-angular-components-21e26744)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Setting up OnPush change detection

Set `changeDetection: ChangeDetectionStrategy.OnPush` in every component decorator. OnPush limits checks to relevant changes, including signal updates read by the template, changed input references, and events handled by the component.

```ts
import {
  ChangeDetectionStrategy,
  Component,
  signal,
} from '@angular/core';

@Component({
  selector: 'app-counter',
  standalone: true,
  imports: [],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <p>Count: {{ count() }}</p>
    <button type="button" (click)="increment()">Increment</button>
  `,
})
export class CounterComponent {
  readonly count = signal(0);

  increment(): void {
    this.count.update((value) => value + 1);
  }
}
```

Use signals for local state, `computed()` for derived state, and `input()`/`output()` for component boundaries. Treat input arrays and objects immutably: replace the reference instead of mutating an existing object in place, so an OnPush child can observe the change. Prefer signal updates, observable-to-signal conversion, or the `async` pipe over manually forcing change detection. Do not use the default change-detection strategy as a workaround.

Files in this skill

  • eval-1.baseline.md1.8 KB
  • eval-1.with-skill.md1.2 KB
  • eval-2.baseline.md1.8 KB
  • eval-2.with-skill.md1.3 KB
  • eval-3.baseline.md1.9 KB
  • eval-3.with-skill.md1.2 KB
  • eval-4.baseline.md1.7 KB
  • eval-4.with-skill.md1.2 KB
  • eval-5.baseline.md1.8 KB
  • eval-5.with-skill.md1.1 KB
  • eval-6.baseline.md2 KB
  • eval-6.with-skill.md1.2 KB
  • eval-7.baseline.md2.2 KB
  • eval-7.with-skill.md2.1 KB
  • eval-8.baseline.md1.8 KB
  • eval-8.with-skill.md1.5 KB
  • eval-9.baseline.md2.2 KB
  • eval-9.with-skill.md1.8 KB
  • trigger-1.md110 B
  • trigger-2.md125 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.