angular-best-practices

Provides prioritized Angular performance optimization rules for change detection, bundles, rendering, and SSR.

1|Updated Dec 29, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com --skill angular-best-practices-ratnesh-maurya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: angular-best-practices
Source: https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com/tree/main/.claude/skills/angular-best-practices
Command: npx skills add https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com --skill angular-best-practices-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Angular applications often suffer from slow change detection, bloated bundles, async waterfalls, and rendering bottlenecks that are hard to diagnose without a structured checklist of proven optimization patterns. ## Core Features & Use Cases - Prioritized Rule Set: Covers eight categories ranked by impact, from critical change detection and async patterns to memory management. - Wrong vs. Correct Examples: Each rule pairs an anti-pattern with the recommended Signals, OnPush, @defer, or lazy-loading approach. - Review Checklists: Ready-made checklists for new components, performance reviews, and SSR configuration. - Use Case: When refactoring a slow Angular dashboard, apply the guide to switch components to OnPush with Signals, lazy-load routes, defer heavy charts, and eliminate nested subscription waterfalls. ## Quick Start Ask the AI to review your Angular component or route configuration against these performance best practices and suggest concrete fixes.

Frequently Asked Questions about angular-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I improve Angular change detection performance?▼

Use ChangeDetectionStrategy.OnPush on components and prefer Signals over mutable properties so updates trigger precisely. For new projects on Angular v20+, enable zoneless change detection to remove zone.js overhead and reduce bundle size.

How to avoid async waterfalls in Angular data fetching?▼

Replace nested subscriptions with forkJoin for independent parallel calls and switchMap for dependent calls. In SSR apps, use route resolvers so critical data is fetched on the server before navigation instead of in ngOnInit.

What is the best way to reduce Angular bundle size?▼

Lazy-load feature routes with loadChildren or loadComponent, defer heavy components with @defer, avoid barrel file re-exports that break tree-shaking, and dynamically import large third-party libraries like Chart.js only when needed.

Does Angular @defer work with server-side rendering?▼

Yes, @defer supports hydration triggers such as hydrate on viewport or hydrate on interaction when incremental hydration is configured via provideClientHydration. This lets below-the-fold content hydrate lazily while critical content renders first.

Why does my Angular list re-render on every change?▼

Lists re-render when @for lacks a proper track expression or uses $index instead of a stable item id. Add track item.id, use computed() for derived data, and consider CDK virtual scrolling for very large lists.

When should I use Signals instead of RxJS subscriptions in Angular?▼

Use Signals for synchronous reactive state and template bindings, converting observables with toSignal when needed. Keep RxJS for complex async event streams, and always clean up remaining subscriptions with takeUntilDestroyed.