← 返回
未分类 中文

Nm Archetypes Architecture Paradigm Cqrs Es

Applies CQRS and Event Sourcing for read/write separation and audit trails
采用CQRS和事件溯源实现读写分离与审计追踪
athola athola 来源
未分类 clawhub v1.9.14 7 版本 100000 Key: 无需
★ 0
Stars
📥 518
下载
💾 1
安装
7
版本
#latest

概述

> Night Market Skill — ported from claude-night-market/archetypes. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

The CQRS and Event Sourcing Paradigm

When To Use

  • Designing event-sourced systems with complex domain logic
  • Systems requiring full audit trails of state changes

When NOT To Use

  • Simple CRUD applications without complex domain logic
  • Small projects where event sourcing adds unnecessary complexity

When to Employ This Paradigm

  • When read and write workloads have vastly different performance characteristics or scaling requirements.
  • When all business events must be captured in a durable, immutable history or audit trail.
  • When a business needs to rebuild projections of data or support temporal queries (e.g., "What did the state of this entity look like yesterday?").

Adoption Steps

  1. Identify Aggregates: Following Domain-Driven Design principles, specify the bounded contexts and the business invariants that each command must enforce on an aggregate.
  2. Model Commands and Events: Define the schemas and validation rules for all commands and the events they produce. Document a clear strategy for versioning and schema evolution.
  3. Implement the Write Side (Command Side): Command handlers are responsible for loading an aggregate's event stream, executing business logic, and atomically appending new events to the stream.
  4. Build Projections to the Read Side: Create separate read models (projections) that are fed by subscriptions to the event stream. Implement back-pressure and retry policies for these subscriptions.
  5. validate Full Observability: Implement detailed logging that includes event IDs, sequence numbers, and metrics for tracking the lag time of each projection.

Key Deliverables

  • An Architecture Decision Record (ADR) detailing the aggregates, the chosen event store technology, the projection strategy, and the expected data consistency model (e.g., eventual consistency SLAs).
  • A suite of tests for command handlers that use in-memory event streams, complemented by integration tests for the projections.
  • Operational tooling for replaying events, taking state snapshots for performance, and managing schema migrations.

Risks & Mitigations

  • High Operational Overhead:
  • Mitigation: Bugs related to event ordering and replays can be difficult to diagnose. Invest heavily in automation, Dead-Letter Queues (DLQs) for failed events, and regular "chaos engineering" drills to test resilience.
  • Challenges of Eventual Consistency:
  • Mitigation: Users may be confused by delays between performing an action and seeing the result. Clearly document the SLAs for read model updates and manage user-facing expectations accordingly, for example, by providing immediate feedback on the command side.
  • Schema Drift:
  • Mitigation: An unplanned change to an event schema can break consumers. Enforce the use of a formal schema registry and implement version gates in the CI/CD pipeline to prevent the emission of unvalidated event versions.

Concrete Components

These vocabulary items name the concrete tools and abstractions

that show up when the paradigm is implemented. They are not

required dependencies and they are not part of the skill's

`tools:` frontmatter (which is reserved for Claude Code tool

restrictions). Use this list to disambiguate during architecture

discussions.

  • `event-store` -- append-only log of domain events; the system of record from which projections are built
  • `message-broker` -- carries commands and integration events between bounded contexts
  • `projection-builder` -- rebuilds read-side views by replaying the event store

版本历史

共 7 个版本

  • v1.9.14 当前
    2026-07-02 08:38
  • v1.9.13
    2026-06-30 16:38 安全 安全
  • v1.9.12
    2026-06-19 19:46 安全 安全
  • v1.8.6
    2026-06-09 17:39 安全 安全
  • v1.8.5
    2026-05-09 16:31 安全 安全
  • v1.8.4
    2026-05-07 04:06 安全 安全
  • v1.8.3
    2026-05-03 08:22 安全 安全

安全检测

腾讯云安全 (Keen)

队列中

腾讯云安全 (Sanbu)

队列中

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 686 📥 331,087
it-ops-security

Nm Abstract Hooks Eval

athola
评估钩子安全性、性能和SDK合规性。用于审计
★ 0 📥 809
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 198 📥 68,232