Skip to content
Back to skills

Angular Component Patterns

ASecurity

Standards for OnPush components and strict Signals usage. Use when applying OnPush change detection or implementing Signals in Angular components. (triggers: **/*.component.ts, **/*.component.html, ChangeDetectionStrategy, OnPush, Input, Output)

  • 43 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
developmentgoreactangularperformance

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ComeOnOliver/skillshub --skill angular-component-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Angular Component Patterns?

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

Security grade badge for Angular Component Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/comeonoliver-angular-component-patterns/badge)](https://www.skillsdirectory.com/skills/comeonoliver-angular-component-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-component-patterns
description: 'Standards for OnPush components and strict Signals usage. Use when applying OnPush change detection or implementing Signals in Angular components. (triggers: **/*.component.ts, **/*.component.html, ChangeDetectionStrategy, OnPush, Input, Output)'
---

# Angular Component Expert

## **Priority: P0 (CRITICAL)**

**You are an Angular Architect.** Enforce OnPush and Reactive patterns.

## Implementation Guidelines

- **Change Detection**: ALWAYS uses **ChangeDetectionStrategy.OnPush**. No exceptions. **Never use default change detection** — it re-checks every component on every event. Component only re-renders when **Signal inputs** change or Signals fire.
- **Inputs**: Use **signal() for mutable local state**, **input.required<T>()** or **input<T>()** **instead of @Input()**. Signal inputs are reactive — reference them as functions in templates: **{{ userId() }}**. Use **booleanAttribute** or **numberAttribute** transforms for primitive coercion.
- **State**: Use **Signals** for local state, **computed() for derived state**, and **effect() only for side effects**. Delegate shared state to a Signal Store or Service.
- **Smart/Dumb**: **Smart (Container)** (inject services, manage state) -> **Presentational (Dumb)** (inputs/outputs only, **no service dependencies**, **inputs and emit events via outputs**) split. This Separates data concerns from rendering and makes components testable.

## Verification Checklist (Mandatory)

- [ ] **OnPush**: Is `ChangeDetectionStrategy.OnPush` set?
- [ ] **Async Pipe**: Is `async` pipe used in template? (No `.subscribe()`).
- [ ] **Signals**: Are **computed()** signals used for derived values? (It **caches the result**).
- [ ] **Leaks**: **DestroyRef**, **toSignal()**, or **takeUntilDestroyed()** used?

## Anti-Patterns

- **No Default Change Detection**: Eats performance. OnPush only.
- **No Function Calls in Template**: **Never call functions in templates**: `{{ calculate() }}` -> use `computed()`.
- **No Manual Subscribe**: Use `async` pipe or `toSignal`. **Never call subscribe() in ngOnInit** without a cleanup strategy.

## References

- [Signals](references/signals.md)

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…