From codebrain
Use after /codebrain:prd to enumerate ALL user paths through a feature — happy paths, sad paths, edge cases, and error states. Uses state machine modeling to make impossible states impossible. Generates Mermaid diagrams. Runs a pre-mortem to catch failure modes before coding. The MVP hell killer.
npx claudepluginhub chrsmay/codebrain-plugin --plugin codebrainThis skill uses the workspace's default tool permissions.
Systematic user journey enumeration and edge case discovery. The phase that prevents "it works in the demo but breaks in production."
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Systematic user journey enumeration and edge case discovery. The phase that prevents "it works in the demo but breaks in production."
/codebrain:map-journeys [epic-slug or PRD path]
Prototypes handle the happy path. Production handles EVERY path. The gap between these is why MVPs stay as MVPs. This skill forces you to enumerate every state, transition, and error BEFORE writing code — when fixing is cheap (change a spec) vs expensive (refactor code).
.codebrain/epics/{slug}/prd.md or provided path)..codebrain/memory/constitution.md for principles.For each user story, trace the ideal flow:
## Happy Path: [User Story Title]
**Entry:** [How the user arrives — URL, button click, API call]
**Steps:**
1. User [action]
2. System [response]
3. User [action]
4. System [response]
**Exit:** [What state the user is in when done]
**Data changed:** [What was created/updated/deleted]
Generate a Mermaid sequence diagram for each:
sequenceDiagram
User->>System: [action]
System->>User: [response]
For each happy path step, ask: "What if this goes wrong?"
Common sad paths to check:
For each sad path:
## Sad Path: [Description]
**Trigger:** [What goes wrong]
**Current behavior:** [What happens now — probably nothing or a crash]
**Expected behavior:** [What SHOULD happen]
**User sees:** [Error message, redirect, or recovery flow]
**System state:** [What happens to data — rolled back? Partially saved?]
Convert the feature into a finite state machine:
## State Machine: [Feature Name]
### States
| State | Description | Valid Transitions |
|-------|-------------|-------------------|
| IDLE | No action in progress | → LOADING |
| LOADING | Fetching data | → SUCCESS, → ERROR, → TIMEOUT |
| SUCCESS | Data loaded | → IDLE, → EDITING |
| ERROR | Operation failed | → IDLE (retry), → ERROR_DETAIL |
| EMPTY | No data exists | → CREATING |
| EDITING | User modifying data | → SAVING, → IDLE (cancel) |
| SAVING | Write in progress | → SUCCESS, → ERROR |
| TIMEOUT | Operation timed out | → IDLE (retry) |
### Impossible States (structurally prevented)
- Cannot be LOADING and ERROR simultaneously
- Cannot be SAVING without prior EDITING
- Cannot transition from SUCCESS to ERROR without going through IDLE first
Generate a Mermaid state diagram:
stateDiagram-v2
[*] --> IDLE
IDLE --> LOADING : fetch
LOADING --> SUCCESS : data received
LOADING --> ERROR : request failed
LOADING --> TIMEOUT : no response
SUCCESS --> EDITING : user clicks edit
EDITING --> SAVING : user clicks save
SAVING --> SUCCESS : save complete
SAVING --> ERROR : save failed
ERROR --> IDLE : retry
TIMEOUT --> IDLE : retry
Systematically check these categories:
Data Edge Cases:
Timing Edge Cases:
Environment Edge Cases:
Business Logic Edge Cases:
For each edge case found, note the handling strategy: prevent (make it impossible), handle (show appropriate UI), or accept (document as known limitation).
Assume the feature has ALREADY failed in production. Work backward:
Document each failure scenario and its prevention strategy.
# User Journey Map: [Feature Name]
**PRD:** [link to PRD]
**Date:** [today]
## Happy Paths
[Mermaid diagrams + step-by-step flows]
## Sad Paths
[Error scenarios with expected handling]
## State Machine
[State diagram + transition table + impossible states]
## Edge Case Inventory
[Categorized checklist with handling strategy for each]
## Pre-Mortem Results
[Failure scenarios and prevention strategies]
## Coverage Summary
| Category | Total Found | Handled | Accepted | Needs Decision |
|----------|-------------|---------|----------|----------------|
| Happy paths | N | N | 0 | 0 |
| Sad paths | N | N | N | N |
| Edge cases | N | N | N | N |
| Pre-mortem | N | N | N | N |
.codebrain/epics/{slug}/journeys.md via MCP tools[NEEDS CLARIFICATION] markers/codebrain:epic create (tickets will incorporate edge case handling from this document)If Linear MCP is available: