Produces a quantified current-state report (test count, aria markers, error boundaries, storage usage, dependencies) used to anchor specifications in measured reality rather than assumptions. Use when: 'audit the codebase before speccing', 'ground this spec in reality', 'what does the code actually look like', 'measure before I write the spec'.
Specifications should describe deltas from measured reality, not deltas from ideals. A spec grounded in quantified codebase state ("207 aria instances, 24 test files, 0 localStorage usage") produces more precise implementation guidance than a spec describing an imagined end state. This prevents the gap between assumption and reality that causes rework.
The pattern emerged from direct evidence: v0.2.4 specs that included measured codebase audits required zero Track 0 remediation, while v0.2.2 specs written without grounding required significant correction. Measured state → better spec → better implementation.
Activate this skill when:
Determine which metrics matter for your project type:
Use grep, glob, and language-specific tools to measure actual patterns. Record exact counts and file lists.
Test count:
find . -name "*.test.*" -o -name "*.spec.*" | wc -l
Accessibility markers (React example):
grep -r "aria-" --include="*.tsx" --include="*.jsx" | wc -l
Error boundary usage:
grep -r "ErrorBoundary" --include="*.tsx" | wc -l
Storage usage:
grep -r "localStorage" --include="*.ts" --include="*.tsx" | wc -l
Specific library usage:
grep -r "framer-motion\|react-spring" --include="*.tsx" | wc -l
Dependency audit:
cat package.json | jq '.dependencies | keys | length'
File structure snapshot:
find src -type f -name "*.tsx" | head -20
Create a section in your spec with exact numbers and file samples:
## Current State (Measured)
- Test files: 24
- Accessibility markers (aria-*): 207 instances across 18 files
- Error boundaries: 1 (at App root)
- localStorage usage: 0
- Framer Motion: 8 files
- Dependencies: 42 direct
- Key patterns: Redux for state, React Router for navigation
Include specific file examples where relevant.
Frame all changes relative to measured baseline:
## Proposed Changes
From 207 aria instances → add 12 new markers in Modal and Form components
From 1 ErrorBoundary → add boundaries around Card components
From 0 localStorage → introduce localStorage for preferences in 1 module
Avoid describing an ideal end state. Describe the delta.
Document how the measurements were taken:
gap-audit-then-fix in specification-driven-development.Scenario 1: "Audit the DojoChat codebase before writing the v0.4 accessibility spec." → Current State section listing 207 aria instances across 18 files, 1 ErrorBoundary at App root, 0 localStorage usage, 8 Framer Motion files — plus the exact grep commands that produced those counts.
Scenario 2: "Ground the new test strategy spec in what tests already exist." → A report showing 24 test files, the test framework (Vitest), current coverage gaps by directory, and a delta framing showing which modules have zero coverage.