angular-performance

Optimize Angular performance with NgOptimizedImage, @defer blocks, and lazy-loaded routes.

1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/statick88/dotfiles --skill angular-performance-statick88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-performance
Source: https://github.com/statick88/dotfiles/tree/main/amp/.agents/skills/performance
Command: npx skills add https://github.com/statick88/dotfiles --skill angular-performance-statick88

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses common performance bottlenecks in Angular applications, ensuring faster load times and a smoother user experience.

Core Features & Use Cases

  • Image Optimization: Leverages NgOptimizedImage for efficient image loading, including priority hints and lazy loading.
  • Lazy Loading: Implements @defer blocks for components and lazy loading for routes to reduce initial bundle size.
  • SSR & Hydration: Guides on choosing the right rendering strategy (SSR, CSR, SSG) and configuring client hydration.
  • Performance Best Practices: Offers solutions for slow computations using pure pipes, memoization, and computed().

Quick Start

Apply the NgOptimizedImage directive to your hero image with the priority attribute.

Frequently Asked Questions about angular-performance

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

FAQPage Schema
How do I optimize image loading in Angular to improve page load speed?

Optimize Angular image loading by applying the NgOptimizedImage directive to enable priority hints and lazy loading. This reduces initial load times by deferring off-screen images, ensuring faster rendering and a smoother user experience for hero images and galleries.

What is the best way to reduce initial bundle size in an Angular application?

Reduce initial Angular bundle size by implementing @defer blocks for lazy component rendering and configuring lazy loading for routes. This splits code into smaller chunks, loading components only when triggered, which minimizes the payload required for the first page paint.

When do I need Server-Side Rendering (SSR) and client hydration for my Angular app?

You need Angular SSR and client hydration when optimizing for fast First Contentful Paint and SEO. Choosing the right rendering strategy like SSR, CSR, or SSG generates HTML on the server, while hydration attaches event listeners to avoid full client re-rendering.

How do I fix slow runtime computations in Angular components?

Fix slow Angular runtime computations by replacing expensive functions with pure pipes, implementing memoization, and utilizing the computed() function. These performance best practices prevent redundant recalculations during change detection cycles, resulting in smoother UI interactions.

Can I use @defer blocks with existing Angular routes to lazy load components?

Yes, you can use @defer blocks alongside lazy loaded routes to optimize Angular performance. While route lazy loading splits code at the navigation level, @defer blocks lazy render components within a view, reducing the initial bundle size and deferring non-critical UI rendering.

Why does my Angular application still render slowly after enabling lazy loading?

Angular applications may render slowly if runtime computations are unoptimized despite lazy loading. Address this by applying performance best practices like memoization, pure pipes, and computed() to prevent excessive calculation during change detection, ensuring smooth rendering.