Skip to content
Development
Skill

/cqrs-and-handlers

Implement CQRS in Symfony with separate Command and Query buses/handlers using the Messenger component

From plugin
superpowers-symfony
22744 skills14 agents13 commands1 hook

Claude Code

$ npx -y skills add dev-toolings/superpowers-symfony --skill cqrs-and-handlers --agent claude-code

SKILL.md

cqrs-and-handlers.SKILL.md
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`
Read more
@dev-toolings
Ships withsuperpowers-symfony

Superpowers Symfony gives coding agents deep, version-accurate Symfony expertise: from Doctrine schema design and API Platform REST/GraphQL APIs to test-driven development, async Messenger workflows, caching, rate limiting, and clean architecture.

22744 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
227
Star history of dev-toolings/superpowers-symfony on GitHub, a chart by star-history.com

Other skills on superpowers-symfony.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about cqrs-and-handlers.

Which coding agents can use cqrs-and-handlers?
cqrs-and-handlers installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.