event-modeling by jwilger/agent-skills
npx skills add https://github.com/jwilger/agent-skills --skill event-modeling价值: 沟通 —— 事件建模是一种结构化的对话,它能在编写任何代码之前,挖掘隐藏的领域知识,并在人类与智能体之间建立共同的理解。
教导智能体遵循 Martin Dilger 的 "Understanding Eventsourcing" 方法论来引导事件建模会话。生成一个完整的事件模型(参与者、事件、命令、读取模型、自动化、切片),以驱动所有下游实现。该模型位于 docs/event_model/ 目录中。
在没有广泛理解领域之前,切勿直接进入详细的工作流设计。第一阶段是绘制地图;第二阶段是探索每个区域。
第一阶段 —— 领域探索。 识别业务做什么、参与者是谁、存在哪些主要流程、集成了哪些外部系统,以及要建模哪些工作流。向用户提出这些问题;不要假设答案。输出:docs/event_model/domain/overview.md。
第二阶段 —— 工作流设计。 对于每个工作流,遵循 9 步流程。你必须遵循 references/nine-steps.md 中的完整方法论。一次设计一个工作流。在开始下一个工作流之前,完成所有 9 个步骤。输出:docs/event_model/workflows/<name>/overview.md 以及 slices/ 目录中的各个切片文件。
存储发生了什么(事件),而不仅仅是当前状态。事件是使用业务语言描述的、不可变的过去式事实。每个读取模型字段都必须能追溯到某个事件。如果一个字段没有来源事件,则模型中缺少了某些东西。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
OrderPlaced,而不是 PlaceOrder 或 CreateOrderDTODataUpdated(太宽泛),也不是 FieldXChanged(太狭窄)每个事件溯源系统都使用这些模式。每种模式对应一个垂直切片。
读取模型 -> 命令 的边。如果命令需要检查某事是否已经发生(例如,幂等性),它应检查事件流,而不是读取模型。读取模型代表有意义的领域投影。命令执行上下文中隐含的基础设施前提条件("目录是否存在?"、"服务是否在运行?")不需要自己的读取模型。每种切片模式都隐含了一组最小的架构层。一个切片在所有必需的层都被实现并连接在一起之前,是不完整的。
在分解一个切片时,请验证你的验收标准和任务分解是否涵盖了每一个必需的层。一个只实现了领域逻辑而没有表示层或基础设施的切片是不完整的 —— 它是一个组件,而不是一个垂直切片。
在工作流设计之后,为每个切片生成 Given/When/Then 场景。这些将成为实现的验收标准。
命令场景: Given = 建立状态的先前事件。When = 包含具体数据的命令。Then = 产生的事件 或 一个错误(两者不会同时出现)。
视图场景: Given = 当前的投影状态。When = 一个新事件。Then = 产生的投影状态。视图不能拒绝事件。
关键区别: GWT 场景测试业务规则(依赖于状态的政策),而不是数据验证(属于类型系统的格式/结构检查)。如果类型系统可以使无效状态无法表示,那么它就不是一个 GWT 场景。
你必须使用 references/gwt-template.md 来获取完整的场景格式和示例。
每个垂直切片必须至少包含一个在应用边界定义的 GWT 场景:
一个完全可以通过在单元测试中调用内部函数来满足的 GWT 场景,描述的是单元级别的规范,而不是切片验收标准。切片验收标准必须执行从外部输入到可观察输出的完整路径。
在应用边界可以进行程序化测试的地方 —— HTTP 端点、CLI 输出解析、无头浏览器自动化、消息队列断言、API 契约测试等 —— 编写自动化的验收测试,从外部输入到可观察输出,完整地执行 GWT 场景。这些测试提供快速反馈,并作为切片行为的活文档。
在自动化边界测试不可行的地方(复杂的 GUI 交互、依赖于硬件的行为、视觉/美学验证),记录人工应手动验证的内容:要执行的具体步骤和预期的可观察结果。这份手动验证清单成为切片完成定义的一部分。
共享事件模式的切片是独立的。事件模式是共享的契约。命令切片通过断言产生的事件进行测试;视图切片使用合成事件夹具进行测试。两者都不需要对方先实现。切片之间没有人为的依赖链。
在编写完 GWT 场景后,验证模型的完整性:
当发现缺口时,请用户澄清,创建缺失的元素,并重新验证。不要在缺口仍然存在的情况下继续。
你是一个引导者,而不是一个速记员。提出探究性问题。挑战假设。在每个事件、每个命令、每个答案之后,不断追问"然后发生了什么?"。使用业务语言,而不是技术术语。在事件建模期间,不要讨论数据库、API、框架或实现。唯一的例外:按名称和目的记录强制性的第三方集成。
要做:
不要做:
硬性约束:
[RP]完成事件建模工作后,验证:
docs/event_model/domain/overview.md,包含参与者、工作流、外部集成和推荐的起始工作流docs/event_model/workflows/<name>/overview.md,且所有 9 个步骤均已完成docs/event_model/workflows/<name>/slices/*.md 中),并包含具体数据如果任何标准未满足,请在继续之前重新审视相关实践。
此技能可独立工作。为了增强工作流,它与以下技能集成:
缺少依赖项?请使用以下命令安装:
npx skills add jwilger/agent-skills --skill domain-modeling
每周安装数
76
仓库
GitHub Stars
2
首次出现
Feb 12, 2026
安全审计
安装于
claude-code67
codex63
cursor63
opencode61
github-copilot61
amp61
Value: Communication -- event modeling is a structured conversation that surfaces hidden domain knowledge and creates shared understanding between humans and agents before any code is written.
Teaches the agent to facilitate event modeling sessions following Martin Dilger's "Understanding Eventsourcing" methodology. Produces a complete event model (actors, events, commands, read models, automations, slices) that drives all downstream implementation. The model lives in docs/event_model/.
Never jump into detailed workflow design without broad domain understanding first. Phase 1 maps the territory; Phase 2 explores each region.
Phase 1 -- Domain Discovery. Identify what the business does, who the actors are, what major processes exist, what external systems integrate, and which workflows to model. Ask these questions of the user; do not assume answers. Output: docs/event_model/domain/overview.md.
Phase 2 -- Workflow Design. For each workflow, follow the 9-step process. You MUST follow references/nine-steps.md for the full methodology. Design one workflow at a time. Complete all 9 steps before starting the next workflow. Output: docs/event_model/workflows/<name>/overview.md plus individual slice files in slices/.
Store what happened (events), not just current state. Events are immutable past-tense facts in business language. Every read model field must trace back to an event. If a field has no source event, something is missing from the model.
OrderPlaced, not PlaceOrder or CreateOrderDTODataUpdated (too broad) and not FieldXChanged (too narrow)Every event-sourced system uses these patterns. Each pattern maps to one vertical slice.
ReadModel → Command edges should appear in diagrams. If a command needs to check whether something already happened (e.g., idempotency), it checks the event stream, not a read model. Read models represent meaningful domain projections. Infrastructure preconditions ("does directory exist?", "is service running?") that are implicit in the command's execution context do not need their own read model.Each slice pattern implies a minimum set of architectural layers. A slice is not complete until all required layers are implemented and wired together.
When decomposing a slice, verify that your acceptance criteria and task breakdown cover every required layer. A slice that only implements domain logic without presentation or infrastructure is incomplete — it is a component, not a vertical slice.
After workflow design, generate Given/When/Then scenarios for each slice. These become acceptance criteria for implementation.
Command scenarios: Given = prior events establishing state. When = the command with concrete data. Then = events produced OR an error (never both).
View scenarios: Given = current projection state. When = one new event. Then = resulting projection state. Views cannot reject events.
Critical distinction: GWT scenarios test business rules (state-dependent policies), not data validation (format/structure checks that belong in the type system). If the type system can make the invalid state unrepresentable, it is not a GWT scenario.
You MUST use references/gwt-template.md for the full scenario format and examples.
Every vertical slice MUST include at least one GWT scenario defined at the application boundary:
A GWT scenario that can be satisfied entirely by calling an internal function in a unit test describes a unit-level specification, not a slice acceptance criterion. Slice acceptance criteria must exercise the path from external input to observable output.
Where the application boundary is programmatically testable — HTTP endpoints, CLI output parsing, headless browser automation, message queue assertions, API contract tests, etc. — write automated acceptance tests that exercise the full GWT scenario from external input to observable output. These tests provide fast feedback and serve as living documentation of slice behavior.
Where automated boundary testing is not feasible (complex GUI interactions, hardware-dependent behavior, visual/aesthetic verification), document what the human should manually verify: the specific steps to perform and the expected observable result. This manual verification checklist becomes part of the slice's definition of done.
Slices sharing an event schema are independent. The event schema is the shared contract. Command slices test by asserting on produced events; view slices test with synthetic event fixtures. Neither needs the other to be implemented first. No artificial dependency chains between slices.
After GWT scenarios are written, validate the model for completeness:
When gaps are found, ask the user to clarify, create the missing element, and re-validate. Do not proceed with gaps remaining.
You are a facilitator, not a stenographer. Ask probing questions. Challenge assumptions. Keep asking "And then what happens?" after every event, every command, every answer. Use business language, not technical jargon. Do not discuss databases, APIs, frameworks, or implementation during event modeling. The only exception: note mandatory third-party integrations by name and purpose.
Do:
Do not:
Hard constraints:
[RP]After completing event modeling work, verify:
docs/event_model/domain/overview.md with actors, workflows, external integrations, and recommended starting workflowdocs/event_model/workflows/<name>/overview.md with all 9 steps completeddocs/event_model/workflows/<name>/slices/*.md) with concrete dataIf any criterion is not met, revisit the relevant practice before proceeding.
This skill works standalone. For enhanced workflows, it integrates with:
Missing a dependency? Install with:
npx skills add jwilger/agent-skills --skill domain-modeling
Weekly Installs
76
Repository
GitHub Stars
2
First Seen
Feb 12, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code67
codex63
cursor63
opencode61
github-copilot61
amp61