Iron Law
NO ANGULAR CODE WITHOUT READING reference/angular-conventions.md FIRST — conventions, folder structure, and daisyUI token rules are all there
STYLE LAW: Strictly follow https://angular.dev/style-guide for ALL naming, file structure, and code organization. See reference/angular-conventions.md for the quick reference.
ANIMATION LAW: Use @angular/animations for ALL interactive animations. Never raw CSS transitions on stateful elements. See reference/angular-animations.md.
Angular 21.x SPA Development Skill
Tech Stack: Angular 21+, TailwindCSS 4.x, daisyUI 5.5.5
Conventions & Structure
For code conventions, styling rules, design principles, key patterns, folder structure, and common commands, read reference/angular-conventions.md
Documentation Sources
Before generating code, consult these sources for current syntax and APIs:
| Source |
URL / Tool |
Purpose |
| Angular v21 |
angular-cli MCP (ng mcp) |
Workspace-aware help, schematics, builds, best practices |
| Angular v21 |
https://angular.dev/assets/context/llms-full.txt |
Static docs bundle — API reference, deprecated features |
| daisyUI v5.5.5 |
https://daisyui.com/llms.txt |
Component reference, color system, themes |
| TailwindCSS / RxJS |
Context7 MCP |
Latest syntax, utilities, operators |
| Angular + Tailwind official guide |
https://angular.dev/guide/tailwind |
Canonical install steps, ng add tailwindcss, build integration |
Cross-check all Angular APIs and CLI flags against fetched docs — do NOT use deprecated or removed features.
For Angular & TypeScript best practices, read reference/angular-best-practices.md
Quick Scaffold — New Angular Project
npx @angular/cli@latest new my-app --style=scss --ssr=false
cd my-app
Do NOT pass --standalone (removed/default since v19). Verify flags against fetched docs.
Before Writing Any UI Code
Before creating or modifying any component template or styles:
- Read
reference/daisyui-v5-components.md — for semantic color tokens and component patterns
- Read
reference/tailwind-v4-config.md — for TailwindCSS 4.x setup constraints
- Verify token awareness — can you name the color token (
bg-primary, text-base-content), spacing base (4px), and typography approach you will use?
- If not → read the reference files before writing any template or style code
- For accessibility: read
reference/accessibility-checklist.md before adding interactive elements
Process
- Understand Requirements — Clarify feature scope, API endpoints, data models, and UI requirements
- Scaffold Structure — Create feature folder under
src/app/features/<feature-name>/
- Generate Component — Read
reference/angular-templates.md for templates; create with signals-based state
- Create Service — Read
reference/angular-templates.md for service template; implement API calls with HttpClient + RxJS
- Configure Routes — Add lazy-loaded route using
loadComponent in app.routes.ts or feature routes
- Write Tests — Read
reference/angular-templates.md for test templates; write unit tests with zoneless TestBed
- Style Component — Use daisyUI components + TailwindCSS utilities; fallback to SCSS with BEM naming
- Verify Build — Run
ng build to ensure no compilation errors
Reference Files
Detailed patterns are in reference/:
Angular Best Practices & Code Templates
angular-best-practices.md — TypeScript, component, template, state management, services, forms, zoneless, accessibility, and testing best practices
angular-templates.md — Standalone component, service, lazy routes, app.config, interceptor, guard, and test templates
angular-troubleshooting.md — Common errors (NG0908, NullInjectorError, blank screen), CLI commands, and best practices
UI/UX & Design System
tailwind-v4-config.md — TailwindCSS 4.x setup, breaking changes from v3
daisyui-v5-components.md — Full component reference, color system, themes, quick setup patterns
angular-forms-fields.md — Input fields, select, textarea, checkbox, radio patterns
angular-forms-validation.md — Validation patterns, error messages, async validators
angular-forms-advanced.md — Multi-step forms, dynamic fields, form arrays
angular-ui-tables.md — Table and grid patterns with sorting, filtering, pagination
angular-ui-lists.md — List, card, and feed UI patterns
angular-ui-navigation.md — Navigation, breadcrumbs, tabs, and sidebar patterns
angular-ui-feedback-components.md — Toasts, dialogs, themes, error handling, utilities
accessibility-checklist.md — WCAG 2.1 AA checklist, ARIA patterns, test protocol
angular-aria.md — Angular CDK accessible headless components (FocusTrap, ListKeyManager, LiveAnnouncer, Accordion, Combobox)
component-harnesses.md — Angular CDK component harnesses for stable UI testing
testing-vitest.md — Vitest setup, zoneless TestBed, testing Signals and resource(), migration from Karma
e2e-cypress.md — Cypress E2E setup, component testing, custom commands, data-cy convention
smart-dumb-components.md — Smart (container) vs Dumb (presentational) component pattern, decision tree, signal-based examples, hard rules, file location enforcement
angular-animations.md — Angular Animations API (animate.enter/animate.leave, trigger(), state(), keyframes(), stagger()), timing standards, animation rules
user-research.md — Persona templates, journey mapping, usability testing, SUS survey
Anti-Patterns — What to Avoid
Architecture
- NEVER create
NgModule — Angular 21 is fully standalone; all components, pipes, and directives are standalone by default
- NEVER call HTTP or business logic directly in a component — delegate to an injectable service
State & Change Detection
- NEVER use
@Input() / @Output() decorators for new code — use input(), output(), and model() signals (Angular 21 standard)
- NEVER use
BehaviorSubject for component state — use signal() and computed()
- NEVER rely on default change detection (
ChangeDetectionStrategy.Default) — always use OnPush with signals
Templates
- NEVER use
*ngIf, *ngFor, *ngSwitch structural directives — use @if, @for, @switch control flow (Angular 17+, standard in v21)
- NEVER import
CommonModule in standalone components — it is a compatibility shim; import nothing or use control flow syntax
Dependency Injection
- NEVER inject services via constructor parameters — use the
inject() function in Angular 21
- NEVER import
HttpClientModule — use provideHttpClient() in app.config.ts (functional API)
Subscriptions & Memory
- NEVER subscribe manually without
takeUntilDestroyed(destroyRef) — memory leaks in long-lived components
- NEVER use
ngOnDestroy to unsubscribe — use DestroyRef and takeUntilDestroyed() instead
DOM & Styling
- NEVER use
document.getElementById or direct DOM manipulation — use viewChild() signal or Angular CDK
- NEVER use inline
style="" attributes — use TailwindCSS utilities or SCSS
Design Tokens
- NEVER use
style="color: #3B82F6" inline — use class="text-primary"
- NEVER use hardcoded Tailwind primitive color classes like
bg-blue-500 — use semantic bg-primary
- NEVER use
style="padding: 16px" — use class="p-4"
- NEVER use
style="font-size: 16px" — use class="text-base"
Error Handling
Build failures (NG0908, NullInjectorError): Read reference/angular-troubleshooting.md for common errors and fixes.
TailwindCSS not applied: Verify .postcssrc.json exists (not postcss.config.js) and global styles use .css (not .scss).
Blank screen on load: Check browser console for lazy-loading errors. Verify route paths and loadComponent imports.
Common Commands
ng serve # Dev server (http://localhost:4200)
ng test --watch=false # Run unit tests once (no watch)
ng test # Run unit tests in watch mode
ng build # Production build
ng lint # ESLint check
ng generate component features/my-feature/my-component --standalone # Scaffold component
ng generate service features/my-feature/my-service # Scaffold service
Design Token System
Full token definitions are in .claude/skills/ui-standards-tokens/reference/ui-design-tokens.md. This section covers Angular-specific usage.
Token Hierarchy (3 Tiers)
Primitive → Semantic → Component
/* Primitive */
--color-blue-500: #3B82F6;
/* Semantic */
--color-primary: var(--color-blue-500);
/* Component */
--button-bg-primary: var(--color-primary);
Never use primitive tokens directly in component CSS. Components reference component tokens; component tokens reference semantic tokens.
daisyUI Token Mapping
| Category |
daisyUI / Tailwind classes |
| Colors |
bg-primary, text-base-content, bg-base-100/200/300, text-error, bg-success |
| Spacing |
p-2 = 8px, p-4 = 16px, p-6 = 24px (4px base scale) |
| Typography |
text-sm, text-base, text-lg, font-semibold, font-bold |
| Borders |
rounded-sm, rounded-md, rounded-lg, rounded-full, border border-base-300 |
| Shadows |
shadow-sm, shadow-md, shadow-xl |
| Motion |
transition-all duration-200 |
| Z-index |
custom CSS vars: --z-dropdown: 1000, --z-modal: 1050, --z-tooltip: 1070 |
Theme Switching
// theme.service.ts
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class ThemeService {
setTheme(theme: 'light' | 'dark' | 'custom'): void {
document.documentElement.setAttribute('data-theme', theme);
localStorage.setItem('theme', theme);
}
getTheme(): string {
return localStorage.getItem('theme') ?? 'light';
}
}
daisyUI v5.5.5 uses the data-theme attribute on <html>. All daisyUI semantic classes switch automatically — no additional CSS is needed per component.
Verify
ng serve # Starts at http://localhost:4200 — no errors in terminal
ng test --watch=false # All unit tests pass
ng build # Exit code 0, no NG build errors
npx ng lint # Zero lint violations
1---2name: angular-spa3description: Angular 21.x SPA development skill with TailwindCSS 4.x and daisyUI 5.5.5. Use when building Angular standalone components, services, lazy-loaded routes, unit tests, or creating UI with TailwindCSS + daisyUI. Covers component scaffolding, UI/UX design, accessibility audits, and design systems.4---56## Iron Law78**NO ANGULAR CODE WITHOUT READING `reference/angular-conventions.md` FIRST — conventions, folder structure, and daisyUI token rules are all there**910**STYLE LAW:** Strictly follow https://angular.dev/style-guide for ALL naming, file structure, and code organization. See `reference/angular-conventions.md` for the quick reference.1112**ANIMATION LAW:** Use `@angular/animations` for ALL interactive animations. Never raw CSS transitions on stateful elements. See `reference/angular-animations.md`.1314# Angular 21.x SPA Development Skill1516> **Tech Stack**: Angular 21+, TailwindCSS 4.x, daisyUI 5.5.51718## Conventions & Structure1920> For code conventions, styling rules, design principles, key patterns, folder structure, and common commands, read `reference/angular-conventions.md`2122## Documentation Sources2324Before generating code, consult these sources for current syntax and APIs:2526| Source | URL / Tool | Purpose |27|--------|-----------|---------|28| Angular v21 | `angular-cli` MCP (ng mcp) | Workspace-aware help, schematics, builds, best practices |29| Angular v21 | `https://angular.dev/assets/context/llms-full.txt` | Static docs bundle — API reference, deprecated features |30| daisyUI v5.5.5 | `https://daisyui.com/llms.txt` | Component reference, color system, themes |31| TailwindCSS / RxJS | `Context7` MCP | Latest syntax, utilities, operators |32| Angular + Tailwind official guide | `https://angular.dev/guide/tailwind` | Canonical install steps, `ng add tailwindcss`, build integration |3334Cross-check all Angular APIs and CLI flags against fetched docs — do NOT use deprecated or removed features.3536> For Angular & TypeScript best practices, read reference/angular-best-practices.md3738## Quick Scaffold — New Angular Project3940```bash41npx @angular/cli@latest new my-app --style=scss --ssr=false42cd my-app43```4445Do NOT pass `--standalone` (removed/default since v19). Verify flags against fetched docs.4647## Before Writing Any UI Code4849Before creating or modifying any component template or styles:50511. **Read `reference/daisyui-v5-components.md`** — for semantic color tokens and component patterns522. **Read `reference/tailwind-v4-config.md`** — for TailwindCSS 4.x setup constraints533. **Verify token awareness** — can you name the color token (`bg-primary`, `text-base-content`), spacing base (4px), and typography approach you will use?544. If not → read the reference files before writing any template or style code555. For accessibility: read `reference/accessibility-checklist.md` before adding interactive elements5657## Process58591. **Understand Requirements** — Clarify feature scope, API endpoints, data models, and UI requirements602. **Scaffold Structure** — Create feature folder under `src/app/features/<feature-name>/`613. **Generate Component** — Read `reference/angular-templates.md` for templates; create with signals-based state624. **Create Service** — Read `reference/angular-templates.md` for service template; implement API calls with HttpClient + RxJS635. **Configure Routes** — Add lazy-loaded route using `loadComponent` in `app.routes.ts` or feature routes646. **Write Tests** — Read `reference/angular-templates.md` for test templates; write unit tests with zoneless TestBed657. **Style Component** — Use daisyUI components + TailwindCSS utilities; fallback to SCSS with BEM naming668. **Verify Build** — Run `ng build` to ensure no compilation errors6768## Reference Files6970Detailed patterns are in `reference/`:7172### Angular Best Practices & Code Templates73- `angular-best-practices.md` — TypeScript, component, template, state management, services, forms, zoneless, accessibility, and testing best practices74- `angular-templates.md` — Standalone component, service, lazy routes, app.config, interceptor, guard, and test templates75- `angular-troubleshooting.md` — Common errors (NG0908, NullInjectorError, blank screen), CLI commands, and best practices7677### UI/UX & Design System78- `tailwind-v4-config.md` — TailwindCSS 4.x setup, breaking changes from v379- `daisyui-v5-components.md` — Full component reference, color system, themes, quick setup patterns80- `angular-forms-fields.md` — Input fields, select, textarea, checkbox, radio patterns81- `angular-forms-validation.md` — Validation patterns, error messages, async validators82- `angular-forms-advanced.md` — Multi-step forms, dynamic fields, form arrays83- `angular-ui-tables.md` — Table and grid patterns with sorting, filtering, pagination84- `angular-ui-lists.md` — List, card, and feed UI patterns85- `angular-ui-navigation.md` — Navigation, breadcrumbs, tabs, and sidebar patterns86- `angular-ui-feedback-components.md` — Toasts, dialogs, themes, error handling, utilities87- `accessibility-checklist.md` — WCAG 2.1 AA checklist, ARIA patterns, test protocol88- `angular-aria.md` — Angular CDK accessible headless components (FocusTrap, ListKeyManager, LiveAnnouncer, Accordion, Combobox)89- `component-harnesses.md` — Angular CDK component harnesses for stable UI testing90- `testing-vitest.md` — Vitest setup, zoneless TestBed, testing Signals and resource(), migration from Karma91- `e2e-cypress.md` — Cypress E2E setup, component testing, custom commands, data-cy convention92- `smart-dumb-components.md` — Smart (container) vs Dumb (presentational) component pattern, decision tree, signal-based examples, hard rules, file location enforcement93- `angular-animations.md` — Angular Animations API (`animate.enter`/`animate.leave`, `trigger()`, `state()`, `keyframes()`, `stagger()`), timing standards, animation rules94- `user-research.md` — Persona templates, journey mapping, usability testing, SUS survey9596## Anti-Patterns — What to Avoid9798### Architecture99- **NEVER** create `NgModule` — Angular 21 is fully standalone; all components, pipes, and directives are standalone by default100- **NEVER** call HTTP or business logic directly in a component — delegate to an injectable service101102### State & Change Detection103- **NEVER** use `@Input()` / `@Output()` decorators for new code — use `input()`, `output()`, and `model()` signals (Angular 21 standard)104- **NEVER** use `BehaviorSubject` for component state — use `signal()` and `computed()`105- **NEVER** rely on default change detection (`ChangeDetectionStrategy.Default`) — always use `OnPush` with signals106107### Templates108- **NEVER** use `*ngIf`, `*ngFor`, `*ngSwitch` structural directives — use `@if`, `@for`, `@switch` control flow (Angular 17+, standard in v21)109- **NEVER** import `CommonModule` in standalone components — it is a compatibility shim; import nothing or use control flow syntax110111### Dependency Injection112- **NEVER** inject services via constructor parameters — use the `inject()` function in Angular 21113- **NEVER** import `HttpClientModule` — use `provideHttpClient()` in `app.config.ts` (functional API)114115### Subscriptions & Memory116- **NEVER** subscribe manually without `takeUntilDestroyed(destroyRef)` — memory leaks in long-lived components117- **NEVER** use `ngOnDestroy` to unsubscribe — use `DestroyRef` and `takeUntilDestroyed()` instead118119### DOM & Styling120- **NEVER** use `document.getElementById` or direct DOM manipulation — use `viewChild()` signal or Angular CDK121- **NEVER** use inline `style=""` attributes — use TailwindCSS utilities or SCSS122123### Design Tokens124- **NEVER** use `style="color: #3B82F6"` inline — use `class="text-primary"`125- **NEVER** use hardcoded Tailwind primitive color classes like `bg-blue-500` — use semantic `bg-primary`126- **NEVER** use `style="padding: 16px"` — use `class="p-4"`127- **NEVER** use `style="font-size: 16px"` — use `class="text-base"`128129## Error Handling130131**Build failures (`NG0908`, `NullInjectorError`)**: Read `reference/angular-troubleshooting.md` for common errors and fixes.132133**TailwindCSS not applied**: Verify `.postcssrc.json` exists (not `postcss.config.js`) and global styles use `.css` (not `.scss`).134135**Blank screen on load**: Check browser console for lazy-loading errors. Verify route paths and `loadComponent` imports.136137## Common Commands138139```bash140ng serve # Dev server (http://localhost:4200)141ng test --watch=false # Run unit tests once (no watch)142ng test # Run unit tests in watch mode143ng build # Production build144ng lint # ESLint check145ng generate component features/my-feature/my-component --standalone # Scaffold component146ng generate service features/my-feature/my-service # Scaffold service147```148149## Design Token System150151Full token definitions are in `.claude/skills/ui-standards-tokens/reference/ui-design-tokens.md`. This section covers Angular-specific usage.152153### Token Hierarchy (3 Tiers)154155```156Primitive → Semantic → Component157```158159```css160/* Primitive */161--color-blue-500: #3B82F6;162163/* Semantic */164--color-primary: var(--color-blue-500);165166/* Component */167--button-bg-primary: var(--color-primary);168```169170Never use primitive tokens directly in component CSS. Components reference component tokens; component tokens reference semantic tokens.171172### daisyUI Token Mapping173174| Category | daisyUI / Tailwind classes |175|---|---|176| Colors | `bg-primary`, `text-base-content`, `bg-base-100/200/300`, `text-error`, `bg-success` |177| Spacing | `p-2` = 8px, `p-4` = 16px, `p-6` = 24px (4px base scale) |178| Typography | `text-sm`, `text-base`, `text-lg`, `font-semibold`, `font-bold` |179| Borders | `rounded-sm`, `rounded-md`, `rounded-lg`, `rounded-full`, `border border-base-300` |180| Shadows | `shadow-sm`, `shadow-md`, `shadow-xl` |181| Motion | `transition-all duration-200` |182| Z-index | custom CSS vars: `--z-dropdown: 1000`, `--z-modal: 1050`, `--z-tooltip: 1070` |183184### Theme Switching185186```typescript187// theme.service.ts188import { Injectable } from '@angular/core';189190@Injectable({ providedIn: 'root' })191export class ThemeService {192 setTheme(theme: 'light' | 'dark' | 'custom'): void {193 document.documentElement.setAttribute('data-theme', theme);194 localStorage.setItem('theme', theme);195 }196197 getTheme(): string {198 return localStorage.getItem('theme') ?? 'light';199 }200}201```202203daisyUI v5.5.5 uses the `data-theme` attribute on `<html>`. All daisyUI semantic classes switch automatically — no additional CSS is needed per component.204205## Verify206207```bash208ng serve # Starts at http://localhost:4200 — no errors in terminal209ng test --watch=false # All unit tests pass210ng build # Exit code 0, no NG build errors211npx ng lint # Zero lint violations212```213214- [ ] App serves without console errors215- [ ] All Vitest unit tests pass (>90% coverage enforced)216- [ ] Production build completes successfully217- [ ] No TypeScript errors (`tsc --noEmit`)218- [ ] Shared components in `shared/components/` have zero `inject()` calls (dumb rule)219- [ ] Service-injecting components live in `pages/` or `features/` (smart rule)