Angular 20+ performance optimization guidelines with Signals, httpResource, signal inputs/outputs, @defer, and native control flow (@if, @for). Use when writing, reviewing, or refactoring modern Angular code. Triggers on tasks involving Angular components, services, data fetching, bundle optimization, or performance improvements.
Comprehensive performance optimization guide for Angular 20+ applications with modern features like Signals, httpResource, signal inputs/outputs, @defer blocks, and native control flow syntax. Contains 35+ rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Change Detection | CRITICAL | change- |
| 2 | Bundle & Lazy Loading | CRITICAL | bundle- |
| 3 | RxJS Optimization | HIGH | rxjs- |
| 4 | Template Performance | HIGH | template- |
| 5 | Dependency Injection | MEDIUM-HIGH | di- |
| 6 | HTTP & Caching | MEDIUM | http- |
| 7 | Forms Optimization | MEDIUM | forms- |
| 8 | General Performance | LOW-MEDIUM | ssr- |
change-signals - Use Signals instead of BehaviorSubject for reactive statechange-onpush - Use OnPush change detection strategychange-detach-reattach - Detach change detector for heavy operationschange-run-outside-zone - Run non-UI code outside NgZonecomponent-signal-io - Use signal inputs/outputs instead of @Input/@Output decoratorssignal-computed-pure - Keep computed() pure, no side effectssignal-effect-patterns - Use effect() correctly, avoid anti-patternssignal-linkedsignal - Use linkedSignal for derived + writable statebundle-standalone - Use standalone components (default in v20+)bundle-lazy-routes - Lazy load routes with loadComponent/loadChildrenbundle-defer - Use @defer blocks for heavy componentsbundle-preload - Preload routes on hover/focus for perceived speedbundle-no-barrel-imports - Avoid barrel files, use direct importsrxjs-async-pipe - Use async pipe instead of manual subscriptionsrxjs-takeuntil - Use takeUntilDestroyed for automatic cleanuprxjs-share-replay - Share observables to avoid duplicate requestsrxjs-operators - Use efficient RxJS operatorsrxjs-mapping-operators - Use correct mapping operators (switchMap vs exhaustMap)rxjs-no-nested-subscribe - Avoid nested subscriptionstemplate-trackby - Use track function in @for loops (required in v20+)template-pure-pipes - Use pure pipes for expensive transformationstemplate-ng-optimized-image - Use NgOptimizedImage for image optimizationtemplate-no-function-calls - Avoid function calls in templatestemplate-virtual-scroll - Use virtual scrolling for large listsdi-provided-in-root - Use providedIn: 'root' for singleton servicesdi-injection-token - Use InjectionToken for non-class dependenciesdi-factory-providers - Use factory providers for complex initializationdirective-host-composition - Use hostDirectives for compositionhttp-resource - Use httpResource/resource for signal-based data fetchinghttp-interceptors - Use functional interceptors for cross-cutting concernshttp-transfer-state - Use TransferState for SSR hydrationrouting-signal-inputs - Use signal-based route inputsforms-reactive - Use reactive forms with typed FormGroupssr-hydration - Use incremental hydration with @defer (hydrate on ...)perf-memory-leaks - Prevent memory leaks (timers, listeners, subscriptions)perf-web-workers - Offload heavy computation to Web Workersarch-smart-dumb-components - Use Smart/Dumb component patternRead individual rule files for detailed explanations and code examples:
rules/change-signals.md
rules/bundle-defer.md
rules/http-resource.md
Each rule file contains:
For the complete guide with all rules expanded: AGENTS.md
npx skills add develite98/angular-best-practices-v20下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer