跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

cqrs-event-sourcing-designer

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

codebygarv · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add codebygarv/Ai-skills --skill cqrs-event-sourcing-designer

技能说明


name: cqrs-event-sourcing-designer description: Designs Command Query Responsibility Segregation (CQRS) and Event Sourcing models with projection rebuilders.

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.