Generated banner for Cqrs Implementation
Generated logo for Cqrs Implementation

Cqrs Implementation

Seth HobsonCommunityCreated by Seth Hobson

  • Skill
  • Guidelines
  • Software development
  • MIT
  • No issues found

From the author

Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.
— the description by Seth Hobson

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to implementing CQRS, an architectural pattern that separates read and write operations into distinct models. By decoupling these concerns, developers can optimize data access patterns, scale read and write workloads independently, and support complex event-sourced systems. The guide covers core architectural components, best practices for consistency and validation, and provides foundational code templates for command and query infrastructures.

What it does

  • Defines the separation of command and query models
  • Provides templates for command and query bus implementations
  • Outlines the roles of handlers, events, and projectors
  • Establishes best practices for eventual consistency
  • Offers guidance on schema evolution and versioning
  • Helps optimize complex query performance

When to use it

  • When you need to scale read and write operations independently
  • When building event-sourced systems
  • When read and write models require different data structures
  • When optimizing for high-performance reporting
  • When separating read and write concerns in complex domains

Advantages

  • Improved scalability for read-heavy workloads
  • Clearer separation of business logic and query logic
  • Flexibility to evolve read and write models independently
  • Optimized performance through denormalized read models
  • Robust support for event-driven state changes

Usage examples

“How do I structure a command handler for creating an order in a CQRS system?”
The agent provides a Python template demonstrating a CommandHandler that validates input, creates an aggregate, and persists events to an event store.
“What is the best way to handle queries in a CQRS architecture?”
The agent explains the use of a QueryBus and QueryHandlers, providing a template for defining query objects and returning structured view models.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/wshobson/cqrs-implementation/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip cqrs-implementation.zip -d .agents/skills

Documentation by Seth Hobson

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
ComponentResponsibility
CommandIntent to change state
Command HandlerValidates and executes commands
EventRecord of state change
QueryRequest for data
Query HandlerRetrieves data from read model
ProjectorUpdates 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

Files

SKILL.md

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
ComponentResponsibility
CommandIntent to change state
Command HandlerValidates and executes commands
EventRecord of state change
QueryRequest for data
Query HandlerRetrieves data from read model
ProjectorUpdates 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

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Seth Hobson
Publisher
Seth Hobson (Community)
Source
wshobson/agents · plugins/backend-development/skills/cqrs-implementation · commit 4bde316
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Seth Hobson or Seth Hobson.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cqrs-implementation.zip