$npx -y skills add MageByte-Zero/spec-superflow --skill spec-writerCreate or refine spec-superflow planning artifacts. Invoke when the change is understood well enough to write proposal.md, specs/, design.md, and tasks.md.
| 1 | # Spec Writer |
| 2 | |
| 3 | Create or refine planning artifacts when the change has moved beyond exploration. |
| 4 | |
| 5 | ## Required Inputs |
| 6 | |
| 7 | Read `.spec-superflow.yaml` (especially `dp_0_decisions`, `dp_0_confirmed`) and any existing planning artifacts. If `dp_0_confirmed` is not `true`, stop and route back to `workflow-start` for DP-0. |
| 8 | |
| 9 | ## Config Check |
| 10 | |
| 11 | Run: `npx --yes --package spec-superflow@0.11.0 ssf runtime config --get artifacts.order` — generate in configured order (default: proposal → specs → design → tasks). Run with `artifacts.skip` — skip any listed artifacts. |
| 12 | |
| 13 | ## Artifact Roles |
| 14 | |
| 15 | - `proposal.md`: why and scope |
| 16 | - `specs/`: required behavior (testable) |
| 17 | - `design.md`: architecture decisions and trade-offs (not line-by-line) |
| 18 | - `tasks.md`: dependency-aware implementation steps |
| 19 | |
| 20 | ## Working Rules |
| 21 | |
| 22 | **Honor DP-0**: Read `dp_0_decisions`, respect confirmed constraints, don't silently expand scope. Pause on unconfirmed decisions. |
| 23 | |
| 24 | ### proposal.md |
| 25 | Must state: problem, what changes, capabilities affected, impact areas. |
| 26 | |
| 27 | ### specs/ |
| 28 | Every requirement must be testable. Use SHALL or MUST. Every requirement must have at least one `#### Scenario:` with WHEN/THEN. Group under ADDED/MODIFIED/REMOVED Requirements headers. |
| 29 | |
| 30 | ### design.md |
| 31 | Must have: Context (current state, constraints, stakeholders), Goals, Decisions (Choice + Rationale + Alternatives considered), Risks And Trade-Offs. |
| 32 | |
| 33 | ### tasks.md |
| 34 | Must include: |
| 35 | - **File Structure**: all files with one-sentence responsibility (Create/Modify) |
| 36 | - **Interfaces**: cross-batch Consumes/Produces with exact types |
| 37 | - **Per-task**: exact file paths, expanded TDD phases (5 steps), Interfaces block |
| 38 | - **Granularity**: each step 2-5 min, atomic |
| 39 | - **Zero placeholders**: no TBD, TODO, "figure out", "add appropriate" |
| 40 | - **Dependency ordering**: depends only on prior tasks, explicit "Depends on: Batch N" |
| 41 | |
| 42 | ## Artifact Generation |
| 43 | |
| 44 | Generate one at a time. Confirm each before next. This prevents scope drift — if proposal has errors, downstream artifacts are wrong. |
| 45 | |
| 46 | 1. `proposal.md` → present summary → wait for confirm |
| 47 | 2. `specs/` → present requirement list → wait for confirm |
| 48 | 3. `design.md` → present key decisions → wait for confirm |
| 49 | 4. `tasks.md` → present batch breakdown → wait for confirm |
| 50 | |
| 51 | ## Validation Checklist |
| 52 | |
| 53 | ### proposal.md |
| 54 | - `## Why` > 50 chars, `## What Changes`, `## Scope` (In/Out), `## Impact`, `## Capabilities`, no TBD/TODO |
| 55 | |
| 56 | ### specs/ |
| 57 | - SHALL/MUST for required behavior, `#### Scenario:` with WHEN/THEN per requirement, grouped under delta headers, no contradictions |
| 58 | |
| 59 | ### design.md |
| 60 | - `## Context`, `## Goals`, `## Decisions` (≥1, with Choice+Rationale+Alternatives), `## Risks And Trade-Offs` |
| 61 | |
| 62 | ### tasks.md |
| 63 | - `## File Structure`, `## Interfaces`, numbered tasks, exact file paths, TDD phases, ≤5 min steps, no placeholders, every requirement mapped, explicit dependencies |
| 64 | |
| 65 | **If any artifact fails validation, fix before handing off to contract-builder.** |
| 66 | |
| 67 | ## DP-2: Artifact Review Gate |
| 68 | |
| 69 | Present summary of all 4 artifacts (2-3 sentences each). Ask user for adjustments. After approval: |
| 70 | ```bash |
| 71 | npx --yes --package spec-superflow@0.11.0 ssf state set <change-dir> dp_2_result "approved: <summary>" |
| 72 | npx --yes --package spec-superflow@0.11.0 ssf state set <change-dir> dp_2_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ) |
| 73 | ``` |
| 74 | |
| 75 | ## Handoff Rule |
| 76 | |
| 77 | Do not start implementation after writing planning artifacts. Once stable, validated, and DP-2 is recorded, hand off to `contract-builder`. |
| 78 | |
| 79 | ## Exception Handling |
| 80 | |
| 81 | - **Parse failures**: Report specific file/error; don't generate from corrupted templates |
| 82 | - **Missing templates**: Fall back to artifact structure defined in this skill |
| 83 | - **User interruption**: Artifacts on disk are the recovery checkpoint; resume from first missing/incomplete one |
| 84 | - **Validation failure**: Fix before handoff — do not hand off broken artifacts |