Skip to content
Back to skills

Cqrs And Handlers

ASecurity

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

  • 221 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added August 31, 2026
developmentrails

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 6, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Cqrs And Handlers?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cqrs And Handlers
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dev-toolings-cqrs-and-handlers/badge)](https://www.skillsdirectory.com/skills/dev-toolings-cqrs-and-handlers)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
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`

Files in this skill

  • SKILL.md1.1 KB
  • reference.md9.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…