State Management

SkillAI & models

Implement application state with Angular Signals, computed derivations, and NgRx Signal Store. Use when implementing reactive state with signal(), computed(), effect(), or @ngrx/signals in Angular.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the State Management skill

What this skill tells your AI

The instructions your AI receives, as published by hoangnguyen0403/agent-skills-standard in skills/angular/angular-state-management/SKILL.md and read by ahel’s review.

Priority: P1 (HIGH)

1. Use Signals for All State

  • Keep internal signals private; expose publicly via asReadonly().

See signal store pattern for signal-based service and store examples.

2. Derive State with computed()

  • Use computed() for totals, filtered lists, derived values — pure and cached.
  • Use linkedSignal(() => source()) for dependent writable state that resets when source changes.
  • Use untracked() to read signal inside computed()/effect() without creating dependency.

3. Scale with Signal Store

  • For complex features, use @ngrx/signals (signalStore) with withState, withComputed, withMethods, and withEntities().

4. Handle Side Effects

  • Use effect() only for side effects (logging, localStorage sync, DOM manipulation).
  • Never update signals inside effect() — causes circular dependencies.
  • Treat signal values as immutable — update with .set() or .update(v => ...).

Anti-Patterns

  • No state logic in components: Delegate to Signal Store or Service.
  • No BehaviorSubject for state: Use Signals; keep RxJS only for complex event streams.

References

Canonical response anchors

When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:

  • Never update signals inside effect()
  • resets when source changes

Signals

GitHub stars
565
Forks
163
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
angular-state-management-hoangnguyen0403
Source
github.com/hoangnguyen0403/agent-skills-standard