Story Pipeline — Planning, Generation & Sprint Management
Unified workflow from feature idea to ready-to-implement stories. Replaces user-story-generator, story-validator, sprint-planner, and technical-annotator.
TDD note: Do NOT use
/story tests. Use/implementationdirectly — it has TDD built-in and generates tests from acceptance criteria with full codebase context./story testsis archived: it produces generic stubs that conflict with implementation-generated tests.
Usage
/story # Auto-detect project, suggest next action
/story create # Feature description -> INVEST-compliant user stories
/story create --epic # Feature too large for stories -> create EP-XXXX epic
/story create --prd # Feature description -> PRD (aggregated stories)
/story decompose <EP-XXXX> # Decompose an epic into child US-XXXX stories
/story prp <story-ids> # Generate PRP from stories (invokes /prp-generator)
/story plan # Sprint/milestone planning from backlog
/story update # Create new stories from change request
/story sync # Push stories/epics to GitHub issues via gh CLI
Language
Always write in English. All story/epic YAML content, GitHub issue titles and bodies, acceptance criteria, and documentation must be in English. No exceptions — do not detect or adapt to project language.
Epic vs Story — quando usare quale
Usa --epic quando... |
Usa create (storia) quando... |
|---|---|
| La feature richiede >3 storie figlie | La feature si implementa in 1-2 sessioni |
| Stima > 8 story points | Stima ≤ 8 story points |
| Coinvolge nuovo modello dati + UI + notifiche | Tocca un'area già strutturata |
| È un deliverable di bando o milestone | È un task di refinement |
Regola pratica: se mentre scrivi le acceptance criteria ti vengono 6+ punti, è un'epica.
Workflow
Step 1: Determine Mode
Parse $ARGUMENTS for explicit subcommand. If no arguments, detect project context:
PROJECT_INFO=$(bash "$HOME/.claude/skills/story/lib/project-detector.sh")
With no arguments:
- If project has story YAML files -> show backlog summary, suggest validate/plan/implementation
- If project has PRPs but no stories -> suggest
/story createfor next PRP - If new project -> suggest
/story createto start
Step 2: Route to Subcommand
Subcommand: create
Interactive feature-to-stories workflow.
Phase 0: Epic check (NUOVO)
Prima di generare storie, valuta se la feature è troppo grande:
- Stimi >8 punti totali? →
--epicobbligatorio - Richiede >3 sotto-funzionalità distinte? →
--epicobbligatorio - Nuovo modello dati + UI + notifiche + auth? → quasi certamente
--epic
Se l'utente non ha passato --epic ma la feature lo richiede, proponi di creare un'epica invece. Non generare storie impossibili da stimare.
Phase 1: Feature Extraction
Ask the user these questions in English. Skip if answers are obvious from context.
- What does this feature do? (one sentence)
- Who benefits? (persona: operator, fatturatore, client-pmi, employee-pmi, admin…)
- Why does it matter? (business value, pain it resolves)
- What does success look like? (measurable outcome)
- What constraints exist? (technical, time, dependencies on existing system)
Always add: Current system state (AS-IS) — what already exists, what is missing. Without this, context is insufficient for implementation.
Phase 1b: Epic Mode (--epic)
Quando --epic è passato, genera un'epica EP-XXXX invece di storie:
- Leggi
templates/epic-yaml.mdper lo schema - Incrementa
.epic_counter(separato da.story_counter) - Compila obbligatoriamente:
context,problem,personas,goal,success_metrics,current_state,sub_stories,technical_dependencies - Il campo
sub_storiesè una lista di titoli delle storie figlie — verranno create da/story decompose - File:
stories/yaml-source/EP-XXXX.yaml - GitHub issue body: includi il blocco
> Questa è un'epica — va decomposta prima dell'implementazionein cima, poi tutte le sezioni in italiano con sub_stories come checklist
Phase 2: Story Decomposition
From the feature, generate 2-6 user stories following INVEST criteria:
- Each story gets an ID:
US-XXXX(increment from.story_counterin project root, create if absent) - Format: Read
templates/story-yaml.mdfor the YAML schema - Each story MUST have at least 2 acceptance criteria in Given/When/Then format
- Story points: Fibonacci (1, 2, 3, 5, 8). If >8, split the story
- Include
contextfield with: da dove viene questa storia (epica parent, bando, discovery), riferimenti a documenti, stato AS-IS del sistema. Senza contesto il YAML è inutile. - Se la storia ha un'epica parent, imposta
parent_epic: EP-XXXXe aggiornachild_storiesnell'epica
Phase 3: Quick Validation
For each generated story, check INVEST inline (no external scripts):
| Criterion | Pass if... |
|---|---|
| Independent | No circular deps, minimal blocking |
| Negotiable | Describes outcome, not implementation |
| Valuable | Has clear "so that" benefit |
| Estimable | Has story points + acceptance criteria |
| Small | <=8 points |
| Testable | Has Given/When/Then criteria |
Fix any failures before presenting to user.
Phase 4: Write Story Files
- YAML source:
stories/yaml-source/US-XXXX.yaml - Markdown doc:
stories/generated-docs/US-XXXX.md
Create stories/ directories if they don't exist in the project.
Phase 5: Present Summary
Show table of generated stories with: ID, title, points, persona, acceptance criteria count. Ask user to approve, modify, or regenerate.
PRD Mode (--prd)
When --prd flag is present, wrap stories into a Product Requirements Document:
- Read
templates/prd.mdfor the PRD format - PRD aggregates related stories into a product-level document
- Includes: executive summary, user personas, story map, success metrics, timeline
- Save to:
docs/development/prds/PRD-XXXX.md
Subcommand: decompose
Decompone un'epica EP-XXXX nelle sue storie figlie US-XXXX.
Process
- Leggi
stories/yaml-source/EP-XXXX.yaml(ID passato come argomento) - Per ogni voce in
sub_stories, genera una storia US-XXXX:- Imposta
parent_epic: EP-XXXX - Imposta
blocked_byin base alle dipendenze logiche tra le storie figlie - Copia
contextdall'epica e aggiungi la specifica della singola storia - Compila
acceptance_criteria(Given/When/Then) specifici per questa storia - Stima
story_points(Fibonacci 1-8)
- Imposta
- Scrivi i file
stories/yaml-source/US-XXXX.yaml - Aggiorna il campo
child_storiesnell'epica con i nuovi ID - Aggiorna il campo
statusdell'epica adecomposed - Presenta la tabella delle storie figlie generate con ID, titolo, punti, dipendenze
- Chiedi conferma prima di creare le GitHub issue
- Dopo aver creato le issue figlie, chiudi l'issue epica su GitHub:
Rationale: l'epica è un contenitore di planning, non un work item. Una volta decomposta, il lavoro reale vive nelle storie figlie. L'issue epica rimane visibile (non cancellata) con il commento che linka le figlie.gh issue comment <epic_issue_number> --body "Decomposed into: US-XXXX #NNN, US-XXXX #NNN, ..." gh issue close <epic_issue_number> --reason "not planned"
GitHub issue per storie figlie
Usa il titolo formato: [MILESTONE|NN] [PP] US-XXXX feat: titolo
Nel body: includi link all'epica parent (Part of EP-XXXX #NNN) e i criteri Given/When/Then.
Subcommand: prp
Bridge stories to PRP generation.
Process
- Load story YAML files from
$ARGUMENTS - Read
templates/prp-bridge.mdfor mapping rules - Compose PRP input:
- Stories -> Requirements section (acceptance criteria become requirements)
- Story points -> Complexity assessment
- Personas -> User context
- Dependencies -> Architecture constraints
- Invoke
/prp-generatorskill with composed input - PRP saved to project's PRP directory (detected by project-detector.sh)
Subcommand: plan
Sprint/milestone planning from story backlog.
Process
- Scan
stories/yaml-source/for stories with status:backlogorready - Show eligible stories sorted by priority (critical > high > medium > low), then by points
- Ask for sprint parameters:
- Capacity (story points, default: 40)
- Duration (default: 2 weeks)
- Buffer % (default: 20%)
- Greedy-fit stories into capacity (priority order, skip if story exceeds remaining)
- Check dependency constraints (blocked_by must be in same or earlier sprint)
- Present sprint plan using
templates/sprint-report.mdformat - On approval:
- Update story YAML status ->
sprint: "Sprint YYYY-NN" - Optionally create GitHub milestone via
gh api
- Update story YAML status ->
Subcommand: update
Create new stories from a change request or user feedback.
Process
- Ask user: what changed? (new requirement, bug found, scope change, feedback)
- Load existing stories from
stories/yaml-source/ - Generate new stories or modify existing ones
- Validate INVEST inline
- Write updated YAML + Markdown
Subcommand: sync
Push stories and epics to GitHub issues.
Process
- Load all YAML files from
stories/yaml-source/(both EP-XXXX and US-XXXX) - For each file without
github_issue:- Epic:
gh issue create --title "[MILESTONE|NN] [P0] EP-XXXX epica: titolo" --body <body con header epica + sub_stories checklist> - Story:
gh issue create --title "[MILESTONE|NN] [PP] US-XXXX feat: titolo" --body <body con AC Given/When/Then + link parent epic>
- Epic:
- Update YAML with
github_issue: <number> - For files with existing issues, update body if content changed
- For stories with
parent_epic: add comment linking to parent issue
Template Locations
| Template | Purpose | File |
|---|---|---|
| Epic YAML format | Schema per file epica EP-XXXX | templates/epic-yaml.md |
| Story YAML format | Schema per file storia US-XXXX | templates/story-yaml.md |
| PRP bridge | Story -> PRP section mapping | templates/prp-bridge.md |
| PRD format | Product requirements document | templates/prd.md |
| Sprint report | Sprint plan output | templates/sprint-report.md |
| GitHub issue | Issue body template | templates/github-issue.md |
| GitHub issue | Issue body template | templates/github-issue.md |
Progressive Disclosure
- Start lean — show story summaries, not full YAML dumps
- Read templates on demand — use Read tool, don't memorize content
- User drives depth — "show details", "show YAML", "show criteria" trigger deeper output
- One subcommand at a time — don't chain create+tests+prp unless user asks for full pipeline