| name | rai-story-plan |
| description | Decompose story into atomic tasks with TDD verification. Use after story design. |
| allowed-tools | ["Read","Grep","Glob","Bash(rai:*)"] |
| license | MIT |
| metadata | {"raise.work_cycle":"story","raise.frequency":"per-story","raise.fase":"5","raise.prerequisites":"project-backlog","raise.next":"story-implement","raise.gate":"gate-plan","raise.adaptable":"true","raise.version":"2.3.0","raise.visibility":"public","raise.inputs":"- design_md: file_path, optional, previous_skill\n- story_md: file_path, required, story-start\n","raise.outputs":"- plan_md: file_path, next_skill\n","raise.aspects":"introspection","raise.introspection":{"phase":"story.plan","context_source":"design doc","affected_modules":[],"max_tier1_queries":3,"max_jit_queries":2,"tier1_queries":["decomposition patterns for {complexity} stories","TDD patterns for {affected_modules}","estimation calibration for {size} stories"]}} |
Story Plan
Purpose
Decompose a story into atomic executable tasks with dependencies, verification criteria, and a deterministic execution order.
Mastery Levels (ShuHaRi)
- Shu: Decompose each story into atomic tasks with full verification criteria
- Ha: Adjust granularity based on complexity, parallelize when possible
- Ri: Custom planning patterns for specific stacks
Context
When to use: After /rai-story-design has grounded integration decisions (or directly for simple stories).
Prerequisite: Design document at work/epics/e{N}-{name}/stories/s{N}.{M}-design.md (optional for simple stories).
Inputs: Story with acceptance criteria, design document (if exists).
Steps
PRIME (mandatory — do not skip)
Before starting Step 1, you MUST execute the PRIME protocol:
- Chain read: Read story-design's learning record at
.raise/rai/learnings/rai-story-design/{work_id}/record.yaml. Enrich story-design's record with downstream: {plan_derivable: bool, tasks_clear: bool}.
- Graph query: Execute tier1 queries from this skill's metadata using
rai graph query. If graph is unavailable, note and continue.
- Present: Surface retrieved patterns as context. 0 results is valid — not a failure.
Step 1: Verify Design
ls work/epics/e*/stories/{story_id}-design.md 2>/dev/null || echo "INFO: No design"
JIT: Before verifying design completeness, query graph for complexity assessment patterns
→ aspects/introspection.md § JIT Protocol
| Condition | Action |
|---|
| Design exists | Load and reference |
| No design + simple story | Continue |
| No design + complex story | Run /rai-story-design first |
Design loaded or simple story confirmed.
Step 2: Decompose into Tasks
Divide story into atomic, individually verifiable tasks. One commit per task.
| Story Size | Tasks | Rationale |
|---|
| XS (1-2 SP) | 1-2 | Single-pass implementation |
| S (3-5 SP) | 2-3 | Avoid over-decomposition |
| M (5-8 SP) | 3-5 | Balance granularity and overhead |
| L (8+ SP) | 5-8 | Consider splitting the story |
Per task:
- Description, files to create/modify
- TDD cycle: RED (failing test) → GREEN (minimal code) → REFACTOR
- AC reference: link to
story.md Gherkin scenario (if exists)
- Verification commands: use the project-wide command from
.raise/manifest.yaml (test_command, lint_command, type_check_command). Never use file-specific paths (e.g. pyright src/module/file.py) — the project config already defines the correct scope including tests/. If manifest commands are absent, use language defaults (see /rai-story-implement Step 3).
- Size (XS/S/M/L) and dependencies
Always include as final task: Manual integration test — validate end-to-end with running software.
Each task is atomic and verifiable. Final integration test included.
Step 3: Order & Dependencies
JIT: Before ordering dependencies, query graph for risk-first ordering patterns
→ aspects/introspection.md § JIT Protocol
- Map dependencies (sequential vs parallel)
- Apply risk-first ordering (riskiest tasks early)
- Maximize parallelism where no mutual dependencies exist
- Verify no circular dependencies
Execution order defined. Dependency graph is acyclic.
Step 4: Document Plan
Create work/epics/e{N}-{name}/stories/s{N}.{M}-plan.md with:
- Overview (story ID, size, date)
- Ordered task list with descriptions, files, verification, sizes, dependencies
- Execution order with rationale
- Risks and mitigations
- Duration tracking table (filled during implementation)
Plan document complete and reviewable in <5 minutes.
Output
| Item | Destination |
|---|
| Implementation plan | work/epics/e{N}-{name}/stories/s{N}.{M}-plan.md |
| Next | /rai-story-implement |
Quality Checklist
References
- Gate:
gates/gate-plan.md
- Previous:
/rai-story-design
- Next:
/rai-story-implement