sdd — Spec-Driven Development
From the repositorypacks/sdd/README.md ↗
sdd — Spec-Driven Development
Section titled “sdd — Spec-Driven Development”Start from a feature, propose the smallest useful vertical slices, and let the owner select one. Agree WHAT/WHY (spec + clarification), then HOW (design + plan/tasks) before code. SDD remains the delivery method; the factory coordinates its stations. Each slice is accepted separately; tasks are internal work, not separate user outcomes. Every new technical decision and every commit require explicit approval. Stricter project/user instructions win.
Lane: software. SDD remains its method; current sdd-* member names are unchanged. Understand covers slice/triage/context/spec+clarify; Design covers plan/tasks; Build covers test preparation/implementation; Verify covers evidence/review/acceptance; Learn covers archive/learnings. TDD can prepare tests before code; existing gates remain.
Optional core-init proposes .rigorkit/project.yaml; core-context reads its relevant department/capability references once per current revision. Config is additive, never permission to weaken software gates. Existing SDD entry points and no-config projects remain usable without core. With configuration but no core, read approved refs and report unsupported routing; do not claim missing custom behavior ran. No automatic project migration or installation. Runtime state stays in existing change artifacts.
Agent rules
Section titled “Agent rules”Top 1% role for its stage; no flattery, identify blind spots. Batch independent searches; filter command output with existing summary helpers when available, retaining failures/IDs/status and evidence gaps. Verify code with file:line, never assume. Agents may run existing scoped unit/integration tests (Jest or equivalent). Browser/Docker/e2e require an explicit request; install/build/lint/typecheck/migrations/seeds/deploy remain outside that permission. Missing services => pending evidence, never start infrastructure. Honor stricter project rules. Propose one commit per verified block; every commit needs explicit approval, never chain commits, push or merge. Stop at shared design gates, block review, missing evidence or consequential uncertainty; no stop between internal tasks.
Repository layout
Section titled “Repository layout”specs/
constitution.md principles (at most 15 lines) and critical paths; Language:
roadmap.md flat story/slice index; local Factory v2 entry work
baselines/<module>.md behavior at adoption
capabilities/<area>/spec.md current system, not change history
changes/<id>/ spec, plan, tasks (+ data-model/contracts), or non-owner proposal
archive/<id>/ completed changes
half-wired.md unfinished-feature register
learnings/<id>-<slug>.md reusable generic team knowledge, written by sdd-archive
templates/ copies from sdd-init
scripts/check-scenarios.mjs scenario structure/test-coverage check, copied by sdd-init
ID = NNN-kebab-name (e.g. 007-bank-transfer); methodology lives in rigorkit, project artifacts in their repo.
Selective context, global verification
Section titled “Selective context, global verification”Read full applicable instructions/constitution once per unchanged context; never truncate governing rules. Load only the active skill, then its paired successor when needed. Reuse in-context sources and evidence while their revision/scope remains valid; search first, read relevant ranges, never whole archives/modules by default. Source revision includes working-tree edits, not HEAD alone. Recheck affected paths/diffs on resume, edits or external changes; after context loss reload governing rules and referenced evidence, not transcripts. Start a block from its RF/scenario/decision/contract references and shared dependency map; tasks reference these instead of copying them. Trace actual dependencies/all producers/consumers beyond initial paths. Expand capabilities/baselines/spec/plan for missing refs, ambiguity, shared-contract changes, critical paths or growing impact; record unresolved dependencies, never infer safety from no matches. Recheck affected refs/consumers after edits, reuse unaffected findings. Scope/behavior/design changes return to their approval gate. Reuse integration/contract/dependency checks; local units alone are insufficient. Keep critical DoD. Resume uses brief block/task state checked against current files/evidence; checkbox/commit never proves approval or green tests. Review the combined block diff once, rechecking fixes/changed dependencies rather than repeating each task review. Final verification still reads the full spec, required plan and accumulated diff, checks architecture/contracts/cross-block effects, regressions and live behavior. Reuse valid block evidence, never substitute it for global review. Missing reviewers mean manual checks. Mark complete only after verification; report evidence/pending work briefly. Installed copies need reinstall. Existing project templates stay in their structure/language; do not overwrite custom rules or migrate other repos. Missing artifact/templates sections are reported and skipped. New prose uses constitution Language:, else latest recognizable user language, then existing change artifacts; if neither exists ask once, fall back to English and say so if unanswered. Existing artifacts keep their prose/structure; chat follows user, fixed verdicts follow structure. Language may be a code/name; empty/unknown is undeclared.
Stages
Section titled “Stages”| Stage | Skill | Role (top 1%) | Gate | Approval |
|---|---|---|---|---|
| Setup | sdd-init | Tech lead | specs/ and templates created | Yes |
| −1 Adoption (mandatory for existing code) | sdd-adopt | Architect | Constitution/critical paths; module baselines with file:line; half-wired proposals | Yes |
| Entry (Factory v2 work) | sdd-slice | Product manager | Propose useful vertical slices, roadmap order/dependencies; select one | Owner selection |
| 0 Triage | sdd-triage | Tech lead | Size/owner/ID/DoD, critical if uncertain | Yes |
| 1 Context | sdd-context | Senior engineer | Current code evidence and unknowns | — |
| 2 Spec | sdd-spec | Product manager | >=5 questions, one at a time; EARS, 4 scenario types or justified n/a, exclusions, no code references | Continue to clarify |
| 2.5 Clarify | sdd-clarify | QA | Auto-audit/fix grounded gaps; ask user decisions; zero high/medium; re-audit edits | Approve clarified spec |
| 3 Plan | sdd-plan | Architect | All RFs, rejected alternatives, constitution validated | Continue to tasks |
| 4 Tasks | sdd-tasks | Tech lead | Functional blocks with internal tasks, RFs, dependencies, refs and checks; no time-box split | Approve HOW + blocks/tasks |
| 4.5 Tests first | sdd-tests | Testing engineer | Block scenario-ID tests, intended-red evidence; whole-change gaps remain explicit | Recorded red evidence; owner decisions |
| 5 Implement | sdd-implement | Senior developer | Whole approved block; combined diff review here or in Verify for two-file stories; green before completion | Applicable block review + each commit |
| 6 Verify | sdd-verify | QA | Scenario/test/result table, global diff/contracts, cross-layer, critical DoD, reviewer verdicts, approval decision, verdict | User closes |
| 7 Archive | sdd-archive | Documenting engineer | Archive/capabilities/baselines current, half-wired registered, learnings proposed | Yes |
Support: sdd-resume (new session), sdd-change (requirements: spec first), sdd-legacy-review (@legacy), sdd-explain (explain.md summary/Mermaid/walkthrough/RF mapping; archive proposes when warranted). Readonly agents: sdd-explorer for context/adoption; sdd-reviewer for clarification/verification/independent review; sdd-approver for the delivery decision. Writable agent: sdd-builder implements one approved block from a fresh context. Optional architecture/frontend/design/security reviewers get diff/constraints; frontend only for .tsx/.jsx/app/; missing packs are reported and checks still performed.
Review stations
Section titled “Review stations”Triage proposes the review profile of each change: conformance (sdd-reviewer) and quality/architecture (architecture-reviewer), plus the frontend reviewer for frontend code, security reviewer for sensitive paths and interface reviewer for rendered screens; the project constitution can force more. After the builder, the enabled reviewers run together, each with the same references and no other reviewer’s report. Their corrections are re-reviewed together once, then the change escalates to the owner. sdd-approver aggregates the verdicts into approved, needs human or failed, and the owner closes the change. Interface improvements never block; an interface defect blocks only when the same change does not correct it.
Stations and handoffs
Section titled “Stations and handoffs”The owner supplies a feature intent; sdd-slice proposes stories/tickets that each represent a useful vertical slice. Do not create parallel HU/ticket/slice hierarchies. Setup/adoption precede the first change, and triage/context route the selected slice before its spec.
| Station | Required input | Output / exit criterion |
|---|---|---|
| Slice | Intent, relevant repo/vault facts | Smallest independently useful outcomes, dependencies and owner-selected priority |
| Specify + clarify | Selected outcome, applicable decisions | Behavior/acceptance/scenarios/exclusions clarified; owner approves WHAT |
| Design + plan | Approved spec, actual consumers/contracts | Minimum design and internal tasks; new technical decisions and HOW approved |
| Prepare tests | Agreed scenarios and test strategy | Discriminating tests; intended behavioral failure or valid existing coverage recorded |
| Build | Approved references and test evidence | Minimum implementation, permitted test results, diff and unresolved items |
| Review + accept | Spec, decisions, accumulated diff and evidence | Compliance and architecture checked separately; owner accepts this slice |
| Close + learn | Accepted result, validation gaps and discoveries | Repo state/knowledge updated, learnings proposed; next slice remains owner-selected |
Pass scope, decision/source references, affected consumers, evidence and open questions at every handoff. Never infer success from a previous agent’s report alone. A code defect returns to build; a behavior or technical-design decision returns to its owner approval gate. The coordinating caller preserves the slice contract and routes blockers; it cannot approve decisions for the owner.
Using the paired flow
Section titled “Using the paired flow”Answer the interview, let clarification fix only gaps grounded in those answers, then approve the clarified spec. The agent prepares design/plan/tasks for your second review. It communicates reused decisions with their repo/vault source and waits for every new technical decision. An unclear source or conflicting repo rule becomes a question.
One slice normally uses one approved implementation block (B1), with dependent internal Tn tasks. Do not add another decomposition level unless needed and approved. Across repositories, preserve one observable result, verified producer/consumer contracts and one change owner; independent delivery must account for real dependencies. Review each slice while its context is small; retain final cross-slice/whole-change checks where required.
See examples for a roadmap, a spec excerpt, per-instance configuration, JavaScript/Jest code and a handoff report. These examples illustrate contracts; they are not a new architecture imposed on adopting projects.
Functional blocks
Section titled “Functional blocks”A block delivers one verifiable behavior across its required layers; a small feature can be one block. Large features use dependent blocks with explicit integration points, not arbitrary minute/line limits. Group internal tasks by block, share references/checks, keep every RF assigned. Approval names the authorized block(s); never infer authorization for the next block or a commit. Continue internal tasks without permission prompts, but pause for required checks outside the permitted unit/integration boundary, blockers or scope/design decisions. Do not collect red evidence for unrelated future blocks. Whole-change verification still covers all blocks together. Legacy Tn tasks without blocks remain single-task units until regrouping is approved; preserve IDs/completion/evidence, never silently migrate project files.
Scope and DoD
Section titled “Scope and DoD”Bugfix/adjustment without observable change: no artifacts, commit only. Architecture/data-model change: spec+plan (+data-model)+tasks. Multi-repo: full artifacts in owner, proposal elsewhere.
A normal, single-repo story with one useful slice and no architecture or data-model change can use Artifacts: spec+tasks after owner confirmation in Triage and subject to stricter project rules. Record Artifacts: spec+tasks as a literal line in the spec. These are its two change-folder artifacts:
- Understand keeps scope, tier, DoD, requirements and scenarios in
spec.md. Triage and context are activities; retain their useful refs and decisions where consumed. - Design records HOW, verified references and checks in B1 of
tasks.mdand obtains the normal design approval. Internal tasks execute together under that block. - Build hands the complete diff and current checks to Verify. Verify runs one combined block and whole-change review with the approved independent reviewer profile. Keep required checks, reviewer verdicts, gaps and owner acceptance evidence in
tasks.md. Use a literalValidation: doneline only when required evidence is current and complete, otherwiseValidation: pending. Learn archives the same records. - If scope or risk grows, return to Triage under the same ID. Once the owner reclassifies the story, remove
Artifacts: spec+tasksfrom the spec amendment if it no longer qualifies. Approve the amended spec before renewing the required design and review profile. Existing full workflows require owner approval to change. Normal DoD: all required scenarios covered/green, coherent DB→API→DTO→frontend, same ID across repos, remaining half-wired registered and owner acceptance for each slice; archive after acceptance. Required live/browser/e2e checks stay pending until explicitly requested/performed; unit/integration green alone cannot establish that evidence. Critical (money/tenants/permissions/real-data migrations) adds relevant failure test, real-data smoke, existing-flow regression and honest missing-evidence report; see skills/sdd-verify/dod-critical.md. Same ID everywhere; non-owners have proposal pointing to owner plus their tasks. Learnings only in owner. Each repo specifies its own work (API contract where implemented, UI where rendered).
Scenarios and TDD
Section titled “Scenarios and TDD”All RFs have happy/edge/failure/security or justified n/a rows, at either DoD level; critical adds evidence, not fewer scenario types. See skills/sdd-init/templates/scenarios.md. sdd-spec writes, sdd-clarify/reviewer audit (missing type = high and blocks plan), user approves table instead of code, sdd-tests writes ID-titled tests before implementation (4.5), checker verifies coverage in pre-push/CI. Pure visual UI uses [manual]; live/browser checks require an explicit request and otherwise remain pending; the interface reviewer reports defects and improvements, and only an uncorrected defect blocks.
Optional vault
Section titled “Optional vault”Works without one. When configured, the vault is a brain available at EVERY station, including reviews and closure; search matching tags/notes when a question or decision needs it, reuse valid evidence, and never reload the whole vault by default. Communicate every reused technical decision with its source and why it applies; new decisions need approval, conflicts/uncertain applicability return to the owner. The repo wins. specs/learnings/ stores generic reusable team knowledge; repo-specific facts stay in constitution/capabilities. Archive proposes missing promotions including teammates’ learnings. Ask once if unregistered and store approved response in unversioned user-local instructions. Link every promoted note from vault entry; never isolated notes. Vault rules win; see skills/sdd-archive/vault.md.
Allowed execution and delivery evidence
Section titled “Allowed execution and delivery evidence”Use existing scoped unit/integration scripts and dependencies; no automatic package installation. Browser, Docker and end-to-end tests require an explicit request. Install/build/lint/typecheck/migrations/seeds/deploy require their own authorization. Integration requiring unavailable services stays pending. Give passing, failing and unrun checks separately with their scope; never present green unit tests as proof of the complete system.
The operating contract is implemented in local skills/agents and the checks below; it is not an installed-project migration or a release guarantee. Installation/adopting-project validation and owner slice acceptance remain separate from source delivery. The owner confirmed retaining both base reviewers and the existing token budget; proportional removal of reviewers is deferred.
Implemented factory checks
Section titled “Implemented factory checks”Setup copies self-contained Node >=18 checks into specs/scripts/. In this toolkit checkout use tools/ instead. Declare real test globs (*, **, ?) under constitution Test paths (frozen tests); unsupported/missing patterns fail closed. Record the owner-approved change base and red hash in the slice handoff.
node specs/scripts/check-frozen-tests.mjs --base <confirmed-base> --red <approved-red>
node specs/scripts/check-branch-trace.mjs --base <confirmed-base>
Frozen checks pin the constitution test policy to the approved red and inspect intermediate commits and staged/unstaged/untracked tests, including edit/revert and rename/deletion. Only test(amend): with an AMEND-... or spec.md#... citation passes its lexical amendment gate; owner approval and actual amendment remain reviewer responsibilities. Every real commit still needs explicit approval; test(red):, test(green):, test(amend): and refactor(<id>): are proposed conventions, not automatic actions.
Branch trace flags unexplained branch additions in JS/TS hunks, checking the index and worktree independently and inspecting executable template interpolations. References can be RF scenario IDs or INV IDs; deleted/other-hunk references do not count. This is lexical evidence only, not an AST/semantic proof: explain false positives with the owner and never add meaningless markers to manufacture green. Checks precede reviewers when applicable; no frozen red for an approved trivial/manual-only exception must be explicitly recorded.
Tier proposals: trivial=no observable/contract/critical behavior change, story=one useful slice with a short contract/tests, feature=multiple slices with integrated contracts and owner-requested wider regression. Owner confirms tier/profile; new critical/module/threshold impact returns to that gate. Existing conformance+architecture stays enabled; special security/frontend/interface triggers and stricter project rules remain.
The agency-agents adaptation map identifies reused practices and exclusions. Scripts and unit/in-process fixtures are implemented; installed-project migration and real instruction-following acceptance must be validated in each adopting project.