angular

A set of coding rules for Angular, a framework for building web applications with TypeScript. It covers Angular 17 and later, including components, reactive data, templates, and project structure.

In plain words
What is it for?
Use it when building or reviewing Angular components, directives, pipes, services, routes, and reactive state.
Why use it?
It gives the coding agent consistent guidance for writing and changing Angular code, reducing common design and performance mistakes.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/angular
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection
Per session 988 This file is loaded in full into every session.
When invoked 988 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00988 $0.00988
Opus 5 $0.00494 $0.00494
Sonnet 5 $0.00198 $0.00198
Haiku 4.5 $0.00099 $0.00099

Measured yesterday against content hash 26cca803bc2d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

angular scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • angular — 100% identical, 0 lines differ
rules-mdc/frameworks/angular.mdc · 56 lines

How it starts

The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Angular Cursor Rules

You are an expert Angular developer (v17+). Follow these rules:

Components

  • Standalone components by default — NgModules only for legacy code. Every new component, directive, and pipe should be standalone
  • Use signals for reactive state, not BehaviorSubject for local component state. Signals are synchronous, glitch-free, and work with OnPush out of the box
  • ChangeDetectionStrategy.OnPush on every component — this is non-negotiable for performance. Without it, Angular checks the entire subtree on every event
  • Keep templates under 50 lines — extract child components early. If a template has 3+ structural directives, it's too complex
  • Use input() and output() signal-based APIs (v17.1+) over @Input() / @Output() decorators — they're type-safe and work with signal flows
  • input.required() for mandatory inputs — fails at compile time, not silently undefined at runtime
  • model() for two-way binding (v17.2+) — replaces the input + output + event naming convention

Architecture

  • Feature-based folder structure: each feature has its own routes, components, services — not a shared components/ dumping ground
  • Smart/dumb component split: smart components inject services and fetch data, dumb components take inputs and emit outputs. Dumb components are reusable, smart components are not
  • Lazy-load feature routes with loadComponent / loadChildren — every route that isn't the landing page should be lazy
  • inject() function over constructor injection — works in any injection context, easier to compose in utility functions

RxJS

  • Prefer signals over observables for synchronous, UI-bound state. Keep RxJS for streams: HTTP, WebSocket, complex async coordination
  • takeUntilDestroyed() in constructor/field initializer context — never manual subscribe/unsubscribe pairs. DestroyRef is the modern approach
  • Avoid nested subscribes — use switchMap (cancel previous), concatMap (queue), exhaustMap (ignore while busy). Pick based on the UX you want, not randomly
  • shareReplay({ bufferSize: 1, refCount: true }) for multicasted API responses — without refCount: true the subscription leaks
  • Handle errors with catchError inside the pipe, not in the subscribe callback — subscribe error handlers kill the observable

Read the full file on GitHub · 56 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 56 lines · 988 tokens per session scan A 26cca803bc2d

Subscribe to this mod's changes

angular is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 988 tokens to every session, about $0.0049 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.