cqrs-and-handlers — Claude Code skill: what it does, how to install
cqrs-and-handlers implements CQRS in Symfony projects using separate Messenger buses for commands and queries.
MIT ★ 234 updated 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill cqrs-and-handlers -a claude-codeWhat cqrs-and-handlers does
This skill guides Claude Code through setting up a CQRS structure with the Symfony Messenger component. It enforces isolated paths for writes and reads, requiring messages to be readonly classes handled by a single dedicated handler.
The command bus configuration includes validation and doctrine_transaction middleware to keep state changes atomic and valid. Commands return either nothing or just the created identifier. In contrast, queries must remain free of side effects, which allows caching and safe retries.
Along with messages and bus configuration, the workflow expects unit tests for each handler and a functional test running through the controller.
What it helps with
- split reads and writes into dedicated Messenger buses in Symfony
- generate readonly commands and single-purpose handlers
- configure transactional middleware for state changes
- create handler unit tests and controller functional tests
Example prompts for the agent
- Create a command and handler for registering a new user with validation middleware
- Design a query bus flow to fetch account settings without side effects
- Configure separate command and query buses in messenger.yaml
How to install cqrs-and-handlers
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill cqrs-and-handlers -a claude-code2Manually: put the files in place
~/.claude/skills/cqrs-and-handlers/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cqrs-and-handlers/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill cqrs-and-handlers -a codex2Manually: put the files in place
.agents/skills/cqrs-and-handlers/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill cqrs-and-handlers -a cursor2Manually: put the files in place
.cursor/skills/cqrs-and-handlers/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/cqrs-and-handlers2Manually: put the files in place
.github/skills/cqrs-and-handlers/SKILL.md1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill cqrs-and-handlers -a gemini-cli2Platform CLI
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/cqrs-and-handlersManually: put the files in place
.devin/skills/cqrs-and-handlers/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about cqrs-and-handlers
How to install cqrs-and-handlers in Claude Code?
Run npx skills add dev-toolings/superpowers-symfony --skill cqrs-and-handlers -a claude-code in your terminal.
What does cqrs-and-handlers do?
It provides architecture rules and templates for building CQRS workflows in Symfony with separate message buses and test suites.
What are the rules for handlers in this skill?
Each message must have exactly one handler. Handlers are forbidden from dispatching back into their own bus, and commands cannot return arbitrary data beyond a generated ID.
Source text
SKILL.md · MIT
--- name: cqrs-and-handlers description: Implement CQRS in Symfony with separate Command and Query buses/handlers using the Messenger component capabilities: [read, search] tags: [architecture, messenger] # projected by `bun run build` — do not edit by hand allowed-tools: - Read - Glob - Grep --- # Cqrs And Handlers (Symfony) ## Use when - Separating writes from reads with distinct command and query buses. - A service both changes state and returns data for display. - Adding a use case as a command or a query with its own handler. ## Default workflow 1. Name the use case: a command changes state, a query returns data. 2. Write the message as a readonly class and exactly one handler for it. 3. Configure separate command and query buses; give the command bus the `validation` and `doctrine_transaction` middleware. 4. Inject the buses behind small interfaces, or the native buses with `#[Target]`. 5. Dispatch from a thin controller and return the query result or the new id. ## Guardrails - Commands return nothing, or at most the id they created. - Queries have no side effects, so they can be cached and retried. - One handler per message; no handler dispatches back onto the bus it serves. - Read models for complex queries are optional: add them when a query outgrows the entities. ## Progressive disclosure - Use this file for execution posture and risk controls. - Open references when deep implementation details are needed. ## Output contract - Commands, queries and their handlers. - The bus configuration and its middleware. - Handler tests, and a functional test through the controller. ## References - `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony