Skip to content

Spec Auditor

The Spec Auditor evaluates specification files for structural completeness, content substance, cross-spec consistency, and scope sizing. It ensures specs are ready to hand off to development before any code is written.

The Spec Auditor is not a code reviewer and not a product guardian. It checks whether the spec is complete, internally consistent, and appropriately sized. It does not judge whether a feature should exist or whether the prose is well-written.

PropertyValue
Commandspeed audit <spec-file>
Model tiersupport_model (Sonnet)
ToolsRead, Glob, Grep (read-only)
TriggerManual, or automatically before speed plan unless --skip-audit is passed
InputSourceDescription
Spec file contentPath argumentThe full spec being audited
Type templatespeed/templates/{prd,rfc,design,defect}.mdAuto-detected by spec path location
Product visionspecs/product/overview.mdHigh-level grounding
Existing spec listspecs/ directory scanFor resolving cross-reference links
Linked PRDResolved from spec header linkPRD content for RFC/Design cross-spec checks
Related feature targetResolved from Related Feature fieldFor defect specs only

Spec type detection by path: specs/product/ maps to PRD template, specs/tech/ to RFC, specs/design/ to design, specs/defects/ to defect.

OutputLocationDescription
Audit reportStdout (JSON)Per-section issues with severity, sizing recommendation, overall status

The auditor runs four check levels in order. A failure at any level does not skip subsequent levels.

Level 1 (Structural). Checks the spec skeleton against the template: all headings present, no empty sections, no leftover TODO/FIXME markers, no placeholder text ({Feature Name}, TBD), and all local cross-reference links resolve to existing files.

Level 2 (Completeness). Substantive sections must have more than one sentence (or one sentence plus a list/table/code block). Tables must have at least one non-header data row. Checklists must have at least one item.

Level 3 (Cross-spec consistency, RFC and Design specs only). For RFCs: every PRD user flow needs a corresponding API endpoint, every PRD entity needs a data model entry, and success criteria must be testable. For Design specs: every PRD flow needs a component/page, every implied page needs a route, and all four UI states (empty, loading, populated, error) must be defined.

Level 4 (Sizing, PRD and RFC specs only). Estimates implementation tasks based on user story count, API endpoints, schema changes, and complexity signals. Specs exceeding 10 estimated tasks get a split recommendation with suggested boundaries. Sizing is always a warning, never an error.

The audit pipeline runs in five phases. All context is gathered before the agent runs; the agent has read-only tools but the pipeline assembles the prompt inline.

speed audit <spec-file>
├─ 1. Detect spec type from path
│ └─ specs/product/ → prd, specs/tech/ → rfc, etc.
├─ 2. Load template + vision + linked specs
│ ├─ Type template from speed/templates/
│ ├─ Product vision from specs/product/overview.md
│ ├─ Linked PRD (from "> See [...](...)" links)
│ └─ Related feature target (defect specs only)
├─ 3. Assemble audit prompt
├─ 4. Send to Audit agent (Sonnet, read-only)
└─ 5. Parse JSON + report + exit code
├─ fail (L1 errors) → exit 10
├─ warn (L2-4 issues) → exit 0
└─ pass → exit 0

cmd_audit (lib/cmd/audit.sh:28-47) strips everything up to specs/ in the file path and maps subdirectories: product/ → prd, tech/ → rfc, design/ → design, defects/ → defect. Unrecognized paths produce a config error.

Lines 49-141 load four inputs:

InputResolution method
Type templatespeed/templates/{prd,rfc,design,defect}.md based on detected type
Product visionspecs/product/overview.md at project root
Linked PRDParsed from > See [...]() markdown links in the spec, resolved relative to spec directory
Related featureFor defect specs: parsed from **Related Feature:** field, resolved to product/tech spec paths

Lines 144-157 build the audit message with five sections: spec under audit, structural template, product vision, linked specs (or “No linked PRD found”), and existing spec file list from the specs/ directory.

Lines 165-177 send the prompt via claude_run with the audit agent definition (agents/audit.md), the support model (Sonnet), and read-only tools. The agent produces JSON matching the output schema without needing an external template.

Lines 204-282 format the output. Level 1 issues get cross icons (blockers), Level 2+ get warning icons. Sizing recommendations for split display the estimated task count and rationale. Exit codes: EXIT_GATE_FAILURE for fail status (blocks speed plan), EXIT_OK for pass or warn.

When called as a pre-plan gate (plan.sh:262-311), cmd_audit runs in a subshell. A fail exit halts planning. The sizing estimate from the audit’s sizing.recommendation field determines whether the Architect runs single-phase or multi-phase. If the linked PRD exists, it gets audited too.

An RFC spec at specs/tech/notifications.md that references a PRD at specs/product/notifications.md.

The RFC has all required headings, but the “Data Model” section contains only TBD and the “Error Handling” section is completely empty.

{
"status": "fail",
"spec_type": "rfc",
"spec_file": "specs/tech/notifications.md",
"linked_specs": {
"prd": "specs/product/notifications.md",
"design": null
},
"issues": [
{
"level": 1,
"severity": "error",
"section": "Data Model",
"message": "Contains placeholder text 'TBD' — must be replaced with actual schema definition"
},
{
"level": 1,
"severity": "error",
"section": "Error Handling",
"message": "Section is completely empty — must define error states and recovery behavior"
},
{
"level": 3,
"severity": "warning",
"section": "API Endpoints",
"message": "PRD user flow 'Mark notification as read' has no corresponding endpoint in the RFC"
}
],
"sizing": {
"estimated_tasks": 7,
"recommendation": "ok",
"rationale": "3 API endpoints, 2 models, 1 migration, 1 WebSocket handler"
}
}
═══ Spec Audit ═══
Spec type: rfc
Spec file: specs/tech/notifications.md
Template: speed/templates/rfc.md
Linked spec: specs/product/notifications.md
Vision: specs/product/overview.md
Sending to Audit agent...
═══ Audit Report ═══
✗ [L1] Data Model — Contains placeholder text 'TBD'
✗ [L1] Error Handling — Section is completely empty
⚠ [L3] API Endpoints — PRD user flow 'Mark notification as read' has no corresponding endpoint
Report saved to .speed/logs/audit-1709312000.json
Audit: FAIL (2 error(s), 1 warning(s))
  • Read-only access. Cannot modify files.
  • Do not judge prose quality. If a section has substance, it passes completeness regardless of writing quality.
  • Do not analyze the codebase. Spec quality is the scope, not implementation feasibility.
  • Do not auto-fix. Report problems for the human to resolve.
  • Treat linked spec absence as a Level 1 error (missing cross-reference link) and skip Level 3 checks.
  • Do not invent requirements. Audit against the template and linked specs only.
{
"status": "pass | warn | fail",
"spec_type": "prd | rfc | design | defect",
"spec_file": "relative path to the spec file",
"linked_specs": {
"prd": "relative path or null",
"design": "relative path or null"
},
"issues": [
{
"level": 1,
"severity": "error | warning",
"section": "heading name",
"message": "specific, actionable description"
}
],
"sizing": {
"estimated_tasks": 0,
"recommendation": "ok | split",
"rationale": "reasoning behind the estimate"
}
}

Status rules: fail when Level 1 errors exist. warn when no Level 1 errors but Level 2/3/4 issues exist. pass when no issues of any kind. Sizing is null for Design and Defect specs.