angular-rxjs-patterns
БесплатноБез исполняемых скриптовНе проверенUse when handling async operations in Angular applications with observables, operators, and subjects.
от TheBushidoCollective★ 202 звезды на GitHubОб этом скилле
Angular RxJS Patterns
Master RxJS in Angular for handling async operations, data streams, and reactive programming patterns.
Observable Creation
Basic Observable Creation
import { Observable, of, from, interval, fromEvent } from 'rxjs';
// of - emit values in sequence
const numbers$ = of(1, 2, 3, 4, 5);
// from - convert array, promise, or iterable
const fromArray$ = from([1, 2, 3]);
const fromPromise$ = from(fetch('/api/data'));
// interval - emit numbers at intervals
const timer$ = interval(1000); // Every second
// fromEvent - DOM events
const clicks$ = fromEvent(document, 'click');
// Custom observable
const custom$ = new Observable(subscriber => {
subscriber.next(1);
subscriber.next(2);
subscriber.complete();
});
HttpClient Observables
import { HttpClient } from '@angular/common/http';
import { Injectable, inject } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class DataService {
private readonly http = inject(HttpClient);
getData(): Observable<Data[]> {
return this.http.get<Data[]>('/api/data');
}
getItem(id: string): Observable<Data> {
return this.http.get<Data>(`/api/data/${id}`);
}
createItem(data: Data): Observable<Data> {
return this.http.post<Data>('/api/data', data);
}
updateItem(id: string, data: Data): Observable<Data> {
return this.http.put<Data>(`/api/data/${id}`, data);
}
deleteItem(id: string): Observable<void> {
return this.http.delete<void>(`/api/data/${id}`);
}
}
Common Operators
Transformation Operators
import { map, pluck, switchMap, mergeMap, concatMap } from 'rxjs/operators';
import { of } from 'rxjs';
// map - transform values
const numbers$ = of(1, 2, 3).pipe(
map(n => n * 2) // 2, 4, 6
);
// pluck - extract property (deprecated, use map)
const users$ = of(
{ name: 'John', age: 30 },
{ name: 'Jane', age: 25 }
).pipe(
map(user => user.name) // 'John', 'Jane'
);
// switchMap - cancel previous, emit new
searchControl.valueChanges.pipe(
switchMap(term => this.searchService.search(term))
).subscribe(results => {
this.results = results;
});
// mergeMap - run in parallel
const ids$ = of(1, 2, 3);
ids$.pipe(
mergeMap(id => this.getUser(id)) // All requests in parallel
).subscribe();
// concatMap - run in sequence
ids$.pipe(
concatMap(id => this.getUser(id)) // One at a time
).subscribe();
Filtering Operators
import { filter, take, takeUntil, takeWhile, distinctUntilChanged } from 'rxjs/operators';
// filter - only emit matching values
of(1, 2, 3, 4, 5).pipe(
filter(n => n % 2 === 0) // 2, 4
);
// take - first N values
interval(1000).pipe(
take(5) // First 5 emissions
);
// takeUntil - until another observable emits
const destroy$ = new Subject();
source$.pipe(
takeUntil(destroy$)
).subscribe();
// distinctUntilChanged - skip duplicate consecutive values
of(1, 1, 2, 2, 3, 3).pipe(
distinctUntilChanged() // 1, 2, 3
);
Combination Operators
import { combineLatest, merge, concat, forkJoin, zip } from 'rxjs';
import { startWith } from 'rxjs/operators';
// combineLatest - emit when any source emits
combineLatest([
this.user$,
this.settings$
]).pipe(
map(([user, settings]) => ({ user, settings }))
).subscribe();
// merge - emit from any source
merge(
this.clicks$,
this.hovers$
).subscribe();
// concat - emit in sequence
concat(
this.loadUser$,
this.loadSettings$
).subscribe();
// forkJoin - wait for all to complete
forkJoin({
user: this.getUser(),
posts: this.getPosts(),
comments: this.getComments()
}).subscribe(({ user, posts, comments }) => {
// All complete
});
// zip - pair values from sources
zip(
of(1, 2, 3),
of('a', 'b', 'c')
).pipe(
map(([num, letter]) => `${num}${letter}`)
); // '1a', '2b', '3c'
Utility Operators
import { tap, delay, debounceTime, throttleTime, distinctUntilChanged } from 'rxjs/operators';
// tap - side effects (logging, etc.)
source$.pipe(
tap(value => console.log('Value:', value)),
map(value => value * 2)
);
// delay - delay emissions
of(1, 2, 3).pipe(
delay(1000) // Delay 1 second
);
// debounceTime - wait for pause in emissions
searchControl.valueChanges.pipe(
debounceTime(300) // Wait 300ms after user stops typing
);
// throttleTime - emit first value, ignore for duration
clicks$.pipe(
throttleTime(1000) // Only once per second
);
// distinctUntilChanged - skip duplicates
input$.pipe(
distinctUntilChanged() // Only when value changes
);
Error Handling
catchError - Handle Errors
import { catchError } from 'rxjs/operators';
import { of, EMPTY, throwError } from 'rxjs';
// Return fallback value
this.http.get('/api/data').pipe(
catchError(error => {
console.error('Error:', error);
return of([]); // Return empty array
})
);
// Return empty observable
source$.pipe(
catchError(() => EM
Установить angular-rxjs-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadFAQ
Что делает скилл angular-rxjs-patterns?
Use when handling async operations in Angular applications with observables, operators, and subjects.
Как установить скилл angular-rxjs-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл angular-rxjs-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic