Back to Skills

cqrs-architecture

verified

CQRS pattern implementation and query optimization

View on GitHub

Marketplace

melodic-software

melodic-software/claude-code-plugins

Plugin

event-modeling

Repository
Verified Org

melodic-software/claude-code-plugins
13stars

plugins/event-modeling/skills/cqrs-architecture/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/melodic-software/claude-code-plugins/blob/main/plugins/event-modeling/skills/cqrs-architecture/SKILL.md -a claude-code --skill cqrs-architecture

Installation paths:

Claude
.claude/skills/cqrs-architecture/
Powered by add-skill CLI

Instructions

# CQRS Architecture Skill

Design and implement Command Query Responsibility Segregation patterns for scalable systems.

## MANDATORY: Documentation-First Approach

Before implementing CQRS:

1. **Invoke `docs-management` skill** for CQRS patterns
2. **Verify patterns** via MCP servers (perplexity, context7)
3. **Base guidance on established CQRS literature**

## CQRS Fundamentals

```text
Traditional vs CQRS:

TRADITIONAL (Single Model):
┌─────────────────────────────────┐
│         Application            │
├─────────────────────────────────┤
│      Domain Model              │
│  (Reads + Writes)              │
├─────────────────────────────────┤
│         Database               │
└─────────────────────────────────┘

CQRS (Separated Models):
┌───────────────┐    ┌───────────────┐
│ Command Side  │    │  Query Side   │
│ (Write Model) │    │ (Read Model)  │
├───────────────┤    ├───────────────┤
│ Domain Logic  │    │ DTO/Views     │
│ Aggregates    │    │ Projections   │
├───────────────┤    ├───────────────┤
│ Write DB      │───►│ Read DB       │
└───────────────┘    └───────────────┘
```

## CQRS Levels

### Level 1: Logical Separation

```text
Same database, separate code paths:

┌─────────────────────────────────────┐
│           Application               │
├──────────────────┬──────────────────┤
│ Command Handlers │ Query Handlers   │
│ - Validation     │ - Direct SQL     │
│ - Domain Logic   │ - Projections    │
│ - Events         │ - DTOs           │
├──────────────────┴──────────────────┤
│           Single Database           │
└─────────────────────────────────────┘

Benefits:
✓ Clean separation in code
✓ Simple deployment
✓ Single source of truth
✓ Good starting point
```

### Level 2: Separate Read Models

```text
Same write DB, separate read DB:

┌─────────────────┐    ┌─────────────────┐
│ Command Side    │    │  Query Side     │
├─────────────────┤    ├─────────────────┤
│ Command Handler │    │ Query Handler   │
│ Domain Model    │    │ DTOs         

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
10345 chars