agentleFS
ai-enhanced-engineerai-enhanced-engineer/aiee-skills/skills/frontend-angular/SKILL.md

frontend-angular

Skill4 starsChanged 5 months agoMITView on GitHub

Modern Angular 21+ patterns including signals, standalone components, zoneless change detection, and new control flow syntax (@if, @for). Use for Angular architecture decisions, implementing components with latest APIs, computed signal chains, select binding, ngModel two-way binding, or CanDeactivate guard patterns.

The file

Files
SKILL.md

Angular Production Patterns

Production-ready patterns for Angular 21+ applications with zoneless change detection.

Key APIs

APIPurpose
signal()Reactive state declaration
computed()Derived values (auto-tracked)
effect()Side effects on signal changes
input()Component inputs (replaces @Input)
output()Component outputs (replaces @Output)
model()Two-way bindable signals
viewChild()Signal-based DOM queries (replaces @ViewChild)

Performance Targets

MetricTarget
LCP< 2.5s
INP< 200ms
CLS< 0.1
Initial Bundle< 250KB

When NOT to Use Angular

  • Simple interactivity → Vanilla JS
  • Static marketing site → Astro/11ty
  • < 100KB JS budget → Svelte or Web Components
  • React ecosystem dependency → React

Signal-Based Service Pattern

Private writable signal → public readonly → update in tap() → component injects and reads. Matches AuthService pattern for consistency across services.

Signal Testing Patterns

PatternUse Case
PLATFORM_ID mockingPrevent constructor side effects in SSR tests
WritableSignal with .set()Control signal state without reassignment
NG0100 preventionInitialize signals before detectChanges()

Angular 21+ Anti-Patterns

Anti-PatternPattern
CommonModule in standalone importsRemove it (@if/@for don't need it)
@ViewChild decoratorviewChild() signal (reactive, no ExpressionChanged errors)
setTimeout() in componentstimer().pipe(takeUntilDestroyed()) (prevents memory leaks)
401 handling in servicesHTTP interceptor only (prevents conflicting error paths)
Public injected servicesPrivate + local signal aliases (encapsulation)
Timer in service tap()Auto-clear timers outlive component; move timer to component, expose clearSaveSuccess() on service
effect() in ngOnInitStacks subscriptions on re-init; use toObservable(signal) + switchMap + takeUntilDestroyed
toObservable() in ngOnInitThrows NG0203 — requires injection context; build chain as class field, .subscribe() in ngOnInit
inputs: [] metadata propertyUse input() signal API — @angular-eslint/no-inputs-metadata-property flags this
Direct property assignment in specscomponent.authService = mock breaks with protected; use { provide: AuthService, useValue: mock } in TestBed
<div (click)> without keyboard peerESLint interactive-supports-focus: add (keydown) + tabindex="0" + semantic role (e.g., role="document" for modal containers)
Single-slot in-flight marker cleared unconditionallyCapture the operation ID before the call; clear only when stored ID still matches — late responses otherwise clobber a newer operation's marker
Optimistic-insert CRUD reused for ephemeral entities (preview/draft)Add a side-effect-free HTTP method that skips signal writes; reusing list-mutating CRUD pollutes shared list/counts with internal rows

Select Binding Gotcha

Angular's <select [value]="signal()"> does not select the matching <option> — the browser uses selectedIndex, not the value attribute. The dropdown silently appears stuck on the first option. Two fixes: [selected]="optionValue === signal()" per <option>, or importing FormsModule and using [(ngModel)].

Progressive Signal Chain Pattern

For data transformation in presentational components, chaining computed signals with single responsibility keeps logic clean: input → filtered → transformed → derived metrics. Downstream signals derive from the filtered signal (not raw input), ensuring filter logic applies exactly once. This pattern naturally emerges in components displaying categorized, aggregated, or excluded data.

See reference.md for the Multi-Entity Page Pattern, CanDeactivate Guard Patterns, HTTP Error Handling Ownership, Debounced Signal-to-Iframe Preview, zoneless change detection, dependency injection, HTTP client patterns, Resource API, component libraries comparison (PrimeNG, Kendo, Angular Material), reactive forms, router patterns, and error handling.

See examples.md for dashboard metrics component, data table with filtering, authentication service, WebSocket service, and signal testing patterns (PLATFORM_ID mocking, WritableSignal, NG0100 prevention).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.