event-driven-architect
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEvent-Driven Architect
事件驱动架构
Design asynchronous systems built around durable events, explicit contracts, and
operationally safe consumers.
Scope: Event-driven application architecture and reliability patterns. NOT
for synchronous API design (api-designer) or batch ETL pipeline design
(data-pipeline-architect).
设计围绕持久化事件、明确契约和操作安全的消费者构建的异步系统。
适用范围: 事件驱动应用架构与可靠性模式。不适用于同步API设计(api-designer)或批量ETL管道设计(data-pipeline-architect)。
Canonical Vocabulary
标准术语表
| Term | Definition |
|---|---|
| event | Immutable record of something that happened |
| command | Request to perform an action, not a fact |
| topic | Named stream or channel carrying related events |
| partition key | Value used to preserve order for a subset of events |
| consumer group | Independent set of workers processing the same topic |
| idempotency key | Stable identity used to make repeated processing safe |
| dead-letter queue | Holding area for messages that exceeded normal retries |
| outbox | Transactional pattern for publishing events from database changes |
| saga | Multi-step workflow coordinated through events and compensations |
| contract version | Compatibility marker for event schema evolution |
| Term | Definition |
|---|---|
| event | 已发生事件的不可变记录 |
| command | 执行操作的请求,而非事实 |
| topic | 承载相关事件的命名流或通道 |
| partition key | 用于保留事件子集顺序的值 |
| consumer group | 处理同一主题的独立工作者集合 |
| idempotency key | 确保重复处理安全的稳定标识 |
| dead-letter queue | 存放超出正常重试次数消息的区域 |
| outbox | 从数据库变更发布事件的事务性模式 |
| saga | 通过事件和补偿操作协调的多步骤工作流 |
| contract version | 事件 schema 演进的兼容性标记 |
Dispatch
调度模式
| $ARGUMENTS | Mode |
|---|---|
| Design an event-driven architecture |
| Audit an existing event flow |
| Define or evolve an event contract |
| Design retries, ordering, and recovery |
| Plan adoption or replacement of an event flow |
| Natural language about queues, brokers, or async workflows | Auto-detect the closest mode |
| Empty | Show the mode menu with examples |
| $ARGUMENTS | 模式 |
|---|---|
| 设计事件驱动架构 |
| 审计现有事件流 |
| 定义或演进事件契约 |
| 设计重试、排序与恢复机制 |
| 规划事件流的采用或替换方案 |
| 关于队列、消息代理或异步工作流的自然语言描述 | 自动检测最匹配的模式 |
| 空输入 | 显示带示例的模式菜单 |
Mode Menu
模式菜单
| # | Mode | Example |
|---|---|---|
| 1 | Design | |
| 2 | Review | |
| 3 | Contract | |
| 4 | Reliability | |
| 5 | Migration | |
| # | 模式 | Example |
|---|---|---|
| 1 | 设计 | |
| 2 | 评审 | |
| 3 | 契约定义 | |
| 4 | 可靠性设计 | |
| 5 | 迁移规划 | |
When to Use
适用场景
- Designing async workflows across services or bounded contexts
- Choosing event contracts, partition keys, or consumer responsibilities
- Introducing outbox, retry, replay, or dead-letter handling
- Reviewing whether an event system is resilient or over-coupled
- Planning migration from synchronous side effects to durable events
- 跨服务或限界上下文设计异步工作流
- 选择事件契约、分区键或消费者职责
- 引入outbox、重试、重放或死信处理机制
- 评审事件系统是否具备弹性或存在过度耦合
- 规划从同步副作用到持久化事件的迁移
Classification Logic
分类逻辑
Classification Gate
- If the task is synchronous API design, request-response contracts, or CRUD endpoint shape, use api-designer.
- If the task is batch ETL, warehouse movement, or analytics-oriented transformation, use data-pipeline-architect.
- If the task is broker installation, vendor-specific setup, or platform operations, use the relevant platform or devops skill.
- If the workflow is ambiguous, first classify whether the system is centered on durable facts, asynchronous coordination, and replay-safe consumers. Only stay in this skill when the answer is yes.
分类判定规则
- 如果任务是同步API设计、请求-响应契约或CRUD端点设计,使用api-designer技能。
- 如果任务是批量ETL、数据仓库迁移或面向分析的转换,使用data-pipeline-architect技能。
- 如果任务是消息代理安装、特定供应商配置或平台运维,使用相关的平台或DevOps技能。
- 如果工作流不明确,首先判断系统是否以持久化事实、异步协调和可重放安全消费者为核心。只有当答案为是时,才使用本技能。
Progressive Disclosure
渐进式信息披露
- Keep focused on routing, operator steps, and non-negotiable constraints.
SKILL.md - Read reference files as indicated instead of loading everything at once.
- Load when the main question is whether something should be an event, command, or synchronous call.
references/event-vs-command.md - Load when the task involves retries, replay, ordering, poison messages, or dead-letter handling.
references/failure-modes.md - Load when choosing choreography, orchestration, or compensating workflows.
references/saga-comparison.md - Load when formatting architecture, contract, reliability, or migration outputs.
references/output-templates.md
- 保持聚焦于路由、操作步骤和不可协商的约束。
SKILL.md - 按需读取参考文件,而非一次性加载所有内容。
- 当核心问题是应使用事件、命令还是同步调用时,读取。
references/event-vs-command.md - 当任务涉及重试、重放、排序、毒消息或死信处理时,读取。
references/failure-modes.md - 当选择编排、编舞或补偿工作流时,读取。
references/saga-comparison.md - 当格式化架构、契约、可靠性或迁移输出时,读取。
references/output-templates.md
Instructions
操作指南
Mode: Design
模式:设计
- Identify the business facts that should become events. Name them in past tense.
- Separate facts from commands and queries.
- Read if the fact-vs-command boundary is unclear.
references/event-vs-command.md - Define the producer, topic, partition key, consumers, and contract for each event.
- Specify ordering requirements and where ordering does not matter.
- Read when the workflow spans multiple services or compensating actions.
references/saga-comparison.md - Produce an architecture with failure handling, replay, and observability using as needed.
references/output-templates.md
- 识别应转化为事件的业务事实,使用过去式命名。
- 区分事实与命令、查询。
- 如果事实与命令的边界不清晰,读取。
references/event-vs-command.md - 为每个事件定义生产者、主题、分区键、消费者和契约。
- 指定排序要求以及无需排序的场景。
- 当工作流跨多个服务或涉及补偿操作时,读取。
references/saga-comparison.md - 按需使用生成包含故障处理、重放和可观测性的架构方案。
references/output-templates.md
Mode: Review
模式:评审
- Read the event catalog, code path, or architecture diagram.
- Check for hidden synchronous coupling, missing idempotency, weak contract ownership, or undefined replay behavior.
- Flag places where an event stream is being misused for request-response semantics.
- Read when the review touches ordering, replay, retries, or consumer safety.
references/failure-modes.md - Present findings by severity.
- 读取事件目录、代码路径或架构图。
- 检查是否存在隐藏的同步耦合、缺失的幂等性、薄弱的契约所有权或未定义的重放行为。
- 标记事件流被错误用于请求-响应语义的场景。
- 当评审涉及排序、重放、重试或消费者安全时,读取。
references/failure-modes.md - 按严重程度呈现评审结果。
Mode: Contract
模式:契约定义
- Define required fields, producer, ownership, ordering expectations, and versioning strategy.
- State which fields are identifiers, business facts, and metadata.
- Prefer additive evolution; document deprecation windows for consumers.
- Read if the proposed contract still looks like a command or query.
references/event-vs-command.md
- 定义必填字段、生产者、所有权、排序预期和版本化策略。
- 说明哪些字段是标识符、业务事实和元数据。
- 优先采用增量演进方式;为消费者文档化弃用窗口期。
- 如果拟议的契约仍类似命令或查询,读取。
references/event-vs-command.md
Mode: Reliability
模式:可靠性设计
- Read .
references/failure-modes.md - Design retry policy, backoff, poison-message handling, and dead-letter routing.
- Specify idempotency strategy for consumers and handlers.
- Define replay safety and operator controls.
- 读取。
references/failure-modes.md - 设计重试策略、退避机制、毒消息处理和死信路由规则。
- 指定消费者和处理程序的幂等性策略。
- 定义重放安全性和操作员控制机制。
Mode: Migration
模式:迁移规划
- Map the current synchronous side effect or legacy event flow.
- Introduce the new event path behind explicit checkpoints.
- Read for migration checkpoints and cutover framing.
references/output-templates.md - Keep rollback simple by preserving the old path until the new path proves stable.
- 映射当前的同步副作用或遗留事件流。
- 在明确的检查点后引入新的事件路径。
- 读取获取迁移检查点和切换框架。
references/output-templates.md - 通过保留旧路径直至新路径稳定,简化回滚操作。
Output Requirements
输出要求
- Every design must identify producer, topic, partition key, consumers, and failure strategy.
- Every contract must state ownership and versioning rules.
- Every reliability plan must include idempotency and dead-letter handling.
- 每个设计方案必须明确生产者、主题、分区键、消费者和故障策略。
- 每个契约必须声明所有权和版本化规则。
- 每个可靠性计划必须包含幂等性和死信处理机制。
Reference File Index
参考文件索引
| File | Read When |
|---|---|
| The main design question is whether to emit an event, issue a command, or keep a synchronous call |
| The task involves retries, ordering, replay, poison messages, dead-letter queues, or consumer recovery |
| Choosing choreography, orchestration, or compensating saga structure across services |
| Formatting architecture, contract, reliability, review, or migration outputs |
| File | 读取时机 |
|---|---|
| 核心设计问题是选择事件、命令还是同步调用时 |
| 任务涉及重试、排序、重放、毒消息、死信队列或消费者恢复时 |
| 跨服务选择编舞、编排或补偿Saga结构时 |
| 格式化架构、契约、可靠性、评审或迁移输出时 |
Critical Rules
核心规则
- Model business events as facts in past tense, not commands.
- Consumers must be idempotent whenever retries or replay are possible.
- Use the outbox pattern when publishing events from transactional database changes.
- Do not use an event bus for low-latency request-response requirements that need immediate consistency.
- Event contracts should evolve additively whenever possible.
- 将业务事件建模为过去式的事实,而非命令。
- 只要存在重试或重放可能,消费者必须具备幂等性。
- 从事务性数据库变更发布事件时,使用outbox模式。
- 对于需要即时一致性的低延迟请求-响应需求,不要使用事件总线。
- 事件契约应尽可能采用增量演进方式。
Scaling Strategy
扩展策略
- small: Keep the design narrow. Define the minimum event set, one ownership boundary, and one reliability strategy before expanding.
- medium: Add explicit contract ownership, partition strategy, replay rules, and a clear saga choice for multi-service or mixed batch-plus-event workflows. Avoid hiding synchronous dependencies behind event terminology.
- large: Sequence cross-domain programs and migrations by bounded context. Start with one proven event path, then expand consumer batches and downstream automation only after replay, dead-letter handling, and observability are operator-safe.
- 小型场景:保持设计范围狭窄。在扩展前,定义最小事件集、一个所有权边界和一种可靠性策略。
- 中型场景:添加明确的契约所有权、分区策略、重放规则,并为多服务或混合批量+事件工作流明确Saga选择。避免用事件术语掩盖同步依赖。
- 大型场景:按限界上下文排序跨领域方案和迁移。从一条经过验证的事件路径开始,仅在重放、死信处理和可观测性达到操作员安全标准后,再扩展消费者批次和下游自动化。
Scope Boundaries
范围边界
IS for: event contracts, topics, sagas, retries, replay, outbox, consumer design.
NOT for: synchronous REST or GraphQL API design, batch analytics pipelines, or broker installation details.
适用: 事件契约、主题、Saga、重试、重放、outbox、消费者设计。
不适用: 同步REST或GraphQL API设计、批量分析管道、消息代理安装细节。