Skills · Coding

Cqrs Implementation

Unverified30/40

Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
CursorPartialPlain prose you can paste in — but no Cursor rules file
CodexPartialPlain prose you can paste in — but no AGENTS.md
Gemini CLIPartialPlain prose you can paste in
CopilotPartialPlain prose you can paste in — but no Copilot instructions file
npx agentalley add cqrs-implementation

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.

The whole source

No sign-in, no blur, nothing truncated
cqrs-implementation/SKILL.md80 lines3.4 KBRawView on GitHub
Frontmatter — 2 properties
namecqrs-implementation
descriptionImplement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.
1---
2name: cqrs-implementation
3description: Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.
4---A5No allowed-tools declared — no way to tell what this skill may touch
5 
6# CQRS Implementation
7 
8Comprehensive 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 
62Full 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 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Coding