Skip to content
Back to skills

Angular Patterns

ASecurity

Angular coding patterns — standalone components, signals, native control flow, inject()-based DI, forms, and accessibility. Use when writing or reviewing Angular components, services, directives, templates, or forms.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
ai-agentstypescriptgobashreactangularapidocumentation

Works with

  • cli
  • api
  • mcp

Security analysis

A92/100
  • mediumUses curl or wget to download content

Pro scans all 2 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add me-cedric/agent-compass --skill angular-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Angular Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Angular Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/me-cedric-angular-patterns/badge)](https://www.skillsdirectory.com/skills/me-cedric-angular-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: angular-patterns
description: Angular coding patterns — standalone components, signals, native control flow, inject()-based DI, forms, and accessibility. Use when writing or reviewing Angular components, services, directives, templates, or forms.
version: 1.0.0
filePattern: "**/*.component.ts,**/*.service.ts,**/*.directive.ts,**/*.pipe.ts,**/*.routes.ts,**/angular.json"
risk_level: low
writes_files: false
requires_tools: []
---

# Angular Patterns

Idiomatic modern Angular. Two sources, pick in this order:

1. **Live (preferred):** if the `angular-cli` MCP server is available
   (`templates/mcp/angular-cli.example.json`), call `get_best_practices` —
   it matches the workspace's installed Angular version — and
   `search_documentation` for API facts.
2. **Offline fallback:** [`best-practices.md`](best-practices.md), a vendored
   copy of Angular's official context file. It drifts as Angular releases;
   the provenance header says when it was fetched.

## Core rules (from the official guide)

- **Components**: standalone by default (never set `standalone: true` — it is
  the default since v20); small, single-responsibility; `input()`/`output()`
  functions over decorators; host bindings in the `host` object, not
  `@HostBinding`/`@HostListener`; inline templates for small components.
- **State**: signals for local state, `computed()` for derived state,
  `update()`/`set()` (never `mutate`); keep transformations pure.
- **Templates**: native control flow (`@if`/`@for`/`@switch`) — never
  `*ngIf`/`*ngFor`/`*ngSwitch`; `class`/`style` bindings — never
  `ngClass`/`ngStyle`; async pipe for observables; no complex logic in
  templates.
- **DI / services**: `inject()` over constructor injection; singletons via
  `providedIn: 'root'` (or the `@Service` decorator on v22+); one
  responsibility per service.
- **Forms**: Signal Forms (`@angular/forms/signals`) on v22+; otherwise
  Reactive Forms — not template-driven.
- **Routing**: lazy-load feature routes.
- **TypeScript**: strict mode; no `any` (use `unknown`); prefer inference
  when the type is obvious.
- **Accessibility**: must pass AXE checks and WCAG AA (focus management,
  contrast, ARIA).
- **Images**: `NgOptimizedImage` for all static images (not inline base64).

Version-gated rules (OnPush default, `@Service`, Signal Forms) apply only
when the workspace's Angular major supports them — check `package.json`
before enforcing.

## Validate

```bash
npx ng lint && npx ng test && npx ng build
```

## Related

- Stack preset: `stacks/angular-web.md` (MCP setup, official skills, WebMCP).
- Instinct: `knowledge/instincts/angular-ai-assets.md`.
- Refresh the vendored copy:
  `curl -sL https://angular.dev/assets/context/best-practices.md` and update
  the provenance header date.

Files in this skill

  • SKILL.md2.7 KB
  • best-practices.md2.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.