Reactive Programming

Reactive Programming

Teaches a coding agent reactive programming with RxJS observables, streams, backpressure, debounced search and WebSocket reconnection for event-driven UIs.

Skill files9 files

references/

templates/

SKILL.md97 lines
1
---
2
name: reactive-programming
3
description: >
4
Implement reactive programming patterns using RxJS, streams, observables, and
5
backpressure handling. Use when building event-driven UIs, handling async data
6
streams, or managing complex data flows.
7
---
8
9
# Reactive Programming
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Build responsive applications using reactive streams and observables for handling asynchronous data flows.
22
23
## When to Use
24
25
- Complex async data flows
26
- Real-time data updates
27
- Event-driven architectures
28
- UI state management
29
- WebSocket/SSE handling
30
- Combining multiple data sources
31
32
## Quick Start
33
34
Minimal working example:
35
36
```typescript
37
import {
38
Observable,
39
Subject,
40
BehaviorSubject,
41
fromEvent,
42
interval,
43
} from "rxjs";
44
import {
45
map,
46
filter,
47
debounceTime,
48
distinctUntilChanged,
49
switchMap,
50
} from "rxjs/operators";
51
52
// Create observable from array
53
const numbers$ = new Observable<number>((subscriber) => {
54
subscriber.next(1);
55
subscriber.next(2);
56
subscriber.next(3);
57
subscriber.complete();
58
});
59
60
numbers$.subscribe({
61
next: (value) => console.log(value),
62
// ... (see reference guides for full implementation)
63
```
64
65
## Reference Guides
66
67
Detailed implementations in the `references/` directory:
68
69
| Guide | Contents |
70
|---|---|
71
| [RxJS Basics](references/rxjs-basics.md) | RxJS Basics |
72
| [Search with Debounce](references/search-with-debounce.md) | Search with Debounce |
73
| [State Management](references/state-management.md) | State Management |
74
| [WebSocket with Reconnection](references/websocket-with-reconnection.md) | WebSocket with Reconnection |
75
| [Combining Multiple Streams](references/combining-multiple-streams.md) | Combining Multiple Streams |
76
| [Backpressure Handling](references/backpressure-handling.md) | Backpressure Handling |
77
| [Custom Operators](references/custom-operators.md) | Custom Operators |
78
79
## Best Practices
80
81
### ✅ DO
82
83
- Unsubscribe to prevent memory leaks
84
- Use operators to transform data
85
- Handle errors properly
86
- Use shareReplay for expensive operations
87
- Combine streams when needed
88
- Test reactive code
89
90
### ❌ DON'T
91
92
- Subscribe multiple times to same observable
93
- Forget to unsubscribe
94
- Use nested subscriptions
95
- Ignore error handling
96
- Make observables stateful
97

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…