Cqrs Implementation skill for Claude
Implement Command Query Responsibility Segregation for scalable architectures.
When Claude uses it
Use when separating read and write models, optimizing query performance, or building event-sourced systems.
Cqrs Implementation SKILL.md
The full skill file from wshobson/agents (MIT).
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
How to install Cqrs Implementation
Claude Code
Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):
npx degit wshobson/agents/plugins/backend-development/skills/cqrs-implementation#main ~/.claude/skills/cqrs-implementationCodex
npx degit wshobson/agents/plugins/backend-development/skills/cqrs-implementation#main ~/.codex/skills/cqrs-implementationClaude.ai and Claude Desktop
Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.
Frequently asked questions
+What does the Cqrs Implementation skill do?
Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.
+How do I install Cqrs Implementation in Claude Code?
Copy the skill folder into ~/.claude/skills/cqrs-implementation, for example with "npx degit wshobson/agents/plugins/backend-development/skills/cqrs-implementation#main ~/.claude/skills/cqrs-implementation". Claude Code loads it automatically and uses it when a task matches.
+Does Cqrs Implementation work with ChatGPT or Codex?
Yes. Cqrs Implementation uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/cqrs-implementation. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.
+Is Cqrs Implementation free?
Cqrs Implementation is published on GitHub by wshobson under the MIT license, which allows free use.