rxjs-patterns

Codify RxJS patterns and best practices for Angular applications.

56|18|Updated Apr 26, 2022
One-click install
npx skills add https://github.com/nuclia/frontend --skill rxjs-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rxjs-patterns
Source: https://github.com/nuclia/frontend/tree/main/.claude/skills/rxjs-patterns
Command: npx skills add https://github.com/nuclia/frontend --skill rxjs-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write robust, maintainable RxJS code within Angular applications by codifying established patterns and best practices used in the Nuclia frontend monorepo.

Core Features & Use Cases

  • Operator Selection: Guides decisions on flattening (switchMap, concatMap, mergeMap) and combination (combineLatest, forkJoin, withLatestFrom) operators.
  • State Management: Details correct usage of Subject, BehaviorSubject, and ReplaySubject for managing observable state.
  • Error Handling & Cleanup: Enforces proper catchError placement and modern cleanup strategies like takeUntilDestroyed().
  • Use Case: When implementing a new feature that involves fetching data based on user input, this Skill provides clear guidance on choosing the right operators to handle asynchronous operations efficiently and prevent common pitfalls like memory leaks or silent failures.

Quick Start

Use the rxjs-patterns skill to understand how to correctly implement a search input that cancels previous requests.

Frequently Asked Questions about rxjs-patterns

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

FAQPage Schema
How do I choose between switchMap, concatMap, and mergeMap for Angular observables?

Choosing between flattening operators like switchMap, concatMap, and mergeMap depends on whether your Angular observable pipeline needs to cancel, queue, or run concurrent requests. This Skill guides operator selection to handle asynchronous operations efficiently.

What is the best way to manage state with Subject and BehaviorSubject in Angular?

Managing state with Subject and BehaviorSubject in Angular requires selecting the correct type for your observable streams. This Skill details correct usage patterns for Subject, BehaviorSubject, and ReplaySubject to maintain robust service state.

How do I handle errors and cleanup subscriptions in RxJS without causing memory leaks?

Handling errors and cleanup in RxJS without memory leaks requires proper catchError placement and modern strategies like takeUntilDestroyed(). This Skill enforces cleanup mechanisms and error handling to prevent silent failures in observable pipelines.

Does this RxJS pattern guidance cover using Angular signals with observables?

Yes, this RxJS pattern guidance covers Angular signal interop. It provides best practices for integrating Angular signals within observable pipelines and service state streams alongside import hygiene conventions.