event-sourcing-cqrs

Guides design of CQRS commands, event-sourced aggregates, appliers, projections, and event schema migrations.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/vnovakovits/claude-skills --skill event-sourcing-cqrs-vnovakovits
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: event-sourcing-cqrs
Source: https://github.com/vnovakovits/claude-skills/tree/main/plugins/engineering-practices/skills/event-sourcing-cqrs
Command: npx skills add https://github.com/vnovakovits/claude-skills --skill event-sourcing-cqrs-vnovakovits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Event Sourcing and CQRS systems fail in predictable ways: bloated write-side state, impure appliers that break replay, events that lose business intent, and enum ordinals that silently corrupt stored streams. This Skill encodes the design heuristics from Greg Young, Alexey Zimarev, and Microsoft's Azure Architecture patterns so those mistakes are caught at design time. ## Core Features & Use Cases - Write-side design: Command naming in imperative tense, application service Load-Execute-Save orchestration, minimal IHoldState interfaces, and focused state slices per command handler. - Event and aggregate design: Past-tense intent-capturing events, Apply vs Load aggregate modes, EnsureValidState invariants, optimistic concurrency via stream versions, and reversal transactions instead of deletes. - Schema evolution and projections: Greg Young's migration ladder (weak schema, upcasting, double publish, copy-replace, copy-transform, versioning bankruptcy), safe enum encoding on the wire, and rebuildable idempotent projections with checkpointing. - Use Case: When reviewing an applier that calls DateTime.Now or deciding whether ProductName belongs in write-side state or the event payload, this Skill gives the correct rule and a code example. ## Quick Start Ask Claude to review your event-sourced aggregate, command handler, or event schema migration plan against CQRS and Event Sourcing principles.

Frequently Asked Questions about event-sourcing-cqrs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design write-side state in event sourcing?▼

Write-side state should contain only fields a command handler needs to enforce invariants. Ask whether a handler would fail or emit incorrect events without the field; if not, move it to a read model. Use multiple focused IHoldState interfaces per handler rather than one large state blob.

What is the difference between a command and an event in CQRS?▼

Commands are imperative-tense requests that can be rejected, like RelocateCustomer. Events are past-tense facts that already happened and cannot be rejected, like CustomerRelocated. Commands carry only the data the operation needs; events capture business intent, not just state changes.

How do I version or migrate event schemas in an event store?▼

Use the cheapest rung of Greg Young's migration ladder: weak schema with tolerant readers first, then upcasting old events during deserialization, then double publish. Disk rewrites like copy-replace or copy-transform are last resorts. A new event version must be convertible from the old version.

Why should enums not be persisted as ordinals in event streams?▼

Ordinal encoding writes a meaningless integer whose interpretation depends on the enum's declaration order, so renumbering silently rewrites every stored event's meaning. Persist by name, or use explicit numbered schemas with reserved ranges and CI enforcement like Protobuf and buf breaking.

When should I not use CQRS and event sourcing?▼

Avoid CQRS for simple domains or CRUD-heavy bounded contexts, since it adds risky complexity per Martin Fowler. Apply it only to specific bounded contexts with genuine domain complexity or where reads and writes must scale independently, never across an entire system.

How do projections stay consistent with the event stream?▼

Projections subscribe to the event stream, persist a checkpoint after each event, and resume from that position on restart. Handlers must be idempotent because delivery is at-least-once, and any read model can be dropped and rebuilt by replaying from position zero.