--- name: spec-workflow description: Use when creating a feature, creating a spec, implementing a spec, starting a new work item, or any task involving the spec-driven development pipeline. Provides pipeline ordering and superpowers override rules. metadata: sdd-kind: reference --- # SDD Workflow Reference Pipeline map for Spec-Driven Development. This skill is a reference — it documents ordering and override rules but does not orchestrate. ## Feature Pipeline | Step | Skill | Output | Next | |------|-------|--------|------| | 1 | `sdd:spec-discovery` | `discovery.md` in the work item, after user approval | `sdd:spec-generator` | | 2 | `sdd:spec-generator` Phase 1 | `requirements.md` | Phase 2 | | 3 | `sdd:spec-generator` Phase 2 | `design.md` | `sdd:spec-design-review` | | 4 | `sdd:spec-design-review` (gate) | `design-review-summary.md` | Phase 3 on pass | | 5 | `sdd:spec-generator` Phase 3 | `tasks.md` | `sdd:spec-task-review` | | 6 | `sdd:spec-task-review` (gate) | `task-review-summary.md` | `sdd:spec-qa-review` plan mode on pass | | 7 | `sdd:spec-qa-review` plan mode | `test-plan.md` | `sdd:spec-implement` | | 8 | `sdd:spec-implement` | Implementation, one commit per task | `sdd:spec-implementation-audit` | | 9 | `sdd:spec-implementation-audit` (gate) | `implementation-audit.md` | `sdd:spec-qa-review` review mode on pass | | 10 | `sdd:spec-qa-review` review mode | Updated `test-plan.md` | `sdd:spec-maintenance` on pass | | 11 | `sdd:spec-maintenance` | Updated previous specs, `spec-maintenance-report.md` | `sdd:spec-finish` | | 12 | `sdd:spec-finish` | `pr.md`, PR | Done | ## Bugfix Pipeline | Step | Skill | Output | Next | |------|-------|--------|------| | 1 | `sdd:spec-generator` bugfix | `bugfix.md`, `design.md`, `tasks.md` | `subagent-driven-development` | | 2 | `subagent-driven-development` (superpowers) | Implementation | `sdd:spec-finish` | | 3 | `sdd:spec-finish` | `pr.md`, PR | Done | No quality gate skills for bugfixes. User still reviews each phase document interactively. Step 8 can use superpowers' `subagent-driven-development` instead of `sdd:spec-implement`. The override rules below then apply to it. Step 12 of the feature pipeline and step 3 of the bugfix pipeline can use superpowers' `finishing-a-development-branch` instead of `sdd:spec-finish`. That superpowers skill does not check the gates. ## Superpowers Override Rules These rules take precedence over default superpowers skill chaining: - For SDD features use `sdd:spec-discovery`, not `brainstorming`. After either: invoke `sdd:spec-generator` (NOT `writing-plans`) - After `sdd:spec-implement` or `subagent-driven-development` in a feature: invoke `sdd:spec-implementation-audit` (NOT `finishing-a-development-branch`) - After `sdd:spec-qa-review` review mode passes: invoke `sdd:spec-maintenance` - After `sdd:spec-maintenance`: invoke `sdd:spec-finish` - After `subagent-driven-development` in a bugfix: invoke `sdd:spec-finish` (NOT `finishing-a-development-branch`). A bugfix has no audit and no maintenance step. ## Gate Failure Behaviour All gates follow the same pattern: 1. Gate identifies specific gaps or failures 2. Dispatch fix subagents for the specific issues 3. Re-run the failed gate 4. If the fix loop fails twice on the same gate, stop and ask the user ## Triggers These rules apply only when `project/domain/` exists. Claude Code applies them through the plugin hook. In any other client, apply them yourself. | After you write | If | Then | |---|---|---| | `discovery.md`, once the user approves it | its Terms section marks a term as new | Run `sdd:domain-define` before `sdd:spec-generator`. | | `spec-maintenance-report.md` | always | Run `sdd:domain-maintenance` before `sdd:spec-finish`. | | a `glossary.md` or `context-map.md` in `project/domain/` | it breaks the formats in `references/formats.md` of `sdd:domain-define` | Fix it before you go on. | | a code file | it uses a word from an `Avoid:` list | Rename the word where your change added it. | Before you end a session in which you wrote `spec-maintenance-report.md`, check that `domain-maintenance-report.md` exists beside it. If it does not, run `sdd:domain-maintenance`. ## Discovery → Spec-Generator Handoff 1. `sdd:spec-discovery` creates `project/work-items/{NN}-{name}/`, writes `discovery.md` there and, on user approval, passes the directory path to `sdd:spec-generator`. 2. `sdd:spec-generator` uses that directory and reads `discovery.md` as context for `requirements.md`. 3. After `sdd:spec-task-review` passes, `discovery.md` is deleted. ## Work-Item Identifier Rules Every change that ships behaviour (feature, bugfix, refactor, infra evolution) **must** live under a numbered SDD spec directory. The spec number is the primary identifier; the issue-tracker ticket ({TICKET-ID}) is a secondary cross-reference only. ### Required: numbered spec directory - Directory: `project/work-items/{NN}-{name}/` where `NN` is the next sequential integer. - Commit scopes: `feat(spec-41)`, `fix(spec-38)`, etc. — the spec number, not the ticket id. - PR title/description: reference the spec as `spec {NN}`. Include the issue-tracker ticket as `({TICKET-ID})` parenthetically if one exists. - Ticket body: include `spec: {NN}` so the crosswalk stays up to date. ### Acceptable: ticket-scoped `{TICKET-ID}` directory (no spec number) A `{TICKET-ID}` directory, named after a tracker ticket rather than carrying a spec number, is acceptable only when the work is: - A **throwaway spike** that informs a future decision but ships no behaviour change (e.g. evaluation runs, research briefs, discovery spikes). - A **board report** or governance document (e.g. full app audit, crosswalk maintenance). - A **single-commit trivial bugfix** on tooling or test data that does not warrant a spec lifecycle. If the spike result ships into production code, promote it to a numbered spec before merging. ### When in doubt If you are unsure whether the work warrants a spec: if it changes any user-visible behaviour or any production infrastructure, it gets a spec. Spikes stay in a `{TICKET-ID}` directory only while they remain exploratory. ## Artifacts ### Feature Work Item | File | Created by | Lifecycle | |------|-----------|-----------| | `discovery.md` | `sdd:spec-discovery` | Deleted after spec-task-review | | `requirements.md` | `sdd:spec-generator` | Permanent | | `design.md` | `sdd:spec-generator` | Permanent | | `design-review-summary.md` | `sdd:spec-design-review` | Permanent | | `tasks.md` | `sdd:spec-generator` | Permanent | | `task-review-summary.md` | `sdd:spec-task-review` | Permanent | | `test-plan.md` | `sdd:spec-qa-review` | Permanent (updated in review mode) | | `implementation-audit.md` | `sdd:spec-implementation-audit` | Permanent | | `spec-maintenance-report.md` | `sdd:spec-maintenance` | Permanent | | `domain-maintenance-report.md` | `sdd:domain-maintenance` | Permanent | ### Bugfix Work Item | File | Created by | Lifecycle | |------|-----------|-----------| | `bugfix.md` | `sdd:spec-generator` | Permanent | | `design.md` | `sdd:spec-generator` | Permanent | | `tasks.md` | `sdd:spec-generator` | Permanent |