Design event model workflows - brainstorm, document, and generate GWT scenarios
Designs event model workflows using event sourcing methodology. Guides brainstorming, documents workflows, and generates GWT scenarios for event-sourced applications. Use when designing new workflows or converting existing processes to event-driven architecture.
/plugin marketplace add jwilger/claude-code-setup/plugin install sdlc@jwilger-claude-pluginsworkflow-nameDesign event model workflows following Martin Dilger's "Understanding Eventsourcing" methodology. This command:
$ARGUMENTS may contain:
<workflow-name> - Design a specific workflowgwt <workflow-name> - Generate GWT scenarios for a workflowvalidate - Validate the complete event modelVerify mode is event-modeling in .claude/sdlc.yaml.
If mode is traditional, inform user:
This project is configured for traditional development.
Event modeling design is for event-sourced applications.
To switch modes, edit .claude/sdlc.yaml or run /sdlc:setup again.
Check if event model docs exist:
ls docs/event_model/workflows/ 2>/dev/null
If not, ask if user wants to create the structure:
mkdir -p docs/event_model/{workflows,scenarios}
Create template files:
docs/event_model/workflows/_template.mddocs/event_model/scenarios/_template.mdmcp__memento__semantic_search: "event model [project-name]"
Load any existing event modeling decisions or patterns.
Based on arguments:
Use the sdlc-event-model agent:
Task tool with subagent_type="sdlc-event-model":
Design the workflow: <workflow-name or "new workflow">
Guide the user through:
1. Identifying the user goal/problem
2. Brainstorming events (what facts get recorded)
3. Identifying commands (what triggers events)
4. Designing read models (what views are needed)
5. Identifying automations (event → process → command)
6. Mapping external integrations (translations)
Document the workflow in docs/event_model/workflows/<name>.md
Remember: Search memento for context, store discoveries.
gwt <workflow> → Generate ScenariosUse the sdlc-gwt agent:
Task tool with subagent_type="sdlc-gwt":
Generate Given/When/Then scenarios for workflow: <workflow-name>
Read the workflow from docs/event_model/workflows/<name>.md
For each vertical slice in the workflow:
1. Identify the user action (When)
2. Determine required preconditions (Given)
3. Specify expected outcomes (Then)
Include:
- Happy path scenarios
- Edge cases and error conditions
- Validation failures
Write scenarios to docs/event_model/scenarios/<workflow>/<slice>.md
Remember: GWT scenarios ARE acceptance criteria for stories.
validate → Validate ModelUse the sdlc-model-validator agent (or inline validation):
Task tool with subagent_type="sdlc-event-model":
Validate the event model in docs/event_model/
Check for:
1. Information completeness - every read model attribute traces to an event
2. Event naming - past tense, business language
3. Command coverage - all events have triggering commands
4. Read model coverage - all queries have read models
5. Automation loops - no infinite event chains
6. Translation coverage - external data has anti-corruption layers
Report any gaps or issues found.
After design work, store key decisions:
mcp__memento__create_entities:
name: "<Workflow-Name> Event Model [date]"
entityType: "event_model"
observations:
- "Project: <name> | Path: <path> | Scope: PROJECT_SPECIFIC"
- "Events: <list of events>"
- "Commands: <list of commands>"
- "Key decisions: <any notable design choices>"
After workflow design:
Workflow designed: <name>
Events:
- UserRegistered
- EmailVerified
- PasswordChanged
Commands:
- RegisterUser
- VerifyEmail
- ChangePassword
Read Models:
- UserProfile
- AuthenticationStatus
Next steps:
- /sdlc:design gwt <name> - Generate GWT scenarios
- /sdlc:design validate - Validate complete model
- /plan review <name> - Three-perspective story review
Always enforce these event sourcing patterns:
Events must be:
Good: OrderPlaced, PaymentReceived, InventoryReserved
Bad: PlaceOrder, ProcessPayment, ReserveInventory