
Angular Best Practices
Apply 112 modern Angular 17+ rules—with impact ratings—while editing components, templates, routes, tests, and styles so the app stays fast and maintainable.
Install
npx skills add https://github.com/alfredoperez/angular-best-practices --skill angular-best-practicesWhat is this skill?
- 112 rules across TypeScript strictness, Signals, RxJS, SSR hydration, bundle size, a11y, routing, forms, and testing
- Triggers on angular.json, nx.json, or @angular/core imports across .ts, .html, .scss, .spec.ts, and .routes.ts
- Impact ratings on rules so agents prioritize high-leverage performance and architecture fixes
- Explicit scope: Angular 17+ only—not AngularJS 1.x, React, Vue, or generic TypeScript
- Covers signal-based reactivity, component architecture, template optimization, and state patterns end to end
Adoption & trust: 677 installs on skills.sh; 34 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Primary shelf is Build because most invocations happen while writing Angular components, services, and templates in an active codebase. Frontend subphase captures UI templates, signal-based components, routing, and forms rather than unrelated backend-only work.
Common Questions / FAQ
Is Angular Best Practices safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Angular Best Practices
# Modern Angular Best Practices A comprehensive set of 112 rules covering TypeScript strictness, signal-based reactivity, component architecture, template optimization, RxJS patterns, SSR hydration, bundle optimization, accessibility, routing, forms, testing, and styling — so every component, service, template, and route you build is fast, accessible, tested, and maintainable. Below are the key patterns organized by what you're working on. For edge cases or when you need specific code examples beyond what's listed here, consult the AGENTS.md reference file in this skill directory. ## Components & Signals Components are the building blocks. Modern Angular uses signals for reactivity, which changes how you write everything from state to templates. - Use standalone components with `ChangeDetectionStrategy.OnPush` - Use `input()`, `output()`, `model()` signal functions instead of decorators - Use `inject()` instead of constructor injection - Use `signal()` for local state, `computed()` for derived state - Use `linkedSignal()` when state should reset when a source changes - Use `resource()` / `httpResource()` for async data with built-in loading states - Use `effect()` only for side effects — never for state synchronization - Use `toSignal()` to bridge RxJS observables into signal-based templates - Use `viewChild()` / `contentChild()` signal queries instead of decorators - Use the `host` property instead of `@HostBinding` / `@HostListener` ## Templates & Styles Templates and styles work together — accessibility, layout, and performance cross both concerns. - Use `@if`, `@for`, `@switch` control flow instead of structural directives - Use `@defer` for heavy below-fold content - Always provide `track` with `@for` loops - Use `NgOptimizedImage` with `priority` for above-fold images - Use pure pipes instead of method calls in templates - Use `CdkVirtualScrollViewport` for large lists - Use `[class.active]` bindings instead of `[ngClass]` - Define theme values as CSS custom properties - Use `prefers-reduced-motion` to respect motion preferences ## Services & RxJS Services handle data flow, dependency injection, and RxJS patterns. HTTP, caching, and observable lifecycle are interconnected concerns. - Unsubscribe via `takeUntilDestroyed()` or `async` pipe - Place `catchError` inside `switchMap` to keep the outer stream alive - Use `switchMap` for latest-only, `exhaustMap` for ignore-while-busy - Use `shareReplay({ bufferSize: 1, refCount: true })` for shared streams - Use `inject()` with `InjectionToken` for configuration - Use HTTP interceptors for cross-cutting concerns (auth, retry, logging) - Map DTOs at the API boundary — don't leak backend shapes into components ## Performance & SSR Performance rules span components, templates, and infrastructure. SSR affects routing, data