Plan → TDD — from approved tasks to landed commits
Entry condition: specs/<id>/spec.md says status: approved with approved_by and
approved_on, and plan.md, quickstart.md and tasks.md exist
(spec-first gets you there). Anything missing → stop and run the
Spec Kit command that makes it (/speckit-specify, /speckit-plan, /speckit-tasks). This
is the constitution's HARD-GATE, not a preference. This skill writes no plan and no tasks of
its own — one plan, one task list, both Spec Kit's — and when the tasks split into
file-disjoint parcels, task-orchestra runs them in parallel,
each worker following this loop. Work that is not a feature — a bug in accepted behaviour, a
hotfix, a refactor, a chore — runs the same per-task loop under its own lane's entry condition
instead (an accepted spec for a bug, no spec for a refactor):
NON-FEATURE-WORK.
Check tasks.md before the first line of code
/speckit-tasks wrote it; you check it (the step of SPEC-FLOW
that /speckit-analyze also reads):
- Test tasks are there, each ahead of the code it proves. Spec Kit's
/speckit-tasksgenerates tests only when asked; constitution Article VI asks. Missing? Re-run/speckit-taskswith "tests first for every behaviour change" as its argument. - Every task is independently verifiable and carries a measurable "done = …". One task ≈ one commit ≈ one concern; a task you cannot name in one clause is two tasks.
- Risky tasks are flagged — anything on the surfaces the constitution's Development Workflow names (for a web product: data isolation, schema, authorization, money). Those get adversarial review before commit, not just the normal pass.
- Tasks use Spec Kit's checklist format,
- [ ] T001 …; a task deliberately moved out of this feature reads(deferred → <where>), so it does not hold the spec back. - Feature 001, the walking skeleton, ends by installing the kit's gate hook and CI job:
python3 factory/bin/adopt.py --install-git-hook --ci github, then the toolchain steps in.github/workflows/factory-gates.yml(PHASE-0 §7). A task that writes its own pre-commit hook, hook installer or gate workflow is wrong: re-plan it onto those two commands.
The loop, per task
- Red — write the failing test first, and watch it fail. A test that passes before the code exists proves nothing. Vacuous-green check: confirm the test filter matches ≥1 real test name — a filter matching zero tests exits green (GATES §1).
- Green — the minimum code that passes. No gold-plating; the
ponytailladder applies inside the layer. - Refactor — clean up with the tests staying green.
- Gates —
./gates/run-chain.sh. Red = fix, never proceed; aTODOslot is red too. The one exception is feature 001 wiring the chain: its commits may be red only at aTODOslot, with the spec gates run directly (GATES §1). A new route, command or exported surface needs its caller in the same task or a named task — theorphan-endpointsslot (gates/check-orphan-endpoints.sh, configured bygates/orphan-endpoints.conf; unconfigured it is red, "not wired") checks routes. - Review — an independent reviewer; adversarial lenses (tech-lead-review) for the flagged tasks. Findings are fixed or refuted with evidence, never shelved (GATES §2).
- Commit —
type(scope): description, one concern, with aSpec: <id>trailer (GATES §10). The task's checkbox (- [x] T00n) and any spec or plan correction land in the same commit — deferred sync is how maps start lying.
When every task is ticked, the chain is green and review has passed, the feature is built, not
accepted: someone other than the builder runs quickstart.md and records
specs/<id>/acceptance.md before the status moves to accepted (GATES §3).
Stop rules
- The design turns out wrong mid-task → stop, return to the spec
(
spec-first); a changed requirement goes back to the owner for approval. Pushing through a broken design is how one correction commit becomes five. - A task still resists after two honest attempts → the task is mis-cut; re-plan it.
- Never race a milestone by dropping tests or review — a green lie costs more than a red truth, because the lie compounds.