Cqrs Design logo

Cqrs Design

Community
sethdford
cqrs-design

Separate command (write) and query (read) models for complex domains. Use when read/write patterns diverge significantly or when audit/consistency requirements demand immutability.

Overview

Publishersethdford
Repositoryclaude-skills
Skill namecqrs-design
Stars
48
Forks
9
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by sethdford on GitHub. Read the source before you install it.

Installation

Install the Cqrs Design AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/sethdford/claude-skills/tree/main/architect/system-design/skills/cqrs-design
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p .claude/skills
cp -r /tmp/claude-skills/architect/system-design/skills/cqrs-design .claude/skills/cqrs-design
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cqrs Design in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cqrs Design on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cqrs Design is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

CQRS Design

Implement Command Query Responsibility Segregation (CQRS) to align data models with actual usage patterns and enable independent scaling of reads and writes.

Context

You are designing or refactoring a system with complex read and write patterns. The user faces performance issues, audit requirements, or divergent read/write needs. Read their current data access patterns.

Domain Context

Based on Greg Young's CQRS work and Fowler's research:

  • Command Side: Optimized for writes; enforces business rules; maintains single source of truth
  • Query Side: Optimized for reads; denormalized for performance; eventual consistency acceptable
  • Event Sourcing: Often paired with CQRS; commands generate events, events drive queries
  • Read Models: Projections built from events; can be recreated from command side state
  • Consistency Boundary: Commands are strongly consistent within aggregate; queries lag slightly

Instructions

  1. Analyze Read vs Write: List all queries used; identify divergences from write model. Example: commands work with Orders (with line items), but queries need denormalized OrderSummary (customer name, total, status).

  2. Design Command Model: Optimize for consistency and rule enforcement. Aggregate should protect invariants. Example: Order aggregate ensures total ≥ sum of items.

  3. Design Read Models: For each query pattern, denormalize to minimize joins. Example: OrderSummary includes customer name (copied from command), total (calculated), status (current).

  4. Define Synchronization: How does read model stay updated? Options:

    • Event-Driven: Commands emit events; readers consume and project
    • Change Data Capture: Trigger-based updates from command database
    • Polling: Periodically sync from command to read schema
  5. Handle Eventual Consistency: Users must accept slight staleness. Define lag threshold (e.g., reads lag writes by max 2 seconds). Show stale data indicator if lag exceeds threshold.

Anti-Patterns

  • CQRS Without Event Sourcing: Creates two databases that drift out of sync. Result: questions about truth. Guard: Pair CQRS with event sourcing or CDC to keep models synchronized.
  • Premature CQRS: Added complexity without read/write divergence. Result: boilerplate with no benefit. Guard: Only apply CQRS when read and write models naturally differ.
  • Ignoring Consistency Window: Treats read model as synchronous. Result: users see stale data and complain. Guard: Define maximum staleness; make it visible in UI (e.g., "Last updated 2 seconds ago").
  • Over-Denormalization: Read model includes every possible field. Result: maintenance nightmare and slow projections. Guard: Design read models per query; allow multiple read models.

Further Reading

  • Exploring CQRS and Event Sourcing by Greg Young — foundational concepts
  • Microservices Patterns by Chris Richardson — CQRS in microservices context
  • Enterprise Integration Patterns — event-driven projections and synchronization

Frequently asked questions

What does the Cqrs Design AI skill do?

Separate command (write) and query (read) models for complex domains. Use when read/write patterns diverge significantly or when audit/consistency requirements demand immutability.

Why use Cqrs Design on TypingMind?

Because you install it once and use it with any model. Cqrs Design is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cqrs Design in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/sethdford/claude-skills/tree/main/architect/system-design/skills/cqrs-design. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Cqrs Design?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cqrs Design?

As many as you like. As long as a model supports skills, you can use Cqrs Design with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cqrs Design AI skill free?

Yes. It is published on GitHub by sethdford under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇