cqrs-implementation — Claude Code skill: what it does, how to install
This skill guides you through separating command and query handling and using distinct write and read models. Use it when implementing CQRS or an event-sourced system.
/plugin marketplace add wshobson/agents
/plugin install backend-development@claude-code-workflowsWhat cqrs-implementation does
The skill outlines a CQRS flow: commands change state through handlers, while queries retrieve data from a read model. Events record changes, and a projector uses them to update that model. The write and read models can evolve independently.
It covers command validation, denormalized read models, event versioning, and acceptable propagation delay. Concrete templates and worked examples are in references/details.md.
Use it when your project needs separate read and write models or reporting with specific performance requirements. If a shared model is enough, start there; the guide cautions against over-engineering.
What it helps with
- separate write and read models
- scale reads independently from writes
- update a read model from events
- set an acceptable consistency delay
Example prompts for the agent
- Separate command and query handling in this project using CQRS.
- Show how events can update this project's read model.
- Open `references/details.md` and choose a CQRS template for reporting.
How to install cqrs-implementation
1Plugin marketplace
/plugin marketplace add wshobson/agents/plugin install backend-development@claude-code-workflowsThis installs the whole backend-development plugin with all its skills
2Skills CLI (Vercel)
npx skills add wshobson/agents --skill cqrs-implementation -a claude-code3Manually: put the files in place
~/.claude/skills/cqrs-implementation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cqrs-implementation/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill cqrs-implementation -a codex2Manually: put the files in place
.agents/skills/cqrs-implementation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill cqrs-implementation -a cursor2Manually: put the files in place
.cursor/skills/cqrs-implementation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshobson/agents cqrs-implementation2Manually: put the files in place
.github/skills/cqrs-implementation/SKILL.mdPlatform CLI
gemini skills install https://github.com/wshobson/agents --path plugins/backend-development/skills/cqrs-implementationManually: put the files in place
.devin/skills/cqrs-implementation/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set213
The whole set →Similar
Questions about cqrs-implementation
How do I install cqrs-implementation in Claude Code?
Run npx skills add wshobson/agents --skill cqrs-implementation -a claude-code.
What does cqrs-implementation do?
It explains how to separate commands from queries, structure their handlers, and update a read model from events.
What consistency issue should I consider with CQRS?
Read models may update after a propagation delay. The skill recommends defining an acceptable lag and versioning events.
Source text
SKILL.md · MIT
---
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
## 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
© Seth Hobson · MIT · wshobson/agents