blueprint-plugin/skills/blueprint-story-audit/SKILL.md
Audit user stories against codebase and tests for tier-ranked coverage gaps. Use when running story audit, PRD reconciliation, or surfacing PRD-code drift.
npx skillsauth add laurigates/claude-plugins blueprint-story-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reconcile what the codebase actually does against what the PRD says it should do, then map every story to its tests and rank the gaps. Produces one durable artifact: docs/blueprint/audits/<date>-story-audit.md.
Usage: /blueprint:story-audit [--scope <area>] [--prd <path>] [--no-write] [--report-only]
| Use this skill when... | Use alternative when... |
|------------------------|-------------------------|
| Auditing PRD↔code drift before a release or planning round | Drafting a brand-new PRD from scratch (/blueprint:derive-plans) |
| Finding untested critical paths through the user-story lens | Mining commits for missing tests (/blueprint:derive-tests) |
| Surfacing "implicit stories" — code-only features missing from PRD | Validating ADR relationships (/blueprint:adr-validate) |
| Producing a single artifact the team can act on top-to-bottom | Listing existing blueprint docs (/blueprint:docs-list) |
This skill is read-only apart from the audit artifact. PRD edits live in /blueprint:story-reconcile; agent dispatch for gap-fill work lives in /blueprint:work-order.
find docs/blueprint -maxdepth 1 -name 'manifest.json'find docs -maxdepth 1 -name 'prds' -type dfind docs/prds -maxdepth 1 -name '*.md'find docs/blueprint -maxdepth 1 -name 'audits' -type dfind docs/blueprint/audits -maxdepth 1 -name '*.md'find . -maxdepth 3 -type d \( -name tests -o -name __tests__ -o -name test -o -name spec \) -not -path '*/node_modules/*'git rev-parse --show-topleveldate -u +%Y-%m-%dParse $ARGUMENTS:
--scope <area>: Limit discovery to a single capability area (e.g. auth, image-detection). Skips areas whose entry-point paths don't match the scope. Default: full repo.--prd <path>: Override PRD auto-detection. Repeatable — pass multiple --prd flags for multi-PRD projects. Default: every *.md directly under docs/prds/.--no-write: Print the audit to the conversation only; don't write to docs/blueprint/audits/.--report-only: Skip the Step 8 "What next?" prompt. Useful when running this skill from another orchestrator.Execute this audit workflow. Each step is required unless its inputs are missing — in that case, note the missing input in the artifact and continue.
Spawn three Explore subagents via the Task tool in parallel (single message, three tool calls). Each agent returns a structured findings list with file:line evidence; do not ask any agent to write the audit itself.
Agent 1 — Capability map:
Survey this codebase and list every user-facing capability. Group by area (auth, billing, search, …). For each capability emit one row:
<area> | <capability> | <entry-point file:line> | <kind>where kind isroute,cli,event-handler,component,cron, orworker. Flag dependencies that look declared-but-unused (imported library that never has its main API called). Cap output at 200 rows; if a project is larger, summarize tail areas as "+ N more in <area>". Read-only.
Agent 2 — Story extraction:
Read every PRD under {PRD paths from --prd or auto-detected}. Emit one row per stated user story or functional requirement:
<PRD-id> | <story-id-or-section> | <verbatim user-visible behaviour> | <linked deps if any>. Also list any "Known Drift" or status-marked entries verbatim. Don't infer — only extract. Read-only.
Agent 3 — Test inventory:
List every test file under {test directories from Context}. For each file emit:
<file> | <describe-or-suite> | <test-count> | <skipped-or-todo-count>. When a file has a top-level comment or describe block citing a story ID (PRD-NNN, FR-N.N, story-name), include it. Read-only.
Wait for all three to complete. If --scope <area> is set, filter Agent 1's rows to that area before moving on.
Build the drift report by joining Agent 1's capability map against Agent 2's story inventory. For each capability:
| Status | Meaning | |--------|---------| | ✅ implemented | Capability has a matching PRD story | | ⚠️ partial | PRD story exists but capability is missing significant sub-behaviour the story names | | ❌ missing | PRD story has no matching capability — feature declared but not built | | 🆕 candidate | Capability exists but no PRD story matches — implicit story |
Match on substring overlap of capability name vs story title, then verify with a quick file-level read where ambiguous. Do not promote candidates into the PRD here — that is /blueprint:story-reconcile's job.
Also flag declared-but-unused dependencies from Agent 1's findings as ❌ missing drift entries (e.g. "tesseract listed in package.json but never imported").
Build the coverage matrix: for every PRD story from Agent 2, find tests from Agent 3 that match by:
auth/login.ts → auth/login.test.ts)~)Produce one row per story:
<story-id> | <linked tests> | <test-count> | <skipped/todo> | <confidence: ✓ / ~ / ✗>
Stories with zero matched tests become Tier-1 gap candidates.
Apply this default ranking. Override per-row only if the user passed explicit guidance.
| Tier | Combination | Examples |
|------|-------------|----------|
| 1 — critical untested | core capability × zero tests | state machines, auth, payment paths |
| 2 — partial coverage | core capability × ~ confidence tests only | UI flows tested only at the unit level |
| 3 — declared drift | ❌ missing PRD story | OCR named in PRD, never implemented |
| 4 — implicit candidates | 🆕 candidate from Step 2 | code-only features awaiting story promotion |
| 5 — healthy | ✅ with ✓ tests | reference for "what good looks like" |
The tier cutoff between core and non-core is heuristic: Agent 1's kind field is the strongest signal (route and event-handler lean core; component leans non-core). Document the cutoff used at the top of the artifact so the user can override.
If Agent 3 reported test.todo / xit / skip blocks with comments that read like bug reports (rather than "not yet implemented"), collect them into a Bugs surfaced by audit section with file:line + verbatim comment. Do not auto-file issues; the user decides.
Use the template at REFERENCE.md#audit-template and fill all six sections:
Set the artifact path to docs/blueprint/audits/<YYYY-MM-DD>-story-audit.md using the Today value from Context. If a file with that name exists, append -N (e.g. -2).
Skip this step if --no-write is set; print the artifact to the conversation instead.
mkdir -p docs/blueprint/audits
# Write artifact via Write tool to the path computed in Step 6.
Update the task registry in docs/blueprint/manifest.json:
jq --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--arg result "${AUDIT_RESULT:-success}" \
--argjson stories "${STORY_COUNT:-0}" \
--argjson gaps "${TIER1_GAP_COUNT:-0}" \
'.task_registry["story-audit"].last_completed_at = $now |
.task_registry["story-audit"].last_result = $result |
.task_registry["story-audit"].stats.runs_total = ((.task_registry["story-audit"].stats.runs_total // 0) + 1) |
.task_registry["story-audit"].stats.items_processed = $stories |
.task_registry["story-audit"].stats.tier1_gaps = $gaps' \
docs/blueprint/manifest.json > docs/blueprint/manifest.json.tmp \
&& mv docs/blueprint/manifest.json.tmp docs/blueprint/manifest.json
Where AUDIT_RESULT is "success", "{N} drift entries", or "failed: {reason}".
Skip this step if --report-only is set.
Use AskUserQuestion to offer the three downstream paths the audit unlocks:
/blueprint:story-reconcile against this audit/blueprint:work-order per rowDon't loop. The audit is the durable artifact; the user owns the next step.
For the implicit-story detection heuristics by stack (TypeScript/Python/Go), the audit-artifact template, the tier-ranking rationale, and how the skill behaves with no PRD or no tests, see REFERENCE.md.
| Context | Command |
|---------|---------|
| Count PRD files | find docs/prds -maxdepth 1 -name '*.md' |
| Count test files (TS/JS) | find . -type f \( -name '*.test.ts' -o -name '*.test.tsx' -o -name '*.spec.ts' \) -not -path '*/node_modules/*' |
| Count test files (Python) | find . -type f -name 'test_*.py' -not -path '*/.venv/*' |
| Find skipped tests | grep -rn -E "test\.(skip\|todo)\|xit\(\|@pytest.mark.skip" --include='*.test.*' --include='test_*.py' |
| Detect declared deps | jq -r '.dependencies // {} \| keys[]' package.json (or grep '^[a-z].*=' pyproject.toml) |
| Check dep is imported | grep -rln "from <pkg>\|import <pkg>\|require('<pkg>')" --include='*.ts' --include='*.py' |
| Audit filename | echo "docs/blueprint/audits/$(date -u +%Y-%m-%d)-story-audit.md" |
For the audit-artifact template, implicit-story heuristics by language, and tier-ranking rationale, see REFERENCE.md.
testing
Verify accumulated bug claims at upstream HEAD and dedup against trackers before filing issues. Use when filing upstream reports from backlogs, audit docs, or git-history findings.
documentation
Gate outward-bound text (upstream issues, docs, PR bodies) through isolated haiku fresh-reader critique before publishing. Use when an artifact must survive a reader with zero project context.
tools
Suggest improvements to SKILL.md content, descriptions, or tool config from eval results. Use when raising pass rates, fixing triggering, or iterating on a skill after evaluation.
tools
deadbranch CLI for stale-branch cleanup — dry-run preview, TUI or non-interactive delete, protects main/develop/WIP. Use when asked to clean up branches, prune branches, or remove stale branches.