Getting started#
Two ways in, depending on whether the code already exists. Both take under an hour and neither requires reading anything else first.
Adopt SDD on an existing repository#
Goal: the brownfield path (L1) — install specs, rules and the traceability matrix on a codebase that already exists, without touching a line of code.
cd your-existing-repo
# Detects the stack from pom.xml / build.gradle / package.json / go.mod
npx create-spec-driven-app@latest adopt
# Passes immediately — the generated baseline REQ-001 anchors the matrix
npx create-spec-driven-app@latest validate .What adopt writes (and only if the file does not already exist):
| File | Purpose |
|---|---|
spec.md | Requirement sections; seeded with REQ-001 "existing behaviour is preserved". |
AI_RULES.md | Agent/human rulebook with your detected stack and test command. |
features/adoption/baseline.feature | Baseline Gherkin scenario pinning the adoption invariant. |
docs/specs/traceability.md | Rich matrix with the baseline row. |
docs/specs/adr/README.md | ADR index for future decisions. |
Override anything the detection got wrong with --var:
npx create-spec-driven-app@latest adopt \
--var DOMAIN="health information exchange" \
--var TEST_CMD="./mvnw -B verify"Then retro-fill real requirements one at a time (recipe 2) and lock the gate in CI (recipes 4–5).
Generate your first project#
Goal: scaffold a new repo with spec.md, AI_RULES.md, docs/specs/, an empty features/ directory, and a traceability matrix.
# 1. Start from the shipped example
cp examples/project.config.example /tmp/acme-energy-hub.config
# 2. Edit /tmp/acme-energy-hub.config — minimum keys:
# PROJECT_NAME, PROJECT_SLUG, PROJECT_TYPE, DOMAIN, STACK, API_STYLE, TESTING
# 3. Scaffold
npx create-spec-driven-app@latest init \
--config /tmp/acme-energy-hub.config \
--out /tmp
# 4. Verify
tree /tmp/acme-energy-hub -L 2Useful flags:
| Flag | Use |
|---|---|
--dry-run | Print every file that would be written; don't touch disk. |
--force | Overwrite a pre-existing target directory. |
--no-git | Skip git init (defaults to initialising). |
Replace the scaffold with real requirements#
Goal: turn the template spec.md and traceability.md into project-specific content.
- Open
spec.md. Replace every placeholder paragraph; keep theREQ-NNNheading convention because the validator uses it. - Update
docs/specs/traceability.md. Use the rich 10-column header if you want full DDD coverage; the legacy 4-column form is also accepted. - Each
REQ-NNNyou add tospec.mdmust appear intraceability.mdand (eventually) in a.featurefile.validateflags missing rows;validate --strict-tddalso flags missing scenarios/tests.
Tip: keep
AI_RULES.mdopen in your editor. It is what every coding agent reads on every prompt — changes there propagate to Claude/Cursor/Aider without re-prompting.
Then: the daily loop#
Scaffolding is day one. From day two the loop is four commands, and none of them asks you to edit the ten-column matrix by hand.
csda status # where things stand, and what to run next
csda plan # the queue: what still needs a test or code
csda req add "Operators can export a monthly report"
csda req link REQ-007 --feature features/reporting/export.feature \
--test src/ReportTest.java
csda done REQ-007 --check # validates first, then flips the statuscsda status is the one to start the day with — it names the single next
command, so you never have to remember which of the others applies.
If validate complains about something mechanical — an orphan .feature, a
requirement in spec.md with no row — csda fix --dry-run shows what it would
repair, and csda fix applies it.