angular best practices
Angular performance optimization and best practices guide. Use when writing, reviewing, or refactoring Angular code for optimal performance, bundle size, and rendering efficiency.
skill★ 507780 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source
Documentation & Preview
Angular Best Practices
Performance optimization and best practices for Angular applications optimized for AI agents and LLMs.
Overview
This skill provides prioritized performance guidelines across:
- Change Detection - OnPush strategy, Signals, Zoneless apps
- Async Operations - Avoiding waterfalls, SSR preloading
- Bundle Optimization - Lazy loading,
@defer, tree-shaking - Rendering Performance - TrackBy, virtual scrolling, CDK
- SSR & Hydration - Server-side rendering patterns
- Template Optimization - Structural directives, pipe memoization
- State Management - Efficient reactivity patterns
- Memory Management - Subscription cleanup, detached refs
Structure
The SKILL.md file is organized by priority:
- Critical Priority - Largest performance gains (change detection, async)
- High Priority - Significant impact (bundles, rendering)
- Medium Priority - Noticeable improvements (SSR, templates)
- Low Priority - Incremental gains (memory, cleanup)
Each rule includes:
- ❌ WRONG - What not to do
- ✅ CORRECT - Recommended pattern
- 📝 Why - Explanation of the impact
Quick Reference Checklist
For New Components:
- [ ] Using
ChangeDetectionStrategy.OnPush - [ ] Using Signals for reactive state
- [ ] Using
@deferfor non-critical content - [ ] Using
trackByfor*ngForloops - [ ] No subscriptions without cleanup
For Performance Reviews:
- [ ] No async waterfalls (parallel data fetching)
- [ ] Routes lazy-loaded
- [ ] Large libraries code-split
- [ ] Images use
NgOptimizedImage
Version
Current version: 1.0.0 (February 2026)