performance

Enforce Angular performance best practices for change detection, signals, and lazy loading.

56|18|Updated Apr 26, 2022
One-click install
npx skills add https://github.com/nuclia/frontend --skill performance-nuclia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: performance
Source: https://github.com/nuclia/frontend/tree/main/.claude/skills/performance
Command: npx skills add https://github.com/nuclia/frontend --skill performance-nuclia

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common performance bottlenecks in the Nuclia frontend monorepo, ensuring efficient rendering, faster load times, and a smoother user experience.

Core Features & Use Cases

  • Change Detection Optimization: Enforces OnPush and guides away from markForCheck().
  • Signal Usage: Promotes correct use of signal() and computed() for memoization.
  • Efficient Rendering: Mandates track expressions in @for loops and suggests virtual scrolling for long lists.
  • Lazy Loading: Ensures new routes are lazy-loaded to reduce initial bundle size.
  • Stream Management: Guides correct usage of RxJS operators like shareReplay() and debounceTime/auditTime.
  • Bundle Size Awareness: Provides guidelines on bundle budgets and analysis.

Quick Start

Review the attached component for performance issues, ensuring OnPush is used and markForCheck is avoided.

Frequently Asked Questions about performance

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

FAQPage Schema
How do I optimize Angular change detection to avoid performance issues?

To optimize Angular change detection, enforce the OnPush strategy and guide away from using markForCheck(). Utilizing signal() and computed() for memoization further reduces unnecessary render cycles.

When should I use virtual scrolling and track expressions in Angular for loops?

Use virtual scrolling and track expressions in Angular @for loops when rendering long lists. Mandating track expressions prevents excessive DOM manipulation, while virtual scrolling ensures efficient rendering of large datasets.

What is the best way to manage RxJS streams and prevent redundant API calls in Angular?

The best way to manage RxJS streams is applying operators like shareReplay() correctly to avoid redundant execution, and using debounceTime or auditTime to throttle high-frequency emissions for efficient stream management.

How do I reduce initial bundle size when adding new routes in an Angular application?

Reduce initial Angular bundle size by ensuring new routes are lazy-loaded. Configuring bundle budgets and analyzing the output bundle helps maintain awareness of load times and performance limits.

Why does incorrect shareReplay usage cause performance bottlenecks in Angular?

Incorrect shareReplay usage causes performance bottlenecks by either caching excessive data in memory or failing to share stream execution, leading to redundant processing and inefficient stream management in Angular applications.