cqrs-event-sourcing

cqrs-event-sourcing is a skill for Claude Code, Codex from mattwynne/yaks. It costs 41 tokens per session (1,920 once invoked), scanned A, original, MIT.

A guide to CQRS and event sourcing, two ways to separate data updates from data reading and to store a history of changes. It explains when to use them together or separately.

In plain words
What is it for?
Use it when designing event-driven systems, choosing between event history and current-state storage, defining aggregate boundaries, or building read models. A read model is a data view prepared for a specific question or user.
Why use it?
It helps avoid choosing these patterns when they add needless complexity, and clarifies how to handle different reading needs, auditing, and past states.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when designing event-driven systems, choosing between event history and current-state storage, defining aggregate boundaries, or building read models. A read model is a data view prepared for a specific question or user.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mattwynne/yaks/cqrs-event-sourcing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mattwynne/yaks --skill cqrs-event-sourcing
Clone the repo
git clone --depth 1 https://github.com/mattwynne/yaks

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cqrs-event-sourcing

README.md
[![agentmods](https://agentmods.dev/badge/skills/mattwynne/yaks/cqrs-event-sourcing/github.svg)](https://agentmods.dev/skills/mattwynne/yaks/cqrs-event-sourcing)
Your own site
<a href="https://agentmods.dev/skills/mattwynne/yaks/cqrs-event-sourcing"><img src="https://agentmods.dev/badge/skills/mattwynne/yaks/cqrs-event-sourcing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cqrs-event-sourcing

Your own site · 80×15
<a href="https://agentmods.dev/skills/mattwynne/yaks/cqrs-event-sourcing"><img src="https://agentmods.dev/badge/skills/mattwynne/yaks/cqrs-event-sourcing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,920 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00041 $0.01920
Opus 5 $0.00020 $0.00960
Sonnet 5 $0.00008 $0.00384
Haiku 4.5 $0.00004 $0.00192

Measured 12d ago against content hash d3a48bb80d44, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

cqrs-event-sourcing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cqrs-event-sourcing/SKILL.md · 156 lines

How it starts

The opening of the file, as written. The whole thing — 156 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CQRS and Event Sourcing

Overview

CQRS (Command Query Responsibility Segregation): use a different model to update information than the model you use to read it. The write side enforces invariants; the read side answers questions. They are separate concerns with separate optimization needs.

Event Sourcing: store the sequence of events (immutable facts) rather than current state. Current state is derived by replaying events. Events are past-tense facts: TaskAdded, StateUpdated, ContextChanged.

These are complementary but separate patterns. You can use CQRS without Event Sourcing, and vice versa. Event Sourcing makes the write side append-only but makes querying impractical without read models -- hence the natural pairing.

When to Use (and When NOT To)

CQRS adds value when:

  • Read and write shapes differ significantly
  • Multiple read models serve different consumers
  • Read/write workloads have different scaling needs

Event Sourcing adds value when:

  • Event history has intrinsic business value (audit, temporal queries)
  • You need "what did this look like last Tuesday?"
  • New read models must be buildable from existing data retroactively

Warning signs of over-application (per Greg Young):

  • Event-sourcing simple CRUD with no complex invariants
  • Events are just FieldChanged { old, new } instead of meaningful domain events
  • Only one read model that mirrors the write model
  • Optimizing for problems you don't have

Greg Young: "The single biggest bad thing I've seen is building an entire system on Event Sourcing." Apply selectively, per bounded context.

Core Concepts

Commands, Events, Queries

Concept Direction Purpose Example
Command Intent to change Validated, may be rejected MarkTaskDone { name }
Event Fact that happened Immutable, append-only TaskCompleted { name, timestamp }
Query Request for data Never changes state ListActiveTasks

Read the full file on GitHub · 156 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 156 lines · 41 tokens per session scan A d3a48bb80d44

Subscribe to this mod's changes

cqrs-event-sourcing is a skill published in the GitHub repository mattwynne/yaks (58 stars, last pushed 1mo ago), licensed MIT. It adds 41 tokens to every session and 1,920 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

performant-laravel

Strategies for high-performance, scalable Laravel systems (Octane, DB Optimization, Redis, Microservices).

andreibesleaga/GABBE · 26 tokens

event-store-design

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

wshobson/agents · 33 tokens

cqrs-implementation

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

wshobson/agents · 35 tokens

azure-postgres-ts

Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg client", "node-postgres", "Azure PostgreSQL…

microsoft/skills · 94 tokens

spring-data-neo4j

Provides Spring Data Neo4j integration patterns for Spring Boot applications. Use when you need to work with a graph database, Neo4j nodes and relationships, Cypher queries, or Spring Data Neo4j. Creates node entities with @Node annotation, defines relationships with @Relationship, writes Cypher queries using @Query…

giuseppe-trisciuoglio/developer-kit · 94 tokens

clickhouse-js-node-coding

Write idiomatic application code with the ClickHouse Node.js client (@clickhouse/client). Use this skill whenever a user is building against the Node.js client — configuring the client, pinging, inserting rows in JSON or raw formats, selecting and parsing results, binding query parameters, managing sessions and…

ClickHouse/agent-skills · 89 tokens