Angular spa

From kumaran-is/claude-code-onboarding · View interactive version

Angular spa is an AI agent skill from the GitHub repository kumaran-is/claude-code-onboarding. 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.

How to use this skill

Skill file

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:

  1. Read reference/daisyui-v5-components.md — for semantic color tokens and component patterns
  2. Read reference/tailwind-v4-config.md — for TailwindCSS 4.x setup constraints
  3. Verify token awareness — can you name the color token (bg-primary, text-base-content), spacing base (4px), and typography approach you will use?
  4. If not → read the reference files before writing any template or style code
  5. For accessibility: read reference/accessibility-checklist.md before adding interactive elements

Process

  1. Understand Requirements — Clarify feature scope, API endpoints, data models, and UI requirements
  2. Scaffold Structure — Create feature folder under src/app/features/<feature-name>/
  3. Generate Component — Read reference/angular-templates.md for templates; create with signals-based state
  4. Create Service — Read reference/angular-templates.md for service template; implement API calls with HttpClient + RxJS
  5. Configure Routes — Add lazy-loaded route using loadComponent in app.routes.ts or feature routes
  6. Write Tests — Read reference/angular-templates.md for test templates; write unit tests with zoneless TestBed
  7. Style Component — Use daisyUI components + TailwindCSS utilities; fallback to SCSS with BEM naming
  8. Verify Build — Run ng build to ensure no compilation errors

Reference Files

Detailed patterns are in reference/:

Angular Best Practices & Code Templates

UI/UX & Design System

Anti-Patterns — What to Avoid

Architecture

State & Change Detection

Templates

Dependency Injection

Subscriptions & Memory

DOM & Styling

Design Tokens

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
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.