Home › Angular › Angular signals and standalone CLAUDE.md

Angular signals and standalone CLAUDE.md

CLAUDE.md for modern Angular apps: standalone components, signals, input()/output(), built-in control flow, inject(), zoneless-ready patterns, and tests.

Claude Code (CLAUDE.md)Angular

How to use

Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

CLAUDE.mdDownload  
# CLAUDE.md: Angular app (signals era)

## Commands
`ng serve` · `ng build` · `ng test` · `ng lint` · generate with `ng generate component features/x/y` so files match project conventions. Check `@angular/core` in `package.json` and only use APIs that version marks stable.

## Conventions
- Standalone components, directives and pipes only (no new NgModules). Bootstrap with `bootstrapApplication` and providers in `app.config.ts`.
- `ChangeDetectionStrategy.OnPush` on every component; write code that would also work zoneless (signals or async pipe drive updates, no reliance on `setTimeout` triggering change detection).
- State with signals: `signal()`, `computed()`, `linkedSignal()` for derived-but-writable values; `effect()` only for side effects outside Angular (logging, storage, DOM APIs), never to copy one signal into another.
- Component API: `input()`, `input.required()`, `output()`, `model()` instead of `@Input`/`@Output` decorators in new code.
- Templates use built-in control flow: `@if`, `@for (item of items; track item.id)`, `@switch`, `@defer` for heavy below-the-fold content. No `*ngIf`/`*ngFor` in new code.
- DI with `inject()` in field initializers rather than constructor parameters.
- HTTP via `HttpClient` in services; convert to signals with `toSignal()` or use `resource()`/`httpResource()` if available in the project's version. Unsubscribe-free code: prefer `toSignal`, `async` pipe or `takeUntilDestroyed()`.
- Forms: typed reactive forms (`FormGroup<{...}>`, `nonNullable`), validators in the form definition.
- Routing: lazy load features with `loadComponent`/`loadChildren`; functional guards and resolvers.
- Styles scoped to components; global tokens in `styles.scss`.

## Tests
Component tests with `TestBed` (or the configured runner) using `fixture.componentRef.setInput()`; test services with `provideHttpClientTesting()`.

## Don't
Don't use `any`, manual `subscribe()` without cleanup, or direct DOM access via `ElementRef.nativeElement` when a binding works.

More: all Angular rules · all Claude Code (CLAUDE.md) rules

Related rules

Angular 20 Copilot instructions

Copilot instructions for Angular 20 apps using standalone components, signals, and the new control flow.

GitHub CopilotAngular

Next.js CLAUDE.md

A CLAUDE.md for Claude Code working in a Next.js + Prisma + Tailwind codebase.

Claude Code (CLAUDE.md)Next.js

Tailwind CSS .claude/rules file

A path-scoped Claude Code rules file (.claude/rules) for Tailwind v4 styling in component files.

Claude Code (CLAUDE.md)Tailwind CSS

Astro content site rules

Cursor rules for Astro 5 sites with content collections, islands, and zero-JS-by-default pages.

CursorAstro

Astro Starlight docs Windsurf rules

Windsurf rules for documentation sites built with Astro Starlight: content structure, frontmatter, components, and links.

WindsurfAstro

Chrome extension (Manifest V3) rules

Cursor rules for building Manifest V3 browser extensions with TypeScript and minimal permissions.

CursorChrome extensions

Get the best new AI prompts every week

One short email a week: the best new prompts and rules for ChatGPT, Claude, Gemini, Midjourney, Cursor and more, plus what changed in the tools. Free, unsubscribe anytime.

Finishes on our newsletter page at beehiiv (opens in a new tab). Or subscribe directly.