# Plan Audit

> Audits the codebase strictly up to the current active/completed phase or stage of an implementation plan (either an implementation_plan.md artifact or a staged

- Skill: `tger92/plan-audit` (Agent Skill)
- Install (CLI): `npx get-skill add tger92/plan-audit`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tger92/plan-audit/raw
- Safety review: pending
- Works with: any agent that reads SKILL.md (Claude Code, Claude.ai, Cursor, Codex, Windsurf, 60+ more)
- Category: Coding & Dev Tools
- Author: tger92 (https://skillmd.com/u/tger92)
- Updated: 2026-12-03
- Page: https://skillmd.com/skills/tger92/plan-audit

---

---
name: plan-audit
description: Audits the codebase strictly up to the current active/completed phase or stage of an implementation plan (either an implementation_plan.md artifact or a staged docs/<PLAN>.md file from /plan-stage), fixing gaps and unintended mocks while preserving intentional stubs for future phases/stages, and verifies with build/test commands.
---

# Phase- / Stage-Scoped Plan vs. Codebase Audit

When invoked (e.g., `/plan-audit`, `/plan-audit Phase 2`, or `/plan-audit Stage 2 docs/MY_PLAN.md`), execute this strict boundary-scoped audit:

## 1. Establish the Phase / Stage Boundary
- Locate the target plan from either:
  - An explicitly specified plan file path (such as `docs/<PLAN_FILENAME>.md` generated by `/plan-stage`), or
  - The active `implementation_plan.md` artifact.
- Identify the **Target Boundary (`N`)** (specified by the user/orchestrator or inferred as the most recently completed phase or stage).
- Partition the plan into two strict zones:
  - **In-Scope (`Phases 1 through N` or `Stages 1 through N`):** Must be 100% production-ready, wired up, and bug-free.
  - **Out-of-Scope (`Phases/Stages N+1 and beyond`):** Future work. Do NOT implement these yet.
  - **Final Phase/Stage Rule:** When `N` is the **final** phase or stage of the plan, Out-of-Scope is empty and **zero** `STUB(...)` placeholders may remain anywhere in the codebase.

## 2. Hunt Gaps & Defects in `Phases/Stages 1 through N`
- **Requirement Check:** Compare every line item in `Phases/Stages 1 through N` against the codebase. Flag any skipped logic, missing edge cases, or broken types.
- **Unintended Mocks:** Search modified files for `TODO`, `FIXME`, `mock`, `stub`, `placeholder`, or hardcoded dummy data.
  - *If it belongs to `Phases/Stages 1 through N`:* **Delete the mock and write the real implementation.**
  - *If it belongs to `Phases/Stages N+1+`:* **Leave it untouched**, provided it is explicitly tagged (e.g., `// STUB(Phase 3): ...` or `// STUB(Stage 3 / <Item>): ...`) and does not break compilation or runtime execution.
- **Dead Code & Wiring:** Verify that all functions, routes, state handlers, and UI elements from `Phases/Stages 1 through N` are actively imported and connected.

## 3. Remediate & Run Automated Verification Gate
1. Fix every `GAP`, bug, and unintended mock found within `Phases/Stages 1 through N`.
2. **Zero-Diff Clean Pass Rule:** If zero gaps, defects, unintended mocks, or failing checks are found, make **zero file edits** (no formatting tweaks, cosmetic refactors, or comment churn) and report `0` fixes made.
3. Inspect the project root (e.g., `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `Makefile`) to identify the project's **type-checker, linter, build, and test commands**.
4. Run those verification commands via the terminal:
   - *Type-check / Build:* Confirm zero compilation or type errors (including verifying that future `STUB(...)` placeholders satisfy strict types).
   - *Tests:* Run existing unit/integration tests for `Phases/Stages 1 through N`. If a newly implemented feature lacks basic test coverage, write and run tests for it.
5. If any check fails, diagnose and fix the failure, then re-run until all checks pass.

## 4. Final Audit Report
Output a concise **Phase/Stage 1–N Audit Summary** containing:
- A table mapping each requirement in `Phases/Stages 1 through N` to its status (`PASS` or `FIXED`) and file path.
- A list of preserved future stubs (`STUB(Phase X)` / `STUB(Stage X / <Item>)`).
- Confirmation of passing build, type-check, and test outputs before asking to proceed to `Phase/Stage N+1`.

### Automated / Subagent Mode
When invoked by an automated orchestrator (such as `/plan-execute`):
- Do **not** edit the plan's `## Stage Tracker` (the orchestrator owns status transitions).
- Do **not** pause to ask the user whether to proceed — return the requested structured audit output directly.

