angular-best-practices

A set of Angular development rules covering modern syntax, routing, components, inputs and outputs, side panels, and state management. Angular is a framework for building web applications.

In plain words
What is it for?
Use it when building or reviewing Angular applications, especially routed views, lazy-loaded features, and route-controlled side panels.
Why use it?
It gives Angular projects consistent patterns for navigation, reusable components, and reactive data updates.

Cursor rule for Cursor

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/jrpribs/smarterstarter/angular-best-practices
Clone the repo
git clone --depth 1 https://github.com/JrPribs/SmarterStarter

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 562 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.00562
Opus 5 $0.00000 $0.00281
Sonnet 5 $0.00000 $0.00112
Haiku 4.5 $0.00000 $0.00056

Measured 2d ago against content hash 1bdd43041547, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

angular-best-practices 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 2d ago.

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.

.cursor/rules/angular-best-practices.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 Best Practices

General Guidelines

  • Always use Angular's latest syntax.
  • Use signals and signal-based input() and output() functions & control flow syntax.
  • Always separate component ts, view, & style code into their own files.

Routing Best Practices

  • Always use Angular router when navigating between views or showing/hiding significant UI elements.
  • Use named router outlets for side panels, dialogs, and other overlay components that need route-based control.
  • Lazy load routes files and components that aren't needed immediately on load of the app.
  • Use functional resolvers and component input binding in routed components.

Component Input/Output Patterns

  • Use signal inputs (input()) and model signals (model()) for component inputs.
  • Prefer explicit input declarations over object-based data passing.
  • For inputs that can change, use signal inputs to ensure reactivity.
  • Use outputs that emit specific data types rather than generic events when possible.

Side Panel Implementation

  • Use named router outlets (like 'side-panel') for all side panel components.
  • Create a standardized side panel layout with consistent animations and structure.
  • Side panels should be self-contained components that get their data from resolvers.
  • Use a single "close" mechanism that uses router navigation to close the panel.

State Management

  • Use a one-way data flow pattern as outlined in state-architecture.data-flow.md.
  • Use resolvers to fetch data for components rather than fetching data directly in components.
  • Prefer passing resolved data to components over components fetching their own data.

Resolver Pattern

  • Create focused resolvers that handle a single responsibility.
  • Use resolvers to prefetch data before component initialization.
  • Return null/empty data rather than throwing errors when data is unavailable.
  • Handle error states in resolvers, not in components.

Lazy Loading

  • Lazy load large components or feature modules that aren't needed immediately.
  • Use the loadComponent/loadChildren pattern in routes.
  • Apply preloading strategies for important but not immediately needed routes.

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. 2d ago First seen · 56 lines · 562 tokens per session scan A 1bdd43041547

Subscribe to this mod's changes

angular-best-practices is a cursor rule published in the GitHub repository JrPribs/SmarterStarter (2 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 562 tokens. 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-31.