agentleFS
codebygarvcodebygarv/Ai-skills/skills/architecture/cqrs-event-sourcing-designer/SKILL.md

cqrs-event-sourcing-designer

Skill26 starsChanged 4 months agoMITView on GitHub

Designs Command Query Responsibility Segregation (CQRS) and Event Sourcing models with projection rebuilders.

The file

Files
SKILL.md

Purpose

Architect Command Query Responsibility Segregation (CQRS) and Event Sourcing (ES) systems, separating write-side domain command handling from read-side materialized view projections with full auditability.

When to Use

  • High-compliance domains requiring immutable audit logs (Fintech, Healthcare, Legal, Supply Chain).
  • Systems with asymmetric read/write ratios and complex reporting queries.
  • Designing collaborative workspaces with branch/merge or time-travel history.

What to Analyze

  1. Command vs Query Separation: Command handlers (validate and emit events) vs Query handlers (read denormalized projections).
  2. Event Store Architecture: Append-only immutable log (aggregate_id, version, event_type, payload) with optimistic concurrency control.
  3. Projection & Read Model Synchronization: Asynchronous event handlers building denormalized views in Postgres/Elastic/Redis.
  4. Snapshotting Strategy: Periodic aggregate state snapshots to prevent slow replays on aggregates with 10,000+ events.
  5. Rebuilding & Migration: Ability to replay event streams from scratch to generate new projection tables.

Output Format

  • CQRS / ES Architecture Blueprint: Command, Event Store, Projection, and Query read path diagram.
  • Event Store DDL & Aggregate Class: Append-only schema with version-checking optimistic locks.
  • Projection Worker Code: Consumer updating materialized read models.

Avoid

  • Applying CQRS and Event Sourcing to simple CRUD applications (unnecessary operational complexity).
  • Mutating historical events in the event store.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.