| name | eventmodeling-validating-event-models |
| 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). |
| allowed-tools | ["Write","Bash"] |
Validating Event Models
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.
For validation you treat the Event Model as read only. The only thing you are allowed to change is comments.
For critical questions, add comments to elements.
For every field in the command, it must be clear where it is coming from.
Either it´s defined in a transitively connected Read Model, or it is marked as "generated" in either a screen or an automation.
There should not be any fields without a defined source.
The source can be also determined by looking at the defined Scenarios. Are all Scenarios covered?
Board Context
Before starting, read the current board state to validate what is actually on the board:
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=EVENT"
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=COMMAND"
curl -s -H "x-token: $TOKEN" -H "x-board-id: $BOARD_ID" \
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=READMODEL"
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.
Purpose
Ensures event-sourced models are complete, correct, and follow pure event sourcing principles (minimal per-command state).
Workflow
When given an event model, perform comprehensive validation:
1. Swimlane Completeness Check
Verify each swimlane has:
- Clear name (identity)
- At least one event type
- Initial event (what creates the stream)
- State transitions documented
For each event:
- Uses past tense (Created, Confirmed, etc.)
- Contains only facts (no computed fields)
- All data is immutable
- Unique semantics (no duplicates)
For each state projection:
- Can be deterministically rebuilt from events
- Replay logic is pure (no side effects)
For each command:
- Clear input parameters
- Validation rules defined in scenarios (against state)
- Resulting events specified (or rejection reason)
- Pure logic (no side effects except event appending)
2. Consistency Checks
3. Event Sourcing Principles Compliance
Check against event sourcing fundamentals:
4. Event Flow Validation
5. Role & Actor Attribution Validation
Verify that every command has explicit actor attribution from the Role Catalog:
6. Command State Read Models Validation (CRITICAL)
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.
7. Command & State Validation
Draft → Confirmed (ConfirmOrder)
Draft → Cancelled (CancelOrder)
Confirmed → Shipped (ShipOrder)
Confirmed ↛ Draft (invalid)
8. Projection Validation
9. Issues & Recommendations Report
Format findings as comments:
## Validation Summary
**Overall Status**: Ready with recommendations
**Blockers for Implementation**: 0 critical issues
**Recommended Fixes**:
1. Add missing OrderCancelled event
2. Move PaymentMethod to its own minimal state projection
3. Document all implicit invariants explicitly
**Ready for Code Generation**: Yes, after implementing recommendations
## Next Steps
1. Review recommendations with domain expert
2. Update model with critical fixes
3. Proceed to code generation
Common Issues to Flag
| Issue | Pattern | Fix |
|---|
| Missing cancellation flows | No "Cancelled" events | Add compensation paths |
| Implicit invariants | "Obviously can't do X" | Make invariants explicit |
| Command state too broad | Shared state used by 2+ commands | Split into per-command minimal state projections |
| Orphaned events | Events no one listens to | Link to projections or commands |
| No read models | Commands reading query/read models for validation | Add separate query read models; keep command state minimal |
| Circular dependencies | Projection A depends on B, B on A | Redesign stream boundaries |
Key Principles for Event Sourcing
- Events are the source of truth: Everything else is derived from them
- Immutable event log: Events never change, only appended
- State is a projection: Current state is built by replaying events
- Commands are pure decisions: Validate against state, produce events or reject
- Projections are optional: Can be rebuilt at any time
- Stream per entity: Each entity has one append-only event stream
Success Criteria
Your event model validation is successful when:
- All requirements are captured in events
- Commands clearly trigger events
- Stream roots have clear, minimal boundaries
- Business rules are explicit invariants (not hidden assumptions)
- Read models serve actual query needs (not used by commands)
- Command state is minimal and command-specific (not shared across multiple commands)
- Events are immutable facts (past tense, no computed fields)
- State can be deterministically rebuilt from events
- All command-to-event mappings are documented
- Critical issues are resolved or documented as known limitations
A model is ready for code generation if:
- No critical issues remain
- All command state follows naming convention (e.g.,
[CommandName]State)
- No state is shared between different commands
- All events are immutable facts
- All business rules are explicit
- A Role Catalog exists with all human roles and system actors
- Every command has explicit actor attribution from the Role Catalog
Quality Checklist