Write production-quality Angular code day to day — standalone components with signal inputs and outputs, computed, linkedSignal and effect used correctly, @if/@for/@switch/@defer/@let templates, Signal Forms (typed Reactive Forms on existing code), httpResource/resource and HttpClient services, inject() and @Service, lazy routes with input binding, directives, pipes, Material, CDK, Angular Aria, styling and accessibility.
When agents use itUse this whenever the user asks to build, implement, refactor or fix an Angular component, service, directive, pipe, form, dialog, table or feature; asks "how do I do X in Angular"; or asks about signals vs RxJS, @Input vs input(), model(), effect() writing signals, viewChild, content projection, template syntax or afterNextRender. Also use it for any new Angular snippet, however small; for tests use angular-testing.
Install
Copilot (VS Code, Visual Studio, Copilot CLI and github.com) reads skills from the repository — commit them so the whole team gets them.
npx skills add AGCO-Global/org-skills --skill angular-development -a github-copilot
# or with the org installer (adds .github/skills/angular-development):
npx -y github:AGCO-Global/org-skills add skill angular-development
Uses the open skills CLI. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, OpenCode, Windsurf and 60+ others — it asks which agent to install into.
Installs the frontend-angular-skills plugin, which bundles all Frontend / Angular skills and keeps them updated.
/plugin marketplace add AGCO-Global/org-skills
/plugin install frontend-angular-skills@org-skills
# or just this skill, in this repository:
npx skills add AGCO-Global/org-skills --skill angular-development -a claude-code
Use Download .zip above, then upload it under Customize → Skills → Upload skill. Team and Enterprise admins can sync this repo as a plugin marketplace instead.
Installs into .agents/skills/, which Codex reads.
npx skills add AGCO-Global/org-skills --skill angular-development -a codex
Installs into Cursor's skills folder.
npx skills add AGCO-Global/org-skills --skill angular-development -a cursor
Installs into Gemini CLI's skills folder.
npx skills add AGCO-Global/org-skills --skill angular-development -a gemini-cli
Nothing to install. Press Download .zip above, unzip it, and drop the angular-development folder into your tool's skills folder — .claude/skills/, .github/skills/, .cursor/skills/ or .agents/skills/. Step-by-step, per tool: How to use it. For any other tool with rules or custom prompts, Copy SKILL.md and paste it in — it is plain Markdown.
The npx commands need Node.js 20+ and use your normal git sign-in to GitHub, so they work while the repository is private. Without Node.js, see the No Node.js tab — a skill is a folder of Markdown, so copying it in works just as well.
Good Angular code is small standalone components, signals for state, RxJS only at the edges, and templates that hold bindings, not logic. Write new code in this style even next to older NgModule code — the two coexist. Per-version defaults (zoneless, OnPush, Vitest, Signal Forms) are in references/version-notes.md; read it before generating code for v20 or v21.
1. Decide first
Question
Default
Change when
Component shape
Standalone, ChangeDetectionStrategy.OnPush, input()/output()/model(), inject() in field initialisers
Never for new code. OnPush is the framework default from v22 and Default is deprecated in favour of Eager (ChangeDetectionStrategy); still write OnPush on v20/21
Every child used in the template is listed in imports (NG8001 otherwise); import the pipe or directive, never CommonModule. readonly on everything Angular initialises, protected for template-only members, file order-row.ts for class OrderRow (style guide; legacy repos may keep .component.ts — see angular-architecture).
Two-way: readonly query = model('') → <app-search [(query)]="q" />. Derived with override: readonly selected = linkedSignal(() => this.orders()[0] ?? null) resets when orders() changes, still .set()-able.
host: {} for host classes/attributes/listeners; viewChild()/contentChild() signal queries; inject() in field initialisers, constructor only for afterNextRender/effect registration; component under ~200 lines.
3. Signals and effects
Want to…
Use
Hold state
signal(initial); .set() / .update(fn) with new objects — in-place mutation does not notify
Derive / derive with local override
computed() (lazy, memoised) / linkedSignal() ({ source, computation } form keeps the previous pick)
Side effect (logging, storage, widget, focus)
effect((onCleanup) => …); onCleanup for teardown; untracked(() => sig()) to read without subscribing
Observable ⇄ signal
toSignal(obs$, { initialValue }), toObservable(sig) from @angular/core/rxjs-interop
A signal write inside effect() is allowed (since v19) but a smell, not an error. It hides a derivation and lands one frame after the change. Prefer computed/linkedSignal. Legitimate writes: syncing external state in (router events, third-party widget callbacks, ResizeObserver) — leave those alone.
4. Templates
@if (x(); as v) {…} @else {…}, @for (item of items(); track item.id) {…} @empty {…}, @switch; track on a stable id ($index only for static lists). @let total = order().total * rate(); for a value read several times — scoped to that view and its children.
[class.active]="on()", [class]="classes()", [style.width.px]="w()"; never ngClass/ngStyle (schematics ngclass-to-class/ngstyle-to-style remove them). No function calls in bindings except signals and pure pipes; three operators in one expression → computed.
@defer (on viewport; prefetch on idle) { <app-chart/> } @placeholder {…} @loading (after 100ms; minimum 500ms) {…} @error {…}; <img ngSrc width height priority> via NgOptimizedImage; <ng-content select="[slot=actions]">Fallback</ng-content>.
One API class per resource, typed from the OpenAPI schema; components consume a resource, store signal or service method — never HttpClient directly. Functional interceptors (withInterceptors([...])) for auth, base URL, error normalisation; fetch is the default backend on v22 (withFetch() on v20 with SSR).
resource({ params, loader }) for non-HTTP async (loader receives abortSignal); rxResource from @angular/core/rxjs-interop for Observable loaders — recipes in references/resources-and-http.md.
The model signal is the source of truth; submit with submit(this.f, { action: async (f) => … }) returning server field errors or undefined. Arrays via applyEach, server checks via validateHttp, custom rules via validate — full recipe and the Reactive → Signal mapping in references/signal-forms.md. On an existing Reactive form keep nonNullable typed controls; never mix both APIs in one form.
7. Routing, directives and the DOM
provideRouter(routes, withComponentInputBinding(), withViewTransitions()); params arrive as input(). Every feature loadChildren/loadComponent, route title set, functional CanActivateFn returning UrlTree; resolvers only for must-exist-before-render data.
Attribute directives: inject(ElementRef), input()s, host bindings, inject(DestroyRef).onDestroy(); compose with hostDirectives. Pipes are pure functions (standalone is the default — never write standalone: true).
DOM measurement or widget init: afterNextRender({ read: () => … }) once (phases earlyRead/write/mixedReadWrite/read; the AfterRenderPhase enum is gone), afterEveryRender per render — browser-only, no setTimeout(0); afterRender was renamed in v20 and does not compile. inject(DOCUMENT) not the global; [innerHTML] only with sanitised content, bypassSecurityTrust* never on user data; provideBrowserGlobalErrorListeners() + custom ErrorHandler for monitoring. Material, Aria, styling, i18n: references/ui-libraries-and-styling.md.
8. Deliverable format
## Change — files (one component per file, repo naming convention) and code that compiles as written, imports included
## States covered — loading / empty / error / success and where each renders
## Notes — non-default choices and why; version caveat if the repo is on v20/21; tests to add via angular-testing
Checklist
Standalone, OnPush, input()/output()/model(), readonly, protected template members; no @Input, @ViewChild, constructor DI
Every template dependency in imports; no CommonModule, ngClass, ngStyle, standalone: true, @angular/animations, afterRender
No derived state in fields; a signal write inside effect() has a comment saying why; @for has track and @empty; loading/error/success rendered
Data via httpResource/resource/store signals; no subscribe() without takeUntilDestroyed()
New forms on v22 use Signal Forms; strict types, no any/!; strictTemplates passes
Keyboard-operable, labelled, focus managed; [innerHTML]/bypassSecurityTrust* absent or justified
Anti-patterns
effect(() => this.total.set(...)) → readonly total = computed(...); keep the effect only when the source is outside the signal graph.
BehaviorSubject + .value as state; subscribe() in ngOnInit → signal(); toSignal/httpResource/takeUntilDestroyed().
HttpClient inside a component → API service + httpResource or store.
*ngIf/*ngFor/ngClass in new templates; items().push(x) → @if/@for (…; track …)/[class.x]; items.update(l => [...l, x]).
setTimeout to dodge NG0100 → fix the flow (computed upward, output() child→parent); afterNextRender for DOM reads.
Go deeper
references/version-notes.md — per-version defaults v20/21/22 (shared by all Angular skills)
references/signal-forms.md — Signal Forms recipe, validation, arrays, submit, Reactive → Signal mapping
---
name: angular-development
description: Write production-quality Angular code day to day — standalone components with signal inputs and outputs, computed, linkedSignal and effect used correctly, @if/@for/@switch/@defer/@let templates, Signal Forms (typed Reactive Forms on existing code), httpResource/resource and HttpClient services, inject() and @Service, lazy routes with input binding, directives, pipes, Material, CDK, Angular Aria, styling and accessibility. Use this whenever the user asks to build, implement, refactor or fix an Angular component, service, directive, pipe, form, dialog, table or feature; asks "how do I do X in Angular"; or asks about signals vs RxJS, @Input vs input(), model(), effect() writing signals, viewChild, content projection, template syntax or afterNextRender. Also use it for any new Angular snippet, however small; for tests use angular-testing.
metadata:
technology: Angular
type: development
---
# Angular Development
> **Targets:** Angular 22 (LTS 20 and 21 noted where different; v19 and below unsupported) · **Verified:** 2026-09 against https://angular.dev/reference/releases, https://angular.dev/style-guide, https://angular.dev/assets/context/best-practices.md
Good Angular code is small standalone components, signals for state, RxJS only at the edges, and templates that hold bindings, not logic. Write new code in this style even next to older NgModule code — the two coexist. Per-version defaults (zoneless, OnPush, Vitest, Signal Forms) are in `references/version-notes.md`; read it before generating code for v20 or v21.
## 1. Decide first
| Question | Default | Change when |
|---|---|---|
| Component shape | Standalone, `ChangeDetectionStrategy.OnPush`, `input()`/`output()`/`model()`, `inject()` in field initialisers | Never for new code. OnPush is the framework default from v22 and `Default` is deprecated in favour of `Eager` ([ChangeDetectionStrategy](https://angular.dev/api/core/ChangeDetectionStrategy)); still write `OnPush` on v20/21 |
| Where state lives | `signal()` owned, `computed()` derived, `linkedSignal()` derived-but-overridable | Event streams over time (typeahead, sockets) → RxJS pipeline, `toSignal()` at the end |
| Async data in a component | `httpResource()` / `resource()` — stable since v22 | v20/21 → `toSignal(obs$, { initialValue })`; writes (POST/PUT) → `HttpClient` in a service |
| Forms | Signal Forms (`@angular/forms/signals`) for new forms on v22+ | Existing Reactive Forms code or v20/21 → Typed Reactive Forms (stable, not deprecated) |
| Service declaration | `@Service()` on v22 — root singleton, `inject()` only | `useClass`/`useValue`/`useFactory`, non-root scope, constructor DI, or v20/21 → `@Injectable({ providedIn: 'root' })` |
| Animation | CSS with `animate.enter` / `animate.leave` | Never `@angular/animations` in new code — deprecated ([legacy-animations](https://angular.dev/guide/legacy-animations)) |
| UI kit | Angular Material + CDK | Bespoke design system → Angular Aria (`@angular/aria`, headless) |
## 2. Component
```ts
import { ChangeDetectionStrategy, Component, booleanAttribute, computed, input, output } from '@angular/core';
import { CurrencyPipe } from '@angular/common';
import { Badge } from '../../shared/ui/badge/badge';
import { Order } from '../model/order'; // { id: string; number: string; total: number; currency: string; dueDate: string /* ISO */; paid: boolean }
@Component({
selector: 'app-order-row',
imports: [CurrencyPipe, Badge],
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'order-row', '[attr.aria-selected]': 'selected()' },
template: `
<button type="button" (click)="select.emit(order().id)" [attr.aria-label]="'Open order ' + order().number">
<span>{{ order().number }}</span> <span>{{ order().total | currency: order().currency }}</span>
@if (isOverdue()) { <app-badge tone="warning">Overdue</app-badge> }
</button>`,
})
export class OrderRow {
readonly order = input.required<Order>();
readonly selected = input(false, { transform: booleanAttribute });
readonly select = output<Order['id']>();
protected readonly isOverdue = computed(() => !this.order().paid && Date.parse(this.order().dueDate) < Date.now());
}
```
- Every child used in the template is listed in `imports` (NG8001 otherwise); import the pipe or directive, never `CommonModule`. `readonly` on everything Angular initialises, `protected` for template-only members, file `order-row.ts` for class `OrderRow` ([style guide](https://angular.dev/style-guide); legacy repos may keep `.component.ts` — see `angular-architecture`).
- Two-way: `readonly query = model('')` → `<app-search [(query)]="q" />`. Derived with override: `readonly selected = linkedSignal(() => this.orders()[0] ?? null)` resets when `orders()` changes, still `.set()`-able.
- `host: {}` for host classes/attributes/listeners; `viewChild()`/`contentChild()` signal queries; `inject()` in field initialisers, constructor only for `afterNextRender`/`effect` registration; component under ~200 lines.
## 3. Signals and effects
| Want to… | Use |
|---|---|
| Hold state | `signal(initial)`; `.set()` / `.update(fn)` with new objects — in-place mutation does not notify |
| Derive / derive with local override | `computed()` (lazy, memoised) / `linkedSignal()` (`{ source, computation }` form keeps the previous pick) |
| Side effect (logging, storage, widget, focus) | `effect((onCleanup) => …)`; `onCleanup` for teardown; `untracked(() => sig())` to read without subscribing |
| Observable ⇄ signal | `toSignal(obs$, { initialValue })`, `toObservable(sig)` from `@angular/core/rxjs-interop` |
**A signal write inside `effect()` is allowed (since v19) but a smell, not an error.** It hides a derivation and lands one frame after the change. Prefer `computed`/`linkedSignal`. Legitimate writes: syncing external state in (router events, third-party widget callbacks, `ResizeObserver`) — leave those alone.
## 4. Templates
- `@if (x(); as v) {…} @else {…}`, `@for (item of items(); track item.id) {…} @empty {…}`, `@switch`; `track` on a stable id (`$index` only for static lists). `@let total = order().total * rate();` for a value read several times — scoped to that view and its children.
- `[class.active]="on()"`, `[class]="classes()"`, `[style.width.px]="w()"`; never `ngClass`/`ngStyle` (schematics `ngclass-to-class`/`ngstyle-to-style` remove them). No function calls in bindings except signals and pure pipes; three operators in one expression → `computed`.
- `@defer (on viewport; prefetch on idle) { <app-chart/> } @placeholder {…} @loading (after 100ms; minimum 500ms) {…} @error {…}`; `<img ngSrc width height priority>` via `NgOptimizedImage`; `<ng-content select="[slot=actions]">Fallback</ng-content>`.
## 5. Services and HTTP
```ts
import { Service, inject } from '@angular/core';
import { HttpClient, httpResource } from '@angular/common/http';
@Service() // v22; v20/21: @Injectable({ providedIn: 'root' })
export class OrdersApi {
private readonly http = inject(HttpClient);
update(id: string, patch: Partial<Order>) { return this.http.patch<Order>(`/api/orders/${id}`, patch); }
}
readonly id = input.required<string>(); // route param via withComponentInputBinding()
readonly order = httpResource<Order>(() => `/api/orders/${this.id()}`); // .value() .hasValue() .isLoading() .error() .reload()
```
- One API class per resource, typed from the OpenAPI schema; components consume a resource, store signal or service method — never `HttpClient` directly. Functional interceptors (`withInterceptors([...])`) for auth, base URL, error normalisation; `fetch` is the default backend on v22 (`withFetch()` on v20 with SSR).
- `resource({ params, loader })` for non-HTTP async (loader receives `abortSignal`); `rxResource` from `@angular/core/rxjs-interop` for Observable loaders — recipes in `references/resources-and-http.md`.
## 6. Forms
```ts
import { form, FormField, required, email, submit } from '@angular/forms/signals';
readonly model = signal({ email: '', name: '' });
readonly f = form(this.model, (p) => { required(p.email, { message: 'Email is required' }); email(p.email); required(p.name); });
// template: <input [formField]="f.email" /> @if (f.email().touched() && f.email().invalid()) { … f.email().errors() … }
```
The model signal is the source of truth; submit with `submit(this.f, { action: async (f) => … })` returning server field errors or `undefined`. Arrays via `applyEach`, server checks via `validateHttp`, custom rules via `validate` — full recipe and the Reactive → Signal mapping in `references/signal-forms.md`. On an existing Reactive form keep `nonNullable` typed controls; never mix both APIs in one form.
## 7. Routing, directives and the DOM
- `provideRouter(routes, withComponentInputBinding(), withViewTransitions())`; params arrive as `input()`. Every feature `loadChildren`/`loadComponent`, route `title` set, functional `CanActivateFn` returning `UrlTree`; resolvers only for must-exist-before-render data.
- Attribute directives: `inject(ElementRef)`, `input()`s, `host` bindings, `inject(DestroyRef).onDestroy()`; compose with `hostDirectives`. Pipes are pure functions (standalone is the default — never write `standalone: true`).
- DOM measurement or widget init: `afterNextRender({ read: () => … })` once (phases `earlyRead`/`write`/`mixedReadWrite`/`read`; the `AfterRenderPhase` enum is gone), `afterEveryRender` per render — browser-only, no `setTimeout(0)`; `afterRender` was renamed in v20 and does not compile. `inject(DOCUMENT)` not the global; `[innerHTML]` only with sanitised content, `bypassSecurityTrust*` never on user data; `provideBrowserGlobalErrorListeners()` + custom `ErrorHandler` for monitoring. Material, Aria, styling, i18n: `references/ui-libraries-and-styling.md`.
## 8. Deliverable format
```
## Change — files (one component per file, repo naming convention) and code that compiles as written, imports included
## States covered — loading / empty / error / success and where each renders
## Notes — non-default choices and why; version caveat if the repo is on v20/21; tests to add via angular-testing
```
## Checklist
- [ ] Standalone, OnPush, `input()`/`output()`/`model()`, `readonly`, `protected` template members; no `@Input`, `@ViewChild`, constructor DI
- [ ] Every template dependency in `imports`; no `CommonModule`, `ngClass`, `ngStyle`, `standalone: true`, `@angular/animations`, `afterRender`
- [ ] No derived state in fields; a signal write inside `effect()` has a comment saying why; `@for` has `track` and `@empty`; loading/error/success rendered
- [ ] Data via `httpResource`/`resource`/store signals; no `subscribe()` without `takeUntilDestroyed()`
- [ ] New forms on v22 use Signal Forms; strict types, no `any`/`!`; `strictTemplates` passes
- [ ] Keyboard-operable, labelled, focus managed; `[innerHTML]`/`bypassSecurityTrust*` absent or justified
## Anti-patterns
- **`effect(() => this.total.set(...))`** → `readonly total = computed(...)`; keep the effect only when the source is outside the signal graph.
- **`BehaviorSubject` + `.value` as state; `subscribe()` in `ngOnInit`** → `signal()`; `toSignal`/`httpResource`/`takeUntilDestroyed()`.
- **`HttpClient` inside a component** → API service + `httpResource` or store.
- **`*ngIf`/`*ngFor`/`ngClass` in new templates; `items().push(x)`** → `@if`/`@for (…; track …)`/`[class.x]`; `items.update(l => [...l, x])`.
- **`setTimeout` to dodge NG0100** → fix the flow (`computed` upward, `output()` child→parent); `afterNextRender` for DOM reads.
## Go deeper
- `references/version-notes.md` — per-version defaults v20/21/22 (shared by all Angular skills)
- `references/signal-forms.md` — Signal Forms recipe, validation, arrays, submit, Reactive → Signal mapping
- `references/resources-and-http.md` — `resource`/`rxResource`/`httpResource` patterns, interceptors, error handling
- `references/ui-libraries-and-styling.md` — Material, CDK, Angular Aria, styling, animations, i18n, accessibility
- Siblings: `angular-architecture`, `angular-testing`, `angular-performance`, `angular-ssr`, `angular-migration`