Implement Command Query Responsibility Segregation
Cqrs implementation

Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.
--- name: cqrs-implementation description: Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems. --- # CQRS Implementation Comprehensive guide to implementing CQRS (Command Query Responsibility Segregation) patterns. ## When to Use This Skill - Separating read and write concerns - Scaling reads independently from writes - Building event-sourced systems - Optimizing complex query scenarios - Different read/write data models needed - High-performance reporting requirements
Overview
Comprehensive guide to implementing CQRS (Command Query Responsibility Segregation) patterns.
Manual install (npx, ZIP)
Claude Code
npx skills add wshobson/agents --skill cqrs-implementation -g -a claude-codeClaude Code (manual)
mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \
| tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/backend-development/skills/cqrs-implementationWindows (PowerShell)
New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/8ea043ab6c138d399afb/cqrs-implementation.zip" -OutFile "$env:TEMP\cqrs-implementation.zip"; Expand-Archive "$env:TEMP\cqrs-implementation.zip" -DestinationPath "$HOME\.claude\skills" -ForceClaude.ai / desktop
Codex, Cursor, other agents
Connects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md3.4 KBreferences/1 file · 12.4 KB
Read the files here
SKILL.md
Show the full text80 lines
CQRS Implementation
Comprehensive guide to implementing CQRS (Command Query Responsibility Segregation) patterns.
When to Use This Skill
- Separating read and write concerns
- Scaling reads independently from writes
- Building event-sourced systems
- Optimizing complex query scenarios
- Different read/write data models needed
- High-performance reporting requirements
Core Concepts
1. CQRS Architecture
┌─────────────┐
│ Client │
└──────┬──────┘
│
┌────────────┴────────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Commands │ │ Queries │
│ API │ │ API │
└──────┬──────┘ └──────┬──────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Command │ │ Query │
│ Handlers │ │ Handlers │
└──────┬──────┘ └──────┬──────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Write │─────────►│ Read │
│ Model │ Events │ Model │
└─────────────┘ └─────────────┘
2. Key Components
| Component | Responsibility |
|---|---|
| Command | Intent to change state |
| Command Handler | Validates and executes commands |
| Event | Record of state change |
| Query | Request for data |
| Query Handler | Retrieves data from read model |
| Projector | Updates read model from events |
Templates and detailed worked examples
Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.
Best Practices
Do's
- Separate command and query models - Different needs
- Use eventual consistency - Accept propagation delay
- Validate in command handlers - Before state change
- Denormalize read models - Optimize for queries
- Version your events - For schema evolution
Don'ts
- Don't query in commands - Use only for writes
- Don't couple read/write schemas - Independent evolution
- Don't over-engineer - Start simple
- Don't ignore consistency SLAs - Define acceptable lag
| 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 |
Details
- Updated
- Sep 21, 2026
- License
- MIT
- Stars on the repo
- ★ 39,857
- Checked
- Source
- wshobson/agents ↗
- Creator
- wshobson · 179 listings
Similar skills
See all →
SkillCreate branded architecture, architecture deltaDiagram design
SkillReview a PR against the Pascal architectural rulesReview architecture
SkillCreate and edit draw.io/diagrams.net diagramsDraw.io Architecture Studio
SkillCreate polished dark-themed architecture diagramsArchitecture Diagram Skill
SkillThe foundational knowledge distillation pattern for buildingLLM Wiki — Knowledge Distillation Pattern
SkillManage software complexity through deep modulesA Philosophy of Software Design FrameworkMore from wshobson
SkillMaster C/.NET backend development patterns for building
SkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliance
SkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Design
SkillMigrate from AngularJS to Angular using hybrid modeAngular migration
SkillUnderstand anti-reversing, obfuscationAnti reversing techniques
SkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patterns