codex-spec-driven-development
Use for prototype, MVP, fullstack feature, from-scratch feature, or multi-domain work that needs a SPEC.md before planning or implementation. Do not use for tiny one-file edits.
SKILL.mdskills/codex-spec-driven-development/SKILL.md
GitHubTL;DR
Use before $prototype, MVP, fullstack, or high-ambiguity feature work. Write .codex/specs/<slug>/SPEC.md first to lock both SDLC requirements (AC-###) and SILC System Integration Contracts (SILC-###) across FE ↔ BE ↔ Data ↔ Auth/Infra, then plan, implement with TDD + seam verification, and validate against traceability.
Activation
- Activate on
$spec,$prototype, "spec-driven", "MVP", "fullstack prototype", "from scratch", or "build whole app". - Activate when a task spans frontend + backend, data, QA, or deployment concerns.
- Activate when requirements or cross-module integration seams are ambiguous enough that coding first would create rework.
Hard Rules (SDLC + SILC Discipline)
- Do not implement prototype/fullstack/multi-domain work before
.codex/specs/<slug>/SPEC.mdexists. - Specs are Tier 3 (L2) Normative Contracts in the Unified Memory Architecture (
../codex-project-memory/references/unified-memory-architecture.md). - Every spec must include:
- Requirements & Non-Goals
- System Integration Contracts (
SILC-001,SILC-002, ...) locking producer/consumer seams:- FE ↔ BE Seam: Exact endpoint route/method, request payload, response DTO shape, HTTP status codes, and deterministic error envelope (
code,message,fieldErrors). - BE ↔ Data/Runtime Seam: Schema/table changes, constraints, indexes, idempotency/transaction boundaries, and required environment variables.
- UI State ↔ Async Seam: How
loading,empty,error,success, andretrystates map to the API contract.
- FE ↔ BE Seam: Exact endpoint route/method, request payload, response DTO shape, HTTP status codes, and deterministic error envelope (
- Acceptance Criteria (
AC-001, ...) and Security Criteria (SEC-001, ...) - Implementation Tickets (
TICKET-001, ...) linkingAC-###andSILC-###to owned files and validation commands - Traceability Table mapping changed files to
AC-###/SILC-###IDs and verification commands
- Keep specs project-local under
.codex/specs/; load only the active spec for the current feature. - Run
check_spec.pyafter code changes when.codex/specs/exists.
Commands
python "<SKILLS_ROOT>/codex-spec-driven-development/scripts/init_spec.py" --project-root <path> --title "<title>"
python "<SKILLS_ROOT>/codex-spec-driven-development/scripts/check_spec.py" --project-root <path> --changed-files <csv>
Output Contract
init_spec.pyreturns JSON withstatus,spec_path, andslug.check_spec.pyreturns JSON withschema_version,overall,matched_specs,matched_acceptance_criteria,matched_silc_contracts,matched_implementation_tickets,unmapped_files, andsuggested_actions.
End-to-End SDLC + SILC Prototype Flow
- Preflight & Memory Boot (
$hook): Detect domains, profile (.codex/profile.json), genome (.codex/context/genome.md), and role docs (.codex/project-docs/). - Contract Specification (
$spec): LockAC-###,SILC-###integration seams, andSEC-###in.codex/specs/<slug>/SPEC.md. - Architecture & Task Planning (
$plan): Break work into dependency-ordered slices (DB/Contract -> Backend API -> Frontend UI -> E2E Seam Verification). - Execution & SILC Seam Verification (
$sddor inline$tdd): Implement each slice with Red-Green-Refactor AND verify the producer/consumer seam before moving to the next layer. - Memory Write-Back & Full Gate (
$check-full): UpdateSPEC.mdtraceability, update touched role docs, rebuild.codex/knowledge/INDEX.md, and runauto_gate.py --mode full.
Reference Files
references/spec.schema.json: required spec markdown contract,SILC-###integration contract fields, and traceability schema.