Skill files2 files

references/

SKILL.md80 lines
1
---
2
name: cqrs-implementation
3
description: Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.
4
---
5
6
# CQRS Implementation
7
8
Comprehensive guide to implementing CQRS (Command Query Responsibility Segregation) patterns.
9
10
## When to Use This Skill
11
12
- Separating read and write concerns
13
- Scaling reads independently from writes
14
- Building event-sourced systems
15
- Optimizing complex query scenarios
16
- Different read/write data models needed
17
- High-performance reporting requirements
18
19
## Core Concepts
20
21
### 1. CQRS Architecture
22
23
```
24
┌─────────────┐
25
│ Client │
26
└──────┬──────┘
27
│
28
┌────────────┴────────────┐
29
│ │
30
▼ ▼
31
┌─────────────┐ ┌─────────────┐
32
│ Commands │ │ Queries │
33
│ API │ │ API │
34
└──────┬──────┘ └──────┬──────┘
35
│ │
36
▼ ▼
37
┌─────────────┐ ┌─────────────┐
38
│ Command │ │ Query │
39
│ Handlers │ │ Handlers │
40
└──────┬──────┘ └──────┬──────┘
41
│ │
42
▼ ▼
43
┌─────────────┐ ┌─────────────┐
44
│ Write │─────────►│ Read │
45
│ Model │ Events │ Model │
46
└─────────────┘ └─────────────┘
47
```
48
49
### 2. Key Components
50
51
| Component | Responsibility |
52
| ------------------- | ------------------------------- |
53
| **Command** | Intent to change state |
54
| **Command Handler** | Validates and executes commands |
55
| **Event** | Record of state change |
56
| **Query** | Request for data |
57
| **Query Handler** | Retrieves data from read model |
58
| **Projector** | Updates read model from events |
59
60
## Templates and detailed worked examples
61
62
Full template library and detailed worked examples live in `references/details.md`. Read that file when you need the concrete templates.
63
64
## Best Practices
65
66
### Do's
67
68
- **Separate command and query models** - Different needs
69
- **Use eventual consistency** - Accept propagation delay
70
- **Validate in command handlers** - Before state change
71
- **Denormalize read models** - Optimize for queries
72
- **Version your events** - For schema evolution
73
74
### Don'ts
75
76
- **Don't query in commands** - Use only for writes
77
- **Don't couple read/write schemas** - Independent evolution
78
- **Don't over-engineer** - Start simple
79
- **Don't ignore consistency SLAs** - Define acceptable lag
80

© Seth Hobson · 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…