@eventmodelers/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -0
- package/cli.js +676 -0
- package/package.json +35 -0
- package/shared/build-kit/code-export.mjs +560 -0
- package/shared/build-kit/lib/ollama-agent.js +147 -0
- package/shared/build-kit/package.json +11 -0
- package/shared/build-kit/ralph-ollama.js +39 -0
- package/shared/build-kit/realtime-agent.js +18 -0
- package/stacks/axon/templates/.claude/skills/build-automation/SKILL.md +407 -0
- package/stacks/axon/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +114 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/SKILL.md +496 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/axon-workflow-api.md +279 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/feature-flag-patterns.md +114 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/SKILL.md +396 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/axon-test-fixture-patterns.md +162 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +56 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/rest-api-patterns.md +115 -0
- package/stacks/axon/templates/.claude/skills/build-state-view/SKILL.md +282 -0
- package/stacks/axon/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/axon/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +611 -0
- package/stacks/axon/templates/.claude/skills/load-slice/SKILL.md +141 -0
- package/stacks/axon/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
- package/stacks/axon/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/axon/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/axon/templates/build-kit/lib/backend-prompt.md +158 -0
- package/stacks/axon/templates/build-kit/lib/prompt.md +126 -0
- package/stacks/axon/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/axon/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/axon/templates/build-kit/ralph.sh +98 -0
- package/stacks/axon/templates/root/.env.example +5 -0
- package/stacks/axon/templates/root/CLAUDE.md +60 -0
- package/stacks/axon/templates/root/README.md +44 -0
- package/stacks/axon/templates/root/docker-compose.yml +64 -0
- package/stacks/axon/templates/root/mvnw +259 -0
- package/stacks/axon/templates/root/mvnw.cmd +149 -0
- package/stacks/axon/templates/root/pom.xml +125 -0
- package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/QuickstartApplication.java +128 -0
- package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/config/WebConfig.java +155 -0
- package/stacks/axon/templates/root/src/main/resources/application.properties +2 -0
- package/stacks/axon/templates/root/src/main/resources/static/bg-body.png +0 -0
- package/stacks/axon/templates/root/src/main/resources/static/bg-header.png +0 -0
- package/stacks/axon/templates/root/src/main/resources/static/index.html +596 -0
- package/stacks/cratis-csharp/templates/.claude/skills/_shared/cratis-conventions.md +251 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-automation/SKILL.md +99 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-automation/references/patterns.md +115 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/SKILL.md +163 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/references/patterns.md +234 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/SKILL.md +120 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/references/patterns.md +166 -0
- package/stacks/cratis-csharp/templates/.claude/skills/connect/SKILL.md +169 -0
- package/stacks/cratis-csharp/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +609 -0
- package/stacks/cratis-csharp/templates/.claude/skills/load-slice/SKILL.md +141 -0
- package/stacks/cratis-csharp/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/AGENT.md +58 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/backend-prompt.md +129 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/prompt.md +124 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/ralph.js +302 -0
- package/stacks/cratis-csharp/templates/build-kit/ralph-claude.js +37 -0
- package/stacks/cratis-csharp/templates/build-kit/ralph.sh +98 -0
- package/stacks/cratis-csharp/templates/root/.frontend/index.css +29 -0
- package/stacks/cratis-csharp/templates/root/.frontend/index.html +17 -0
- package/stacks/cratis-csharp/templates/root/.frontend/main.tsx +18 -0
- package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.json +42 -0
- package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.node.json +11 -0
- package/stacks/cratis-csharp/templates/root/.frontend/vite.config.ts +56 -0
- package/stacks/cratis-csharp/templates/root/App.tsx +23 -0
- package/stacks/cratis-csharp/templates/root/CLAUDE.md +62 -0
- package/stacks/cratis-csharp/templates/root/CratisApp.csproj +25 -0
- package/stacks/cratis-csharp/templates/root/CratisApp.sln +18 -0
- package/stacks/cratis-csharp/templates/root/GlobalUsings.cs +3 -0
- package/stacks/cratis-csharp/templates/root/Home.tsx +102 -0
- package/stacks/cratis-csharp/templates/root/Program.cs +26 -0
- package/stacks/cratis-csharp/templates/root/README.md +192 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/AllListings.ts +47 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.cs +11 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.ts +12 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/ListingDataTable.tsx +17 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Register.ts +51 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/RegisterDialog.tsx +18 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Registration.cs +27 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeFeature.tsx +22 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeName.cs +3 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/appsettings.Development.json +9 -0
- package/stacks/cratis-csharp/templates/root/appsettings.json +26 -0
- package/stacks/cratis-csharp/templates/root/docker-compose.yml +23 -0
- package/stacks/cratis-csharp/templates/root/package.json +33 -0
- package/stacks/cratis-csharp/templates/root/tsconfig.json +3 -0
- package/stacks/modeling-kit/templates/.claude/settings.local.json +13 -0
- package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/SKILL.md +215 -0
- package/stacks/modeling-kit/templates/.claude/skills/attributes/SKILL.md +176 -0
- package/stacks/modeling-kit/templates/.claude/skills/connect/SKILL.md +182 -0
- package/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/SKILL.md +383 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-applying-conways-law/SKILL.md +465 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/SKILL.md +587 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/references/facilitating-event-modeling-workshops.md +626 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/SKILL.md +542 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-event-models/SKILL.md +497 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md +783 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/SKILL.md +604 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/SKILL.md +699 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-integrating-legacy-systems/SKILL.md +674 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/SKILL.md +231 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/domain-patterns.md +150 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/patterns.md +329 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/snapshotting.md +204 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md +352 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/references/project-planning-with-event-modeling.md +341 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-plotting-events/SKILL.md +153 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/SKILL.md +136 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/examples.md +78 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/patterns.md +85 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/SKILL.md +655 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-translating-external-events/SKILL.md +479 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/SKILL.md +234 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models-checklist/SKILL.md +353 -0
- package/stacks/modeling-kit/templates/.claude/skills/examples/SKILL.md +200 -0
- package/stacks/modeling-kit/templates/.claude/skills/handle-comment/SKILL.md +94 -0
- package/stacks/modeling-kit/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +441 -0
- package/stacks/modeling-kit/templates/.claude/skills/place-element/SKILL.md +290 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard/SKILL.md +212 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard-screen/SKILL.md +123 -0
- package/stacks/modeling-kit/templates/.claude/skills/timeline/SKILL.md +353 -0
- package/stacks/modeling-kit/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/modeling-kit/templates/.claude/skills/wdyt/SKILL.md +134 -0
- package/stacks/modeling-kit/templates/kit/lib/agent.sh +20 -0
- package/stacks/modeling-kit/templates/kit/lib/ollama-agent.js +147 -0
- package/stacks/modeling-kit/templates/kit/lib/ralph.js +286 -0
- package/stacks/modeling-kit/templates/kit/package.json +12 -0
- package/stacks/modeling-kit/templates/kit/ralph-claude.js +50 -0
- package/stacks/modeling-kit/templates/kit/ralph-ollama.js +38 -0
- package/stacks/modeling-kit/templates/kit/ralph.sh +61 -0
- package/stacks/modeling-kit/templates/kit/realtime-agent.js +18 -0
- package/stacks/modeling-kit/templates/root/CLAUDE.md +56 -0
- package/stacks/node/templates/.claude/skills/build-automation/SKILL.md +266 -0
- package/stacks/node/templates/.claude/skills/build-state-change/SKILL.md +344 -0
- package/stacks/node/templates/.claude/skills/build-state-view/SKILL.md +412 -0
- package/stacks/node/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/node/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
- package/stacks/node/templates/.claude/skills/load-slice/SKILL.md +143 -0
- package/stacks/node/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/node/templates/build-kit/README.md +86 -0
- package/stacks/node/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/node/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/node/templates/build-kit/lib/backend-prompt.md +152 -0
- package/stacks/node/templates/build-kit/lib/prompt.md +122 -0
- package/stacks/node/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/node/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/node/templates/build-kit/ralph.sh +98 -0
- package/stacks/node/templates/root/.env.example +15 -0
- package/stacks/node/templates/root/CLAUDE.md +60 -0
- package/stacks/node/templates/root/docker-compose.yml +15 -0
- package/stacks/node/templates/root/flyway.conf +17 -0
- package/stacks/node/templates/root/migrations/V1__schema.sql.example +12 -0
- package/stacks/node/templates/root/package.json +50 -0
- package/stacks/node/templates/root/server.ts +130 -0
- package/stacks/node/templates/root/setup-env.sh +53 -0
- package/stacks/node/templates/root/src/common/assertions.ts +6 -0
- package/stacks/node/templates/root/src/common/db.ts +32 -0
- package/stacks/node/templates/root/src/common/loadPostgresEventstore.ts +23 -0
- package/stacks/node/templates/root/src/common/parseEndpoint.ts +51 -0
- package/stacks/node/templates/root/src/common/processorDlq.ts +28 -0
- package/stacks/node/templates/root/src/common/realtimeBroadcast.ts +12 -0
- package/stacks/node/templates/root/src/common/replay.ts +16 -0
- package/stacks/node/templates/root/src/common/routes.ts +19 -0
- package/stacks/node/templates/root/src/common/testHelpers.ts +44 -0
- package/stacks/node/templates/root/src/swagger.ts +34 -0
- package/stacks/node/templates/root/src/util/assertions.ts +6 -0
- package/stacks/node/templates/root/src/util/hash.ts +9 -0
- package/stacks/node/templates/root/src/util/sanitize.ts +23 -0
- package/stacks/node/templates/root/tsconfig.json +32 -0
- package/stacks/node/templates/root/vercel.json +8 -0
- package/stacks/supabase/templates/.claude/skills/build-automation/SKILL.md +266 -0
- package/stacks/supabase/templates/.claude/skills/build-state-change/SKILL.md +344 -0
- package/stacks/supabase/templates/.claude/skills/build-state-view/SKILL.md +390 -0
- package/stacks/supabase/templates/.claude/skills/build-webhook/SKILL.md +303 -0
- package/stacks/supabase/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/supabase/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
- package/stacks/supabase/templates/.claude/skills/load-slice/SKILL.md +143 -0
- package/stacks/supabase/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/supabase/templates/build-kit/README.md +86 -0
- package/stacks/supabase/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/supabase/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/supabase/templates/build-kit/lib/backend-prompt.md +152 -0
- package/stacks/supabase/templates/build-kit/lib/prompt.md +123 -0
- package/stacks/supabase/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/supabase/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/supabase/templates/build-kit/ralph.sh +98 -0
- package/stacks/supabase/templates/root/.env.example +22 -0
- package/stacks/supabase/templates/root/CLAUDE.md +61 -0
- package/stacks/supabase/templates/root/flyway.conf +17 -0
- package/stacks/supabase/templates/root/package.json +52 -0
- package/stacks/supabase/templates/root/server.ts +177 -0
- package/stacks/supabase/templates/root/setup-env.sh +53 -0
- package/stacks/supabase/templates/root/src/common/assertions.ts +6 -0
- package/stacks/supabase/templates/root/src/common/db.ts +32 -0
- package/stacks/supabase/templates/root/src/common/loadPostgresEventstore.ts +23 -0
- package/stacks/supabase/templates/root/src/common/parseEndpoint.ts +51 -0
- package/stacks/supabase/templates/root/src/common/processorDlq.ts +28 -0
- package/stacks/supabase/templates/root/src/common/realtimeBroadcast.ts +19 -0
- package/stacks/supabase/templates/root/src/common/replay.ts +16 -0
- package/stacks/supabase/templates/root/src/common/routes.ts +23 -0
- package/stacks/supabase/templates/root/src/common/testHelpers.ts +54 -0
- package/stacks/supabase/templates/root/src/supabase/README.md +141 -0
- package/stacks/supabase/templates/root/src/supabase/api.ts +56 -0
- package/stacks/supabase/templates/root/src/supabase/requireOrgaAdmin.ts +32 -0
- package/stacks/supabase/templates/root/src/supabase/requireSysUser.ts +40 -0
- package/stacks/supabase/templates/root/src/supabase/requireUser.ts +72 -0
- package/stacks/supabase/templates/root/src/swagger.ts +34 -0
- package/stacks/supabase/templates/root/src/util/assertions.ts +6 -0
- package/stacks/supabase/templates/root/src/util/hash.ts +9 -0
- package/stacks/supabase/templates/root/src/util/sanitize.ts +23 -0
- package/stacks/supabase/templates/root/supabase/config.toml +295 -0
- package/stacks/supabase/templates/root/supabase/migrations/V1__schema.sql.example +12 -0
- package/stacks/supabase/templates/root/supabase/seed.sql +1 -0
- package/stacks/supabase/templates/root/tsconfig.json +32 -0
- package/stacks/supabase/templates/root/vercel.json +8 -0
package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/SKILL.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eventmodeling-validating-event-models
|
|
3
|
+
description: "Step 9 of Event Modeling - Validate event-sourced models for completeness, consistency, and event sourcing principles. Ensures events are immutable facts, state projections are deterministic, and commands are pure. Identifies gaps and suggests improvements before code generation. Use when reviewing models before code generation. Do not use for: the structured 23-check production checklist (use eventmodeling-validating-event-models-checklist) or field-level completeness verification (use eventmodeling-checking-completeness)."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Write
|
|
6
|
+
- Bash
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Validating Event Models
|
|
10
|
+
|
|
11
|
+
> **Before doing anything else**, invoke the `connect` skill to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL`. Then invoke the `learn-eventmodelers-api` skill to load the full API reference. Do not proceed until both skills have been loaded.
|
|
12
|
+
|
|
13
|
+
For validation you treat the Event Model as read only. The only thing you are allowed to change is comments.
|
|
14
|
+
For critical questions, add comments to elements.
|
|
15
|
+
|
|
16
|
+
For every field in the command, it must be clear where it is coming from.
|
|
17
|
+
Either it´s defined in a transitively connected Read Model, or it is marked as "generated" in either a screen or an automation.
|
|
18
|
+
There should not be any fields without a defined source.
|
|
19
|
+
|
|
20
|
+
The source can be also determined by looking at the defined Scenarios. Are all Scenarios covered?
|
|
21
|
+
|
|
22
|
+
## Board Context
|
|
23
|
+
|
|
24
|
+
Before starting, read the current board state to validate what is actually on the board:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
|
|
28
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=EVENT"
|
|
29
|
+
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
|
|
30
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=COMMAND"
|
|
31
|
+
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
|
|
32
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=READMODEL"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
After validation, use the `handle-comment` skill to post findings on the relevant nodes — `TASK` for critical violations that must be fixed, `QUESTION` for warnings and recommendations.
|
|
36
|
+
|
|
37
|
+
## Purpose
|
|
38
|
+
Ensures event-sourced models are complete, correct, and follow pure event sourcing principles (minimal per-command state).
|
|
39
|
+
|
|
40
|
+
## Workflow
|
|
41
|
+
|
|
42
|
+
When given an event model, perform comprehensive validation:
|
|
43
|
+
|
|
44
|
+
### 1. Swimlane Completeness Check
|
|
45
|
+
|
|
46
|
+
Verify each swimlane has:
|
|
47
|
+
- Clear name (identity)
|
|
48
|
+
- At least one event type
|
|
49
|
+
- Initial event (what creates the stream)
|
|
50
|
+
- State transitions documented
|
|
51
|
+
|
|
52
|
+
**For each event:**
|
|
53
|
+
- Uses past tense (Created, Confirmed, etc.)
|
|
54
|
+
- Contains **only facts** (no computed fields)
|
|
55
|
+
- All data is **immutable**
|
|
56
|
+
- Unique semantics (no duplicates)
|
|
57
|
+
|
|
58
|
+
**For each state projection:**
|
|
59
|
+
- Can be deterministically rebuilt from events
|
|
60
|
+
- Replay logic is pure (no side effects)
|
|
61
|
+
|
|
62
|
+
**For each command:**
|
|
63
|
+
- Clear input parameters
|
|
64
|
+
- Validation rules defined in scenarios (against state)
|
|
65
|
+
- Resulting events specified (or rejection reason)
|
|
66
|
+
- Pure logic (no side effects except event appending)
|
|
67
|
+
|
|
68
|
+
### 2. Consistency Checks
|
|
69
|
+
|
|
70
|
+
- [ ] **Event-Stream Mapping**: Every event belongs to exactly one lane
|
|
71
|
+
- [ ] **Command Outcomes**: Every command produces events OR documents rejection
|
|
72
|
+
- [ ] **Deterministic Projections**: State can only be derived one way from events
|
|
73
|
+
- [ ] **No Side Effects in Projections**: Pure state reconstruction logic
|
|
74
|
+
- [ ] **Event Immutability**: No event data is ever modified
|
|
75
|
+
- [ ] **Naming Consistency**: Are naming patterns consistent?
|
|
76
|
+
- Commands: Verb present (CreateOrder, ConfirmPayment)
|
|
77
|
+
- Events: Verb past tense (OrderCreated, PaymentConfirmed)
|
|
78
|
+
|
|
79
|
+
### 3. Event Sourcing Principles Compliance
|
|
80
|
+
|
|
81
|
+
Check against event sourcing fundamentals:
|
|
82
|
+
|
|
83
|
+
- [ ] **Events are Facts**: Events describe what happened, not potential futures
|
|
84
|
+
- "OrderMayBeConfirmed" → "OrderConfirmed"
|
|
85
|
+
- "PaymentPending" (in events) → "PaymentInitiated", "PaymentAuthorized"
|
|
86
|
+
|
|
87
|
+
- [ ] **Events are Immutable**: No modification of event data
|
|
88
|
+
- "Update OrderCreated event with new total" → "Append OrderTotalCorrected event"
|
|
89
|
+
|
|
90
|
+
- [ ] **Complete Event Data**: Events contain all facts needed for state rebuild
|
|
91
|
+
- Event: "OrderConfirmed" (missing paymentId) → Event includes paymentId
|
|
92
|
+
|
|
93
|
+
- [ ] **No Computed Fields in Events**: Only raw captured facts
|
|
94
|
+
- OrderCreated includes "totalTax" (computed) → Includes items + amounts, tax computed in projection
|
|
95
|
+
|
|
96
|
+
- [ ] **Deterministic Projections**: Replaying events always produces same state
|
|
97
|
+
- Projection uses: for each event, do X
|
|
98
|
+
- Projection uses: external API call during replay
|
|
99
|
+
|
|
100
|
+
- [ ] **State is Derived**: Current state always comes from replaying events
|
|
101
|
+
- "Load state: replay all events for Order:123"
|
|
102
|
+
- "Load state: query database Orders table"
|
|
103
|
+
|
|
104
|
+
### 4. Event Flow Validation
|
|
105
|
+
|
|
106
|
+
- [ ] **Command → Event Mapping**: Clear what each command produces
|
|
107
|
+
- [ ] **No Zombie Commands**: Commands that never produce events (read-only OK)
|
|
108
|
+
|
|
109
|
+
### 5. Role & Actor Attribution Validation
|
|
110
|
+
|
|
111
|
+
Verify that every command has explicit actor attribution from the Role Catalog:
|
|
112
|
+
|
|
113
|
+
- [ ] **Role Catalog exists**: A Role Catalog was defined in Step 1 (eventmodeling-brainstorming-events)
|
|
114
|
+
- CRITICAL: No Role Catalog found — commands have no actor attribution
|
|
115
|
+
- PASS: Role Catalog with human roles and system actors defined
|
|
116
|
+
|
|
117
|
+
- [ ] **Every command has actor attribution**: No command uses generic "User"
|
|
118
|
+
- CRITICAL: `CreateOrder` attributed to "User" (which user? Customer? Admin? Seller?)
|
|
119
|
+
- PASS: `CreateOrder` attributed to "Customer" (specific role from catalog)
|
|
120
|
+
|
|
121
|
+
### 6. Command State Read Models Validation (CRITICAL)
|
|
122
|
+
|
|
123
|
+
**This is the PRIMARY validation gate. Violations are CRITICAL and must be fixed before approval.** Validate that **command state read models** are **minimal and command-specific**, not bundled like DDD aggregates.
|
|
124
|
+
|
|
125
|
+
### 7. Command & State Validation
|
|
126
|
+
|
|
127
|
+
- [ ] **State-Based Decisions**: Commands decide based on current state only
|
|
128
|
+
- [ ] **Valid State Transitions**: Document what state changes are allowed
|
|
129
|
+
```text
|
|
130
|
+
Draft → Confirmed (ConfirmOrder)
|
|
131
|
+
Draft → Cancelled (CancelOrder)
|
|
132
|
+
Confirmed → Shipped (ShipOrder)
|
|
133
|
+
Confirmed ↛ Draft (invalid)
|
|
134
|
+
```
|
|
135
|
+
- [ ] **Preconditions Clear**: When can each command execute?
|
|
136
|
+
- "Can only confirm if state is Draft"
|
|
137
|
+
- "Can sometimes confirm"
|
|
138
|
+
- [ ] **Error Handling**: What happens if validation fails?
|
|
139
|
+
- "Reject with ValidationError, no events appended"
|
|
140
|
+
- "Append ErrorEvent and continue"
|
|
141
|
+
|
|
142
|
+
### 8. Projection Validation
|
|
143
|
+
|
|
144
|
+
- [ ] **Read Models**: Read models are rich projections
|
|
145
|
+
- [ ] **Read Models Optional**: Are they needed or just convenience?
|
|
146
|
+
- [ ] **Regenerable**: Can be rebuilt from events at any time
|
|
147
|
+
|
|
148
|
+
### 9. Issues & Recommendations Report
|
|
149
|
+
|
|
150
|
+
Format findings as comments:
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
|
|
154
|
+
## Validation Summary
|
|
155
|
+
|
|
156
|
+
**Overall Status**: Ready with recommendations
|
|
157
|
+
|
|
158
|
+
**Blockers for Implementation**: 0 critical issues
|
|
159
|
+
|
|
160
|
+
**Recommended Fixes**:
|
|
161
|
+
1. Add missing OrderCancelled event
|
|
162
|
+
2. Move PaymentMethod to its own minimal state projection
|
|
163
|
+
3. Document all implicit invariants explicitly
|
|
164
|
+
|
|
165
|
+
**Ready for Code Generation**: Yes, after implementing recommendations
|
|
166
|
+
|
|
167
|
+
## Next Steps
|
|
168
|
+
1. Review recommendations with domain expert
|
|
169
|
+
2. Update model with critical fixes
|
|
170
|
+
3. Proceed to code generation
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Common Issues to Flag
|
|
174
|
+
|
|
175
|
+
| Issue | Pattern | Fix |
|
|
176
|
+
|-------|---------|-----|
|
|
177
|
+
| Missing cancellation flows | No "Cancelled" events | Add compensation paths |
|
|
178
|
+
| Implicit invariants | "Obviously can't do X" | Make invariants explicit |
|
|
179
|
+
| Command state too broad | Shared state used by 2+ commands | Split into per-command minimal state projections |
|
|
180
|
+
| Orphaned events | Events no one listens to | Link to projections or commands |
|
|
181
|
+
| No read models | Commands reading query/read models for validation | Add separate query read models; keep command state minimal |
|
|
182
|
+
| Circular dependencies | Projection A depends on B, B on A | Redesign stream boundaries |
|
|
183
|
+
|
|
184
|
+
## Key Principles for Event Sourcing
|
|
185
|
+
|
|
186
|
+
1. **Events are the source of truth**: Everything else is derived from them
|
|
187
|
+
2. **Immutable event log**: Events never change, only appended
|
|
188
|
+
3. **State is a projection**: Current state is built by replaying events
|
|
189
|
+
4. **Commands are pure decisions**: Validate against state, produce events or reject
|
|
190
|
+
5. **Projections are optional**: Can be rebuilt at any time
|
|
191
|
+
6. **Stream per entity**: Each entity has one append-only event stream
|
|
192
|
+
|
|
193
|
+
## Success Criteria
|
|
194
|
+
|
|
195
|
+
Your event model validation is successful when:
|
|
196
|
+
|
|
197
|
+
- All requirements are captured in events
|
|
198
|
+
- Commands clearly trigger events
|
|
199
|
+
- Stream roots have clear, minimal boundaries
|
|
200
|
+
- Business rules are explicit invariants (not hidden assumptions)
|
|
201
|
+
- Read models serve actual query needs (not used by commands)
|
|
202
|
+
- Command state is minimal and command-specific (not shared across multiple commands)
|
|
203
|
+
- Events are immutable facts (past tense, no computed fields)
|
|
204
|
+
- State can be deterministically rebuilt from events
|
|
205
|
+
- All command-to-event mappings are documented
|
|
206
|
+
- Critical issues are resolved or documented as known limitations
|
|
207
|
+
|
|
208
|
+
A model is **ready for code generation** if:
|
|
209
|
+
- No critical issues remain
|
|
210
|
+
- All command state follows naming convention (e.g., `[CommandName]State`)
|
|
211
|
+
- No state is shared between different commands
|
|
212
|
+
- All events are immutable facts
|
|
213
|
+
- All business rules are explicit
|
|
214
|
+
- A Role Catalog exists with all human roles and system actors
|
|
215
|
+
- Every command has explicit actor attribution from the Role Catalog
|
|
216
|
+
|
|
217
|
+
## Quality Checklist
|
|
218
|
+
|
|
219
|
+
- [ ] All events are immutable facts (past tense)
|
|
220
|
+
- [ ] No computed fields stored in events
|
|
221
|
+
- [ ] State projection is deterministic from events
|
|
222
|
+
- [ ] Commands validate against current state only
|
|
223
|
+
- [ ] Each command either produces events or rejects (no silent failures)
|
|
224
|
+
- [ ] Event causality/command-event mapping is clear
|
|
225
|
+
- [ ] State transitions are documented
|
|
226
|
+
- [ ] No direct references between lanes
|
|
227
|
+
- [ ] Projections serve specific query needs (or are removed)
|
|
228
|
+
- [ ] Everything can be rebuilt from the event stream
|
|
229
|
+
- [ ] No state is shared between different commands
|
|
230
|
+
- [ ] All command state is minimal (only fields needed for validation)
|
|
231
|
+
- [ ] **Role Catalog exists with human roles and system actors**
|
|
232
|
+
- [ ] **Every command attributed to a specific role/actor (no generic "User")**
|
|
233
|
+
- [ ] **Every human role has at least one command and one read model**
|
|
234
|
+
- [ ] **Permission boundaries from Role Catalog are respected**
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eventmodeling-validating-event-models-checklist
|
|
3
|
+
description: "Validate event-sourced CQRS models against 16 architectural checks across 7 phases. Identifies anti-patterns and confirms compliance with event sourcing principles. Use when reviewing event models for production readiness or after completing event modeling steps. Do not use for: reviewing incomplete or in-progress models (use eventmodeling-validating-event-models), or for elaborating new scenarios (use eventmodeling-elaborating-scenarios)."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Write
|
|
6
|
+
- Bash
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Event Model Validation Checklist Skill
|
|
10
|
+
|
|
11
|
+
> **Before doing anything else**, invoke the `connect` skill to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL`. Then invoke the `learn-eventmodelers-api` skill to load the full API reference. Do not proceed until both skills have been loaded.
|
|
12
|
+
|
|
13
|
+
**Purpose**: Validate any event-sourced CQRS event model against 16 architectural checks across 7 phases. Identifies anti-patterns and confirms compliance with event sourcing principles.
|
|
14
|
+
|
|
15
|
+
**Applies To**: Any domain - e-commerce, banking, SaaS, marketplace, healthcare, etc.
|
|
16
|
+
|
|
17
|
+
**When to Use**:
|
|
18
|
+
- After completing Step 2 (Event Plot) of 7-step event modeling
|
|
19
|
+
- After completing Step 7 (Scenarios) before declaring model complete
|
|
20
|
+
- When reviewing an existing event model for production readiness
|
|
21
|
+
- When suspicious of architectural issues in event design
|
|
22
|
+
|
|
23
|
+
**What It Does**:
|
|
24
|
+
1. Reads current board state (EVENT, COMMAND, READMODEL nodes) as input
|
|
25
|
+
2. Systematically applies 16 validation checks across 7 phases
|
|
26
|
+
2. Identifies violations of event sourcing principles (domain-agnostic)
|
|
27
|
+
3. Flags anti-patterns (calculations as events, non-entity streams, etc.)
|
|
28
|
+
4. Verifies read model/event distinction
|
|
29
|
+
5. Confirms stream independence and business rule enforcement
|
|
30
|
+
6. Returns pass/fail verdict with evidence
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Board Context
|
|
35
|
+
|
|
36
|
+
Read the current board state before running the checklist:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
|
|
40
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=EVENT"
|
|
41
|
+
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
|
|
42
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=COMMAND"
|
|
43
|
+
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
|
|
44
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=READMODEL"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use the board nodes as the model input. After the checklist, use `handle-comment` to post `TASK` comments on nodes that fail checks.
|
|
48
|
+
|
|
49
|
+
## Validation Phases (Domain-Agnostic)
|
|
50
|
+
|
|
51
|
+
### Phase 1: Event Stream & Command Handler State Validation (3 checks)
|
|
52
|
+
- Check 1.1: Each event belongs to exactly one stream
|
|
53
|
+
- Check 1.2: Each command handler owns its own [CommandHandler]State class
|
|
54
|
+
- Check 1.3: No hard dependencies between command handlers (orchestrated via events only)
|
|
55
|
+
|
|
56
|
+
**Anti-pattern to catch**: Sharing state across handlers or treating state as persistent aggregate
|
|
57
|
+
|
|
58
|
+
### Phase 2: Event Quality Validation (3 checks)
|
|
59
|
+
- Check 2.1: Events represent domain facts, not calculations
|
|
60
|
+
- Check 2.2: Event data is immutable after creation
|
|
61
|
+
- Check 2.3: Event names use past tense (what actually happened)
|
|
62
|
+
|
|
63
|
+
**Anti-pattern to catch**: Storing computed/aggregated data as events
|
|
64
|
+
|
|
65
|
+
### Phase 3: Read Model vs Event Distinction (2 checks)
|
|
66
|
+
- Check 3.1: Each read model is NOT an event stream
|
|
67
|
+
- Check 3.2: Read model has natural query pattern
|
|
68
|
+
|
|
69
|
+
**Anti-pattern to catch**: Confusing projections/calculations with domain facts
|
|
70
|
+
|
|
71
|
+
### Phase 4: Business Rules Validation (2 checks)
|
|
72
|
+
- Check 4.1: Constraints enforced in command handler decision logic (encapsulated in [CommandHandler]State)
|
|
73
|
+
- Check 4.2: Event preconditions are explicit (what state must exist before command is valid)
|
|
74
|
+
|
|
75
|
+
**Anti-pattern to catch**: Business rules scattered across handlers or encoded in event stream structure
|
|
76
|
+
|
|
77
|
+
### Phase 5: Data Traceability (1 check)
|
|
78
|
+
- Check 5.1: Input → Event → Read Model traceability is complete
|
|
79
|
+
|
|
80
|
+
**Anti-pattern to catch**: Command inputs that disappear or read model fields without source
|
|
81
|
+
|
|
82
|
+
### Phase 6: Event Flow Validation (1 check)
|
|
83
|
+
- Check 6.1: No impossible event sequences (state machine is sound)
|
|
84
|
+
|
|
85
|
+
**Anti-pattern to catch**: Events that can occur in invalid state combinations
|
|
86
|
+
|
|
87
|
+
### Phase 7: Stream Independence (1 check)
|
|
88
|
+
- Check 7.1: Each stream can be versioned/restored independently
|
|
89
|
+
|
|
90
|
+
**Anti-pattern to catch**: Hard dependencies between streams
|
|
91
|
+
|
|
92
|
+
### Final Questions (3 checks)
|
|
93
|
+
- Question 1: Could an architect unfamiliar with this domain understand the model in 15 minutes?
|
|
94
|
+
- Question 2: Could you change your core algorithm/calculation without changing event history?
|
|
95
|
+
- Question 3: Could this be implemented in your target technology stack (e.g., TypeScript + PostgreSQL)?
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Output Format
|
|
100
|
+
|
|
101
|
+
The skill returns a validation report with:
|
|
102
|
+
|
|
103
|
+
### For Each Check
|
|
104
|
+
```
|
|
105
|
+
Check 1.2: Stream Root is Business Entity, Not Calculation
|
|
106
|
+
Status: PASS
|
|
107
|
+
Evidence: [Specific examples from your model]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Anti-Patterns Identified (if any)
|
|
111
|
+
```
|
|
112
|
+
CRITICAL: [Anti-pattern description]
|
|
113
|
+
Problem: [Why it violates event sourcing]
|
|
114
|
+
Violates: [Which checks fail]
|
|
115
|
+
Fix: [Recommended action]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Final Verdict
|
|
119
|
+
```
|
|
120
|
+
Status: PASS (or PASS WITH WARNINGS or FAIL)
|
|
121
|
+
Implementation Ready: YES (or NO - fix issues first)
|
|
122
|
+
Confidence: [percentage]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Common Anti-Patterns (Domain-Agnostic)
|
|
128
|
+
|
|
129
|
+
### 1. Calculation Events
|
|
130
|
+
```
|
|
131
|
+
ANTI-PATTERN:
|
|
132
|
+
CalculationPerformed {
|
|
133
|
+
metric: 4.5 ← Mutable/recalculated
|
|
134
|
+
timestamp: T
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
CORRECT:
|
|
138
|
+
- Event: SomeActionOccurred (immutable fact)
|
|
139
|
+
- ReadModel: MetricView (recalculated from events)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Why**: Calculations change multiple times as source data changes. Events are immutable.
|
|
143
|
+
|
|
144
|
+
### 2. Shared vs Handler-Owned State
|
|
145
|
+
```
|
|
146
|
+
ANTI-PATTERN:
|
|
147
|
+
One shared "OrderAggregate" class used by all handlers
|
|
148
|
+
- ConfirmOrderHandler shares OrderAggregate state
|
|
149
|
+
- ShipOrderHandler modifies same OrderAggregate
|
|
150
|
+
- Result: Tight coupling, hard to parallelize
|
|
151
|
+
|
|
152
|
+
CORRECT:
|
|
153
|
+
Each handler owns its own [CommandHandler]State class
|
|
154
|
+
- ConfirmOrderState (only ConfirmOrderHandler uses)
|
|
155
|
+
- ShipOrderState (only ShipOrderHandler uses)
|
|
156
|
+
- CancelOrderState (only CancelOrderHandler uses)
|
|
157
|
+
- All reconstruct state from same events, but independently
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Why**: Each handler is a micro-slice. Separate state classes maintain isolation, enable parallel teams, prevent merge conflicts.
|
|
161
|
+
|
|
162
|
+
### 3. Circular Dependencies
|
|
163
|
+
```
|
|
164
|
+
ANTI-PATTERN:
|
|
165
|
+
StreamA → EventA → affects
|
|
166
|
+
StreamB → EventB → affects
|
|
167
|
+
StreamA (circular!)
|
|
168
|
+
|
|
169
|
+
CORRECT:
|
|
170
|
+
StreamA → EventA → Event Bus
|
|
171
|
+
StreamB → EventB → Event Bus
|
|
172
|
+
ReadModels ← consume (one-way only)
|
|
173
|
+
No feedback loops
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Why**: Circular dependencies make the system hard to reason about and test.
|
|
177
|
+
|
|
178
|
+
### 4. Persistent State vs Ephemeral State
|
|
179
|
+
```
|
|
180
|
+
ANTI-PATTERN:
|
|
181
|
+
Treat [CommandHandler]State as persistent entity
|
|
182
|
+
- Save SubmitReviewState to database after command
|
|
183
|
+
- Load it again next time
|
|
184
|
+
- Result: Duplicates event sourcing, loses audit trail
|
|
185
|
+
|
|
186
|
+
CORRECT:
|
|
187
|
+
Reconstruct [CommandHandler]State on-demand
|
|
188
|
+
- Load events from stream
|
|
189
|
+
- Replay via evolve() to rebuild state
|
|
190
|
+
- Process command, emit outcome events
|
|
191
|
+
- Discard state (it's ephemeral, not persisted)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Why**: State is derived from events, never stored. Events are source of truth. This enables consistent replay, audit trails, and time-travel debugging.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Questions to Ask During Validation
|
|
199
|
+
|
|
200
|
+
**For each event stream**:
|
|
201
|
+
1. "Do all events in this stream share the same identity (streamId)?"
|
|
202
|
+
2. "Could these events occur in any order, or is sequence important?"
|
|
203
|
+
3. "Is every event in this stream an immutable fact that actually happened?"
|
|
204
|
+
|
|
205
|
+
**For each command handler**:
|
|
206
|
+
1. "Does this handler own its own [CommandHandler]State class?"
|
|
207
|
+
2. "Is the state ephemeral (reconstructed per command, not persisted)?"
|
|
208
|
+
3. "Can I trace the state reconstruction: events → evolve() → decision?"
|
|
209
|
+
|
|
210
|
+
**For each read model**:
|
|
211
|
+
1. "Is this calculated from events via a projection?"
|
|
212
|
+
2. "Does it answer a specific query need?"
|
|
213
|
+
3. "Could its data change due to new events or state changes?"
|
|
214
|
+
|
|
215
|
+
**For system architecture**:
|
|
216
|
+
1. "Does each command handler operate independently (communicate via events only)?"
|
|
217
|
+
2. "Could I run two handlers' code in parallel without merge conflicts?"
|
|
218
|
+
3. "Are the only shared artifacts the event definitions?"
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Success Criteria
|
|
223
|
+
|
|
224
|
+
**Model is validated when**:
|
|
225
|
+
- All 16 checks pass (or have documented workarounds)
|
|
226
|
+
- No critical anti-patterns identified
|
|
227
|
+
- All 3 final questions answer YES
|
|
228
|
+
- Event sourcing principles clearly upheld
|
|
229
|
+
- Ready to proceed to code generation
|
|
230
|
+
|
|
231
|
+
**Model needs fixes when**:
|
|
232
|
+
- Any check fails with clear evidence
|
|
233
|
+
- Anti-patterns identified with specific violations
|
|
234
|
+
- Final questions have NO answers
|
|
235
|
+
- Fixes are straightforward and targeted
|
|
236
|
+
|
|
237
|
+
**Model should be redesigned when**:
|
|
238
|
+
- Multiple phases fail
|
|
239
|
+
- Architectural assumptions are fundamentally flawed
|
|
240
|
+
- Anti-patterns are systemic and pervasive
|
|
241
|
+
- Would require rewriting core event structure
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Example Validation Patterns
|
|
246
|
+
|
|
247
|
+
### Pattern: Calculation vs Event
|
|
248
|
+
When you see something like "CalculationDone" or "ReviewRatingUpdated":
|
|
249
|
+
- Ask: "Is this immutable and caused by a user/system action?"
|
|
250
|
+
- If NO → It's a read model, not an event
|
|
251
|
+
- Fix: Remove from events, create read model projection instead
|
|
252
|
+
|
|
253
|
+
### Pattern: Shared vs Isolated State
|
|
254
|
+
When you see "ReviewAggregate" used by multiple handlers:
|
|
255
|
+
- Ask: "Could SubmitReviewHandler and ApproveReviewHandler work on separate files?"
|
|
256
|
+
- If NO → State classes aren't properly isolated
|
|
257
|
+
- Fix: Create SubmitReviewState and ApproveReviewState, each handler owns one
|
|
258
|
+
|
|
259
|
+
### Pattern: Persistent vs Ephemeral State
|
|
260
|
+
When state is saved to database after a command:
|
|
261
|
+
- Ask: "Is this state only needed during command processing?"
|
|
262
|
+
- If YES → It's ephemeral, reconstruct from events instead
|
|
263
|
+
- Fix: Load events, replay via evolve(), process command, discard state
|
|
264
|
+
|
|
265
|
+
### Pattern: Data That Doesn't Trace
|
|
266
|
+
When a read model field appears without source:
|
|
267
|
+
- Ask: "Where did this come from?"
|
|
268
|
+
- If no event source → Add event or remove field
|
|
269
|
+
- If sourced from calculation → Verify it's in projection, not event
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Integration with Event Modeling Process
|
|
274
|
+
|
|
275
|
+
**Recommended timing**:
|
|
276
|
+
```
|
|
277
|
+
Step 1: Brainstorm Events
|
|
278
|
+
Step 2: The Plot (Sequence)
|
|
279
|
+
↓
|
|
280
|
+
→ RUN eventmodeling-validating-event-models-checklist (catch structural issues early)
|
|
281
|
+
↓
|
|
282
|
+
Fix any violations
|
|
283
|
+
↓
|
|
284
|
+
Step 3-7: Complete remaining steps
|
|
285
|
+
↓
|
|
286
|
+
→ RUN eventmodeling-validating-event-models-checklist again (final validation)
|
|
287
|
+
↓
|
|
288
|
+
PASS → Code generation
|
|
289
|
+
FAIL → Fix identified issues
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Running the checklist after Step 2 prevents wasting time on later steps if core events are flawed.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Checklist Questions by Domain
|
|
297
|
+
|
|
298
|
+
The skill applies the same 16 checks regardless of domain. Here's how to think about it in different contexts:
|
|
299
|
+
|
|
300
|
+
**E-commerce domain**:
|
|
301
|
+
- Events: OrderCreated, OrderConfirmed, PaymentAuthorized, OrderShipped
|
|
302
|
+
- NOT events: OrderTotal, InventoryLevel, ShippingCost (these are read models)
|
|
303
|
+
|
|
304
|
+
**Banking domain**:
|
|
305
|
+
- Events: AccountOpened, DepositReceived, WithdrawalProcessed, FundsTransferred
|
|
306
|
+
- NOT events: AccountBalance, InterestCalculated (these are read models)
|
|
307
|
+
|
|
308
|
+
**SaaS domain**:
|
|
309
|
+
- Events: SubscriptionCreated, PaymentProcessed, PlanUpgraded, SubscriptionCancelled
|
|
310
|
+
- NOT events: MonthlyRecurringRevenue, ChurnRate (these are read models)
|
|
311
|
+
|
|
312
|
+
**Healthcare domain**:
|
|
313
|
+
- Events: PatientRegistered, AppointmentScheduled, ProcedureCompleted, BillGenerated
|
|
314
|
+
- NOT events: PatientAge, AverageCost (these are read models)
|
|
315
|
+
|
|
316
|
+
The principle is the same across all domains: **immutable facts as events, calculated results as read models**.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Tips for Best Results
|
|
321
|
+
|
|
322
|
+
1. **Be specific**: List actual event names, command handler names, and state classes from your model
|
|
323
|
+
2. **Reference your documentation**: Link to or quote from your step 1-7 documents and micro-slice plans
|
|
324
|
+
3. **Provide context**: Explain what your domain is and how handlers will be parallelized
|
|
325
|
+
4. **Ask follow-ups**: If a check flags an issue, ask "How do I fix this specifically?" or "Can this handler be isolated?"
|
|
326
|
+
5. **Iterate**: Run again after making fixes to confirm all checks pass and handlers are properly isolated
|
|
327
|
+
|
|
328
|
+
## Quality Checklist
|
|
329
|
+
|
|
330
|
+
- [ ] All 16 checks evaluated — no check skipped without documented justification
|
|
331
|
+
- [ ] Every FAIL result includes the specific event, handler, or stream that violated the check
|
|
332
|
+
- [ ] Anti-patterns identified by name with the exact model element that triggered the flag
|
|
333
|
+
- [ ] Final verdict is one of: PASS / PASS WITH WARNINGS / FAIL — no ambiguous outcomes
|
|
334
|
+
- [ ] All 3 final architectural questions answered YES before declaring model ready for implementation
|
|
335
|
+
- [ ] Any FAIL result has a recommended fix, not just a problem statement
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Related Skills
|
|
340
|
+
|
|
341
|
+
- **eventmodeling-orchestrating-event-modeling**: Main skill coordinating the 7-step event modeling process
|
|
342
|
+
- **eventmodeling-brainstorming-events**: Extract events from requirements (Step 1)
|
|
343
|
+
- **eventmodeling-plotting-events**: Sequence events chronologically (Step 2)
|
|
344
|
+
- **eventmodeling-designing-event-models**: Design your complete event model
|
|
345
|
+
- **eventmodeling-validating-event-models**: Detailed validator with deep analysis
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Validation Checklist Reference
|
|
350
|
+
|
|
351
|
+
The 16-point checklist is defined in the **Validation Phases** section above.
|
|
352
|
+
Each check includes the anti-pattern to catch and questions to ask when evaluating your model.
|
|
353
|
+
|