web-utilities-rxjs
RxJS Reactive Programming Patterns
Quick Guide: Use RxJS for complex async flows involving event streams, composed async operations, and reactive data pipelines. Create Observables with
of,from,fromEvent, ordefer. Transform with pipeable operators (map,filter,switchMap). Always unsubscribe to prevent memory leaks -- use thetakeUntilpattern with a destroy Subject, or store subscriptions and callunsubscribe()in cleanup. Suffix observable variables with$. Choose the right flattening operator:switchMapto cancel previous,mergeMapfor parallel,concatMapfor sequential,exhaustMapto ignore while busy.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST unsubscribe from every long-lived Observable -- use takeUntil, take, first, or explicit unsubscribe() to prevent memory leaks)
(You MUST choose the correct flattening operator -- switchMap for cancellation, mergeMap for parallel, concatMap for sequential, exhaustMap to ignore while busy)
(You MUST place takeUntil LAST in the pipe chain -- placing it before higher-order operators like switchMap leaves inner subscriptions alive)
(You MUST handle errors with catchError inside the pipe -- an unhandled error terminates the entire Observable chain permanently)