Ng22 deferrable views
Skill PavanAnguluri/angular22-agent-skills/skills/ng22-deferrable-views
Angular 22 Agent Skills
npx -y skills add PavanAnguluri/angular22-agent-skills --skill ng22-deferrable-viewsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Automates chunk splitting and deferred lazy-loading setup for heavy viewport components.
SKILL.md
2.4 KB, as published. Nobody here has run it
Angular 22 Deferrable Views Layout Guideline
Wrap heavy UI sections, dashboards, or complex components in @defer blocks to reduce initial bundle work and keep first paint responsive.
Core Rules
- Defer expensive UI that is not required for initial interaction.
- Use
on viewportfor below-the-fold content by default. - Use
on interactionoron hoverfor drawers, menus, dialogs, and infrequently used tools. - Always provide a
@placeholderand usually aminimumduration to avoid flicker. - Provide
@loadingand@errorstates when the deferred content has visible loading or failure states. - Combine deferral with route splitting when the content is an entire feature page.
Standard Execution
@defer (on viewport; prefetch on idle) {
<app-heavy-analytics-chart [data]="metrics()" />
} @placeholder (minimum 500ms) {
<div class="skeleton-loader">Preparing data layout blocks...</div>
} @loading {
<app-spinner />
} @error {
<div class="alert-box">Failed to load asset bundle. Try again later.</div>
}
Trigger Guide
@defer (on interaction) {
<app-settings-drawer />
} @placeholder {
<button type="button">Open settings</button>
}
@defer (on hover; prefetch on idle) {
<app-insight-popover />
} @placeholder {
<span>Hover for details</span>
}
Practical Rules
- Use
@deferfor charts, data grids, WYSIWYG editors, and other heavy widgets. - Avoid deferring content that must be immediately available for primary navigation.
- Keep placeholders structurally close to the final layout so dimensions stay stable.
- Use
prefetch on idlewhen you want the browser to prepare the chunk before the user reaches it. - Be cautious with server rendering and hydration; ensure the placeholder and deferred content transition cleanly.
Anti-Patterns
- Do not defer critical page chrome or the first interactive control.
- Do not omit a placeholder for heavy content that would otherwise cause layout shift.
- Do not nest unrelated business logic inside the deferred block.
Review Checklist
- The deferred content is truly non-essential at first paint.
- The trigger matches the user’s expected interaction model.
- Placeholder, loading, and error states are intentional.
- The layout remains stable while the chunk loads.