ワンクリックで
rai-story-design
Create lean story spec for human review and AI alignment. Use before story plan.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Create lean story spec for human review and AI alignment. Use before story plan.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | rai-story-design |
| description | Create lean story spec for human review and AI alignment. Use before story plan. |
| allowed-tools | ["Read","Edit","Write","Grep","Glob","Bash(rai:*)"] |
| license | MIT |
| metadata | {"raise.work_cycle":"story","raise.frequency":"per-story","raise.fase":"4","raise.prerequisites":"project-backlog","raise.next":"story-plan","raise.gate":"","raise.adaptable":"true","raise.version":"2.5.0","raise.visibility":"public","raise.output_type":"story-design","raise.inputs":"- story_md: file_path, required, previous_skill\n- scope_md: file_path, optional, previous_skill\n","raise.outputs":"- design_yaml: file_path, .raise/artifacts/\n- design_md: file_path, next_skill\n","raise.aspects":"introspection","raise.introspection":{"phase":"story.design","context_source":"scope doc","affected_modules":[],"max_tier1_queries":3,"max_jit_queries":5,"tier1_queries":["patterns for {affected_modules} design decisions","prior designs for similar scope in {phase}","risks and lessons from related epics"]}} |
Create a lean story specification optimized for both human review (clear intent) and AI alignment (accurate code generation).
When to use: Before planning ANY story. Design is never optional — it is the gemba walk that prevents duplicate components, wasted effort, and wrong approaches.
Inputs: Story from backlog, User Story artifact (story.md from /rai-story-start), epic scope/design documents.
Before starting Step 1, you MUST execute the PRIME protocol:
rai graph query. If graph is unavailable, note and continue.| Criterion | Simple | Moderate | Complex |
|---|---|---|---|
| Components | 1-2 | 3-4 | 5+ |
| Story points | <5 | 5-8 | >8 |
| External integrations | 0-1 | 2-3 | 4+ |
| Algorithm complexity | Trivial | Custom logic | Novel |
| Result | Action |
|---|---|
| Simple | Lean design — core sections, quick gemba walk |
| Moderate | Core sections + examples |
| Complex | Full spec with all sections |
JIT: Before assessing complexity, query graph for patterns from similar stories →
aspects/introspection.md § JIT Protocol
Risk gate: If story is marked HIGH RISK in epic scope, discuss risks before designing — name concerns, failure modes, and scope boundaries.
UX gate: If story touches human interaction (workflows, prompts, DX), recommend /rai-research first (~10 min).
Integration gate: If story name includes "dogfood", "E2E", or "integration", OR if epic has separate client/server stories developed with mocks — AC MUST include at least one scenario that runs with real infrastructure (docker compose, actual DB, real HTTP calls). Unit tests with mocks cannot catch cross-component contract mismatches (auth headers, payload validation, parameter limits).
Complexity assessed. Risk/UX/Integration gates evaluated.Go to the actual code. Design without reading the code is guessing.
# Example gemba commands
grep -r "similar_function" packages/ # Does this already exist?
grep -r "class SimilarModel" packages/ # Duplicate models?
| Finding | Action |
|---|---|
| Similar component exists | Reuse or extend it — do NOT create a duplicate |
| No established pattern | Document the new pattern as a design decision |
| Multiple approaches found | List them in Step 4 with trade-offs |
Load story.md (from /rai-story-start) if it exists — use its User Story as starting frame.
JIT: Before framing problem and value, query graph for prior designs with similar scope →
aspects/introspection.md § JIT Protocol
JIT: Before describing approach, query graph for implementation patterns in affected modules →
aspects/introspection.md § JIT Protocol
Document WHAT you're building and WHY this approach (not detailed HOW):
Lean design gates — challenge every component before committing:
For refactoring: grep all call sites of the target. A half-migration is worse than none.
For data mutations: What happens when inputs reference missing entities? Declare the strategy explicitly: reject with error, skip + report count, partial success with warnings. Silent drops are semantic bugs.
Value preservation gate: Before finalizing components, ask: "What domain knowledge does this layer provide that a generic pass-through wouldn't?" If the answer is "none", the design may be over-abstracted. If the answer involves config/resolution/mapping that an existing pattern handles differently, check where that responsibility lives in the proven pattern.
For complex stories, add: scenarios (Gherkin), algorithm pseudocode, constraints, testing strategy.
Approach is concrete enough to envision examples. Value preservation gate passed.This section drives AI code generation accuracy more than any other.
Provide concrete, runnable examples:
Use concrete values (not placeholders), correct syntax (not pseudocode), consistent with codebase style.
Examples are concrete, runnable, and cover success + error paths. Can't envision examples → approach not concrete enough, return to Step 3.JIT: Before defining acceptance criteria, query graph for testing patterns and quality standards →
aspects/introspection.md § JIT Protocol
If story.md has Gherkin AC, reference them here — refine, don't duplicate. If no story.md, define from scratch:
All criteria must be observable outcomes traceable to value from Step 2.
Criteria are specific, testable, and traceable. Spec reviewable in <5 minutes.After completing all steps, produce the design in two locations:
Write a YAML artifact to .raise/artifacts/s{N}.{M}-design.yaml with this structure:
artifact_type: story-design
version: 1
skill: rai-story-design
created: '{ISO 8601 timestamp}'
story: 'S{N}.{M}'
epic: 'E{N}'
content:
summary: '{Problem + Value in 1-2 sentences}'
complexity: simple|moderate|complex
acceptance_criteria:
- id: AC1
description: '{criterion text}'
verifiable: true
integration_points:
- module: '{dotted.module.path}'
change_type: new|modification|deletion
files: ['{relative/path.py}']
decisions:
- id: D1
choice: '{what was chosen}'
rationale: '{why}'
alternatives_considered: ['{alt1}', '{alt2}']
refs:
backlog_item: '{RAISE-NNN}'
epic_scope: 'work/epics/e{N}-{name}/scope.md'
metadata: {}
Write the design as work/epics/e{N}-{name}/stories/s{N}.{M}-design.md — colocated with other story artifacts (story.md, scope.md, plan.md, retrospective.md).
| Item | Destination |
|---|---|
| Typed artifact | .raise/artifacts/s{N}.{M}-design.yaml |
| Design document | work/epics/e{N}-{name}/stories/s{N}.{M}-design.md |
| Next | /rai-story-plan |
/rai-story-plan/rai-research before UX storiesInteractive adapter setup for Jira and Confluence. Detects available backends, discovers projects/spaces, generates validated YAML config. 3-4 questions max.
Evaluate design proportionality using Beck's four rules. Use after implementation.
Root cause analysis using the method best suited to the bug. Phase 3 of bugfix pipeline.
Push branch, create MR, verify artifacts complete. Phase 7 of bugfix pipeline.
Execute fix tasks with TDD and all validation gates. Phase 5 of bugfix pipeline.
Decompose fix into atomic TDD tasks. Phase 4 of bugfix pipeline.