angular
Skill36 starsChanged 6 months agoMITView on GitHub
Angular 21.x core patterns and APIs — Signals, Standalone components, Zoneless change detection, SSR/Hydration, Dependency Injection, Component composition, Signal-based state, Testing. Load when writing Angular code for API reference, testing patterns, or SSR configuration.
12 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- danielteles/awesome-agent-skillstheir own version, first seen Sep 2, 2026
- lucavb/skillstheir own version, first seen Aug 28, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Jul 14, 2026
- marcoscazaux/skillstheir own version, first seen Jun 12, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- xfstudio/skills★ 919% same
- ai4brands-design/claude-skills★ 219% same
Wrote their own version · 10
- Mindrally/skills★ 266same name
- dylantarre/design-system-skills★ 50same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- danielteles/awesome-agent-skills★ 3same name
- lucavb/skills★ 3same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- Domush/ai-agent-web-development-skills★ 1same name
- Lukk17/agent-standards★ 1same name
- marcoscazaux/skills★ 1same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository157 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- a2ui-angularSkill
- accessibility-auditSkill
- adk-deploy-guideSkill
- adk-dev-guideSkill
- adk-eval-guideSkill
- adk-observability-guideSkill
- agentic-ai-coding-standardSkill
- agentic-ai-devSkill
- ai-auditSkill
- ai-chatSkill
- ai-decision-recordSkill
- ai-incident-responseSkill
- ai-launch-checkSkill
- ai-playbookSkill
- angular-best-practicesSkill
- angular-spaSkill
- angular-ui-patternsSkill
- api-design-principlesSkill
- app-store-optimizationSkill
- architect-reviewSkill
- architecture-decision-recordsSkill
- architecture-designSkill
- asc-cli-usageSkill
- asc-crash-triageSkill
- asc-id-resolverSkill
- asc-release-flowSkill
- asc-signing-setupSkill
- asc-submission-healthSkill
- asc-testflight-orchestrationSkill
- browser-testingSkill
- changelog-generatorSkill
- claude-actions-auditorSkill
- clean-codeSkill
- codebase-onboardingSkill
- code-explainerSkill
- code-reviewerSkill
- code-simplifierSkill
- comment-analyzerSkill
- database-schema-designerSkill
- ddd-architectSkill
- decision-frameworksSkill
- dedup-code-agentSkill
- deployment-ci-cdSkill
- design-systemSkill
- dockerSkill
- documentation-generationSkill
- domain-finderSkill
- error-detectiveSkill
- eval-guideSkill
- feature-forgeSkill
- firebase-basicsSkill
- firebase-hosting-basicsSkill
- fixing-accessibilitySkill
- fixing-motion-performanceSkill
- flutter-animationsSkill
- flutter-genuiSkill
- flutter-mobileSkill
- flutter-security-expertSkill
- frontend-designSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 0 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 173
Rule: Prefer afterNextRender over afterRender — it runs once.
- Very specific: line 196
Rule: Use @let to avoid repeating computed signal calls in templates.
- Very specific: line 232
Run: ng test (uses Vitest by default in Angular 21 workspaces).
- Very specific: line 394
Always use ChangeDetectionStrategy.OnPush.
- Very specific: line 431
Import standalone components directly in TestBed.configureTestingModule({ imports: [...] })
- Very specific: line 432
Use componentRef.setInput('name', value) to set signal inputs in tests
- Very specific: line 433
Call fixture.detectChanges() after signal mutations to trigger DOM update
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Iron Law
READ angular-spa skill for TailwindCSS 4.x, daisyUI 5.5.5, and workspace conventions BEFORE implementing. This skill is API reference only — no design token or styling patterns here.
When to Use This Skill
- Building new Angular applications (v20+)
- Implementing Signals-based reactive patterns
- Creating Standalone Components and migrating from NgModules
- Configuring Zoneless Angular applications
- Implementing SSR, prerendering, and hydration
- Optimizing Angular performance
- Adopting modern Angular patterns and best practices
Do Not Use This Skill When
- Migrating from AngularJS (1.x) — use
angular-migrationskill - Working with legacy Angular apps that cannot upgrade
- General TypeScript issues — use
typescript-expertskill
Version context: Angular 20 (Signals/Zoneless stable), Angular 21 (Signals-first default, Signal Forms available — current), Angular 22 (Signal Forms further enhancements).
Angular 21 Zoneless Note
Angular 21 is zoneless by default. Do NOT add provideZonelessChangeDetection() — it is implicit and adding it causes warnings.
- Angular 20:
provideZonelessChangeDetection()required explicitly - Angular 21+: Zoneless is the default. No provider needed. No
zone.jsimport.
This workspace uses Angular 21+. The patterns below show v20-style explicit providers for reference — in Angular 21 omit those providers.
1. Signals: The New Reactive Primitive
Signals are Angular's fine-grained reactivity system, replacing zone.js-based change detection.
Core signal / computed / effect
import { signal, computed, effect } from "@angular/core";
const count = signal(0);
count.set(5);
count.update((v) => v + 1);
const doubled = computed(() => count() * 2);
effect(() => {
console.log(`Count changed to: ${count()}`);
});Signal inputs, outputs, and model
import { Component, input, output, model } from "@angular/core";
@Component({
selector: "app-user-card",
standalone: true,
template: `
<div class="card">
<h3>{{ name() }}</h3>
<span>{{ role() }}</span>
<button (click)="select.emit(id())">Select</button>
</div>
`,
})
export class UserCardComponent {
id = input.required<string>();
name = input.required<string>();
role = input<string>("User");
select = output<string>();
isSelected = model(false);
}
// <app-user-card [id]="'123'" [name]="'John'" [(isSelected)]="selected" />Signal queries (viewChild, viewChildren, contentChild): See references/signals-core.md
1b. linkedSignal — Derived Writable Signals
linkedSignal creates a writable signal whose default resets when its source changes.
| Use | Tool |
| Derived read-only value | computed() |
| Writable value that resets on source change | linkedSignal() |
| Local state with no dependency | signal() |
import { signal, linkedSignal } from '@angular/core';
const items = signal(['a', 'b', 'c']);
const selectedItem = linkedSignal(() => items()[0]);
selectedItem.set('b'); // 'b'
items.set(['x', 'y', 'z']); // selectedItem resets to 'x'Full examples (advanced + pagination): references/signals-core.md
1c. resource() — Reactive Async Data Fetching
resource() is Angular's built-in reactive primitive for async data.
| Scenario | Use |
| Component-local async data tied to signals | resource() |
| Service-level shared HTTP calls | HttpClient + inject() |
| Complex async pipelines (retry, cancel, merge) | HttpClient + RxJS |
| One-time data loads | Either |
import { httpResource } from '@angular/common/http';
// HTTP GET shorthand — refetches when userId() changes
userResource = httpResource<User>(() => `/api/users/${this.userId()}`);Full API (resource() component, abort signal, status signals): references/signals-core.md
1d. afterNextRender / afterRender — DOM Lifecycle Hooks
In zoneless Angular 21, afterNextRender and afterRender replace NgZone lifecycle hacks for DOM-dependent initialization. Use these instead of ngAfterViewInit for code that requires a real DOM (chart init, third-party widget, scroll position).
import { Component, afterNextRender, afterRender, ElementRef, viewChild } from '@angular/core';
@Component({ selector: 'app-chart', template: '<canvas #canvas></canvas>' })
export class ChartComponent {
canvas = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');
constructor() {
// Runs once after the first render — DOM is guaranteed to exist
afterNextRender(() => {
initChart(this.canvas().nativeElement);
});
// Runs after every render — use sparingly (performance cost)
afterRender(() => {
updateScrollPosition();
});
}
}Rule: Prefer afterNextRender over afterRender — it runs once. Both run in the browser only (SSR-safe).
1e. @let — Template Variable Declaration (Angular 18+)
@let declares a local template variable — replaces the *ngIf as alias hack and verbose ng-template patterns.
<!-- Declare a local alias for a long expression -->
@let user = currentUser();
@let greeting = 'Hello, ' + user.name + '!';
<h1>{{ greeting }}</h1>
<p>{{ user.email }}</p>
<!-- Useful with async resources -->
@let data = userResource.value();
@if (data) {
<app-user-profile [user]="data" />
}Rule: Use @let to avoid repeating computed signal calls in templates. Do not use it as a substitute for computed() — @let re-evaluates on every render pass.
1f. Testing: Vitest (Stable in Angular 21)
Angular 21 ships with Vitest as the stable test runner (replaces Karma). New projects default to Vitest. Migrate existing Karma setups.
// vitest.config.ts (Angular CLI generates this)
import { defineConfig } from 'vitest/config';
import angular from '@analogjs/vite-plugin-angular';
export default defineConfig({
plugins: [angular()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['src/test-setup.ts'],
},
});// Component test with zoneless TestBed
import { TestBed } from '@angular/core/testing';
import { provideExperimentalZonelessChangeDetection } from '@angular/core';
beforeEach(() => {
TestBed.configureTestingModule({
providers: [provideExperimentalZonelessChangeDetection()],
imports: [MyComponent],
});
});Run: ng test (uses Vitest by default in Angular 21 workspaces). See reference/testing-vitest.md for full patterns.
2. Standalone Components
Standalone components are self-contained and don't require NgModule declarations.
Creating Standalone Components
import { Component } from "@angular/core";
import { CommonModule } from "@angular/common";
import { RouterLink } from "@angular/router";
@Component({
// standalone: true is the default in Angular v20+ — omit it
selector: "app-header",
imports: [RouterLink], // CommonModule is a compat shim — don't import it
template: `
<header>
<a routerLink="/">Home</a>
<a routerLink="/about">About</a>
</header>
`,
})
export class HeaderComponent {}Bootstrapping Without NgModule
// main.ts
import { bootstrapApplication } from "@angular/platform-browser";
import { provideRouter } from "@angular/router";
import { provideHttpClient } from "@angular/common/http";
import { AppComponent } from "./app/app.component";
import { routes } from "./app/app.routes";
bootstrapApplication(AppComponent, {
providers: [provideRouter(routes), provideHttpClient()],
});Lazy Loading Standalone Components
export const routes: Routes = [
{
path: "dashboard",
loadComponent: () =>
import("./dashboard/dashboard.component").then((m) => m.DashboardComponent),
},
{
path: "admin",
loadChildren: () =>
import("./admin/admin.routes").then((m) => m.ADMIN_ROUTES),
},
];3. Zoneless Angular
Angular 21 reminder: Zoneless is the default. The
provideZonelessChangeDetection()call below is v20-style — omit it in Angular 21 projects.
// main.ts (Angular 20 style — NOT needed in Angular 21+)
bootstrapApplication(AppComponent, {
providers: [provideZonelessChangeDetection()],
});Zoneless Component Pattern
import { Component, signal, ChangeDetectionStrategy } from "@angular/core";
@Component({
selector: "app-counter",
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div>Count: {{ count() }}</div>
<button (click)="increment()">+</button>
`,
})
export class CounterComponent {
count = signal(0);
increment() { this.count.update((v) => v + 1); }
}Benefits: no zone.js patches, cleaner stack traces, ~15KB bundle savings, better Web Component interop.
4. Server-Side Rendering & Hydration
See references/ssr-hydration.md for SSR setup, hydration configuration, incremental hydration patterns, TransferState, and common SSR troubleshooting.
5. Modern Routing Patterns
See references/api-reference.md for full routing examples (functional guards, resolvers).
Key patterns:
CanActivateFnwithinject()for functional guardsResolveFn<T>for route-level data pre-fetchingtoSignal(route.data.pipe(...))to consume resolved data
6. Dependency Injection
See references/api-reference.md for full DI examples (inject(), InjectionToken).
Key patterns:
inject()function (no constructor required)InjectionToken<T>for typed configuration values
7. Component Composition
See references/api-reference.md for full composition examples (ng-content slots, hostDirectives).
Key patterns:
<ng-content select="[attr]">for named slotshostDirectivesfor behavior composition without inheritance
8. Signal-Based State Management
See references/api-reference.md for full state service and component store examples.
Key patterns:
- Private
signal()+ publiccomputed()for encapsulated state @Injectable()(noprovidedIn: 'root') for scoped component stores
9. Forms with Signals
See references/api-reference.md for full reactive forms and signal form patterns.
Key patterns:
- Signal Forms (preferred for Angular 21+) — see
signal-forms.mdreference below FormBuilder+Validatorsfor reactive forms (legacy, still supported)- Signal-based validation via
computed()for derived validation state
Angular 21+: Prefer Signal Forms over reactive forms for new apps. See
references/signal-forms.md.
10. Performance Optimization
Change Detection Strategies
Always use ChangeDetectionStrategy.OnPush. Triggers re-check only when: input signal/reference changes, event handler runs, async pipe emits, or signal value changes.
Defer Blocks for Lazy Loading
@defer (on viewport) {
<app-heavy-chart />
} @placeholder {
<div class="skeleton" />
} @loading (minimum 200ms) {
<app-spinner />
} @error {
<p>Failed to load chart</p>
}NgOptimizedImage
import { NgOptimizedImage } from '@angular/common';
@Component({
imports: [NgOptimizedImage],
template: `
<img ngSrc="hero.jpg" width="800" height="600" priority />
<img ngSrc="thumbnail.jpg" width="200" height="150" loading="lazy" placeholder="blur" />
`
})11. Testing Modern Angular
See references/api-reference.md for full testing examples (signal components, setInput).
Key patterns:
- Import standalone components directly in
TestBed.configureTestingModule({ imports: [...] }) - Use
componentRef.setInput('name', value)to set signal inputs in tests - Call
fixture.detectChanges()after signal mutations to trigger DOM update
Key Decision Tables
See references/api-reference.md for full Signals vs RxJS table and Pattern Do/Don't summary.
| Use Case | Use Signals | Use RxJS |
| Local component state | Yes | No — overkill |
| HTTP requests | No | Yes — HttpClient Observable |
| Complex async flows | No | Yes — switchMap, mergeMap |
Common Troubleshooting
See references/api-reference.md for the full troubleshooting table.
| Issue | Solution |
| Signal not updating UI | Ensure OnPush + call signal as function count() |
provideZonelessChangeDetection warning in v21 | Remove call — zoneless is the default in v21+ |
| SSR fetch fails | Use TransferState or withFetch() |
Related Skills
angular-spa— workspace skill with TailwindCSS 4.x, daisyUI 5.5.5, conventionsangular-best-practices— impact-prioritized rules (CRITICAL to LOW-MEDIUM)angular-ui-patterns— loading, error, empty state patterns
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

