angular-signals

Implement reactive state management in Angular using signal, computed, linkedSignal, and effect APIs.

Updated Aug 10, 2025
One-click install
npx skills add https://github.com/afonsoft/ai-studio-workspace --skill angular-signals-afonsoft
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: angular-signals
Source: https://github.com/afonsoft/ai-studio-workspace/tree/main/agents/skills/angular-signals
Command: npx skills add https://github.com/afonsoft/ai-studio-workspace --skill angular-signals-afonsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Managing reactive state in Angular applications often involves verbose RxJS Observable and BehaviorSubject boilerplate. This Skill provides patterns for Angular v20+ signal-based reactivity, covering writable state, derived state, side effects, and RxJS interoperability. ## Core Features & Use Cases - Core Signal APIs: Create writable state with signal(), derived state with computed(), resettable dependent state with linkedSignal(), and side effects with effect(). - RxJS Interop: Convert Observables to signals with toSignal() and signals back to Observables with toObservable() for debounced search and HTTP flows. - Advanced Patterns: The references file covers the resource() API for async data fetching, signal store patterns, form state, optimistic updates, and testing signals. - Use Case: Migrate a component from BehaviorSubject-based state to signals, building a todo list with filtered derived state and a service exposing read-only signals. ## Quick Start Refactor my Angular component to use signals instead of BehaviorSubjects for its state and derived values.

Frequently Asked Questions about angular-signals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create reactive state in Angular with signals?▼

Create writable state with signal(initialValue), read it by calling the signal as a function, and update it with set() or update(). Derive dependent values with computed(), which automatically recalculates when its dependencies change.

How to convert RxJS Observables to Angular signals?▼

Use toSignal() from @angular/core/rxjs-interop to convert an Observable into a signal, optionally passing initialValue or requireSync for synchronous sources like BehaviorSubject. Use toObservable() to go the other direction and apply RxJS operators like debounceTime.

What is the difference between computed and linkedSignal in Angular?▼

computed() creates read-only derived state that recalculates from its dependencies. linkedSignal() creates writable state that automatically resets when its source changes, with access to the previous value for preserving selections.

Does Angular signals work with HTTP requests and async data?▼

Yes, the resource() API fetches async data reactively by re-running its loader whenever params signals change, exposing value, isLoading, error, and status signals. Alternatively, combine toObservable with switchMap and convert back with toSignal.

When should I use signals instead of BehaviorSubject in Angular?▼

Signals fit synchronous, fine-grained component and service state without subscription management or async pipe boilerplate. Keep RxJS for event streams requiring operators like debounce, retry, or complex composition, bridging the two with the interop functions.

How do I test Angular components and stores that use signals?▼

Test signals by calling them as functions to assert current values, then updating with set() and re-asserting. For services using HttpClient, use provideHttpClientTesting with HttpTestingController and set the private state signal directly to test selectors.