一键导入
angular-performance
Angular performance: NgOptimizedImage, @defer, lazy loading, SSR. Trigger: When optimizing Angular app performance, images, or lazy loading.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Angular performance: NgOptimizedImage, @defer, lazy loading, SSR. Trigger: When optimizing Angular app performance, images, or lazy loading.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create distinctive, production-grade frontend interfaces with high design quality. Trigger: When the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
Node.js development principles and decision-making. Framework selection, async patterns, security, and architecture. Teaches thinking, not copying. Triggers: When the user asks to build a Node.js application, API, backend, or any server-side JavaScript project.
Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Trigger: When creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.
Optimize for search engine visibility and ranking. Use when asked to "improve SEO", "optimize for search", "fix meta tags", "add structured data", "sitemap optimization", or "search engine optimization". Trigger: when asked to "improve SEO", "optimize for search", "fix meta tags", "add structured data", "sitemap optimization", or "search engine optimization".
Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Trigger: When styling components, building responsive layouts, implementing design systems, or optimizing CSS workflow.
Guide for styling with Tailwind CSS 4, including utility-first composition, `cn()` usage, theme variable handling, and project-safe class patterns. Trigger: Use when the task involves styling UI with Tailwind classes, composing conditional class names with `cn()`, working with Tailwind 4 theme variables, translating design/UI requirements into utility classes, or reviewing className usage to avoid invalid patterns such as wrapping theme variables with `var()` inside className-driven styling.
| name | angular-performance |
| description | Angular performance: NgOptimizedImage, @defer, lazy loading, SSR. Trigger: When optimizing Angular app performance, images, or lazy loading. |
| metadata | {"author":"Mane087","version":"1.0"} |
import { NgOptimizedImage } from '@angular/common';
@Component({
imports: [NgOptimizedImage],
template: `
<!-- LCP image: add priority -->
<img ngSrc="hero.jpg" width="800" height="400" priority>
<!-- Regular: lazy loaded by default -->
<img ngSrc="thumb.jpg" width="200" height="200">
<!-- Fill mode (parent needs position: relative) -->
<img ngSrc="bg.jpg" fill>
<!-- With placeholder -->
<img ngSrc="photo.jpg" width="400" height="300" placeholder>
`
})
width and height (or fill)priority to LCP (Largest Contentful Paint) imagengSrc not srcfill image must have position: relative/fixed/absolute@defer (on viewport) {
<heavy-component />
} @placeholder {
<p>Placeholder shown immediately</p>
} @loading (minimum 200ms) {
<spinner />
} @error {
<p>Failed to load</p>
}
| Trigger | When to Use |
|---|---|
on viewport | Below the fold content |
on interaction | Load on click/focus/hover |
on idle | Load when browser is idle |
on timer(500ms) | Load after delay |
when condition | Load when expression is true |
<!-- Multiple triggers -->
@defer (on viewport; on interaction) {
<comments />
}
<!-- Conditional -->
@defer (when showComments()) {
<comments />
}
// Single component
{
path: 'admin',
loadComponent: () => import('./features/admin/admin').then(c => c.AdminComponent)
}
// Feature with child routes
{
path: 'users',
loadChildren: () => import('./features/users/routes').then(m => m.USERS_ROUTES)
}
bootstrapApplication(AppComponent, {
providers: [provideClientHydration()],
});
| Scenario | Use |
|---|---|
| SEO critical (blog, e-commerce) | SSR |
| Dashboard/Admin | CSR |
| Static marketing site | SSG/Prerender |
| Solution | When |
|---|---|
| Optimize algorithm | First choice always |
| Pure pipes | Cache single result |
| Memoization | Cache multiple results |
computed() | Derived signal state |
NEVER trigger reflows/repaints in lifecycle hooks (ngOnInit, ngAfterViewInit).