audit-existing
Purpose: produce a fast, structured inventory of what exists before code
generation begins. This prevents plans from assuming greenfield state and
surfaces duplicated contracts, missing tests, and broken wiring early.
When to Use
- Before
/execute-prd drafts a plan from a PRD/prompt/RFC.
- When the requirements source predates the repo and may be out of sync.
- When a user asks "what's already here?" before extending a package.
When NOT to Use
- The repo is provably greenfield (an empty workspace stub) and the
requirement is to scaffold from zero —
/execute-prd will say so and
skip the audit.
- You need to change code — this skill is read-only by contract.
Workflow
- Read repo instructions (
CLAUDE.md) and the active requirements
source, if any.
- List source files, manifests, configs, schemas, migrations, and tests.
- Identify implemented surfaces by package/module.
- Compare current state to the requested scope.
- Flag duplicated public contracts/constants, mismatched API/runtime
types, missing validation, missing failure-path tests, and
generated/native artifacts that may need runtime probes.
- Classify external dependencies using
_internal/dependency-classification/SKILL.md. Flag miscategorizations as test gaps — e.g., Postgres mocked instead of substituted with PGLite, internal services treated as true-external, filesystem mocked instead of using memfs. These miscategorizations are coverage smells: tests pass but exercise the mock, not the real semantics.
- Return an audit only; do not edit files.
Output
## Existing State
- Package/module: implemented surfaces and key files
## Missing Or Partial
- Requirement or surface: evidence
## Duplicated Or Divergent Contracts
- Contract: locations and risk
## Test And Verification Gaps
- Gap: suggested focused verification
## Planning Implications
- Tasks or ownership constraints the execution plan should include
Keep it concise and cite file paths. If the repo is genuinely greenfield,
say so and list the evidence.
Things you must not do
- Do not edit files. The audit is read-only by contract.
- Do not propose fixes — only surface gaps. Fixes are the planner's job.
- Do not duplicate work
/domain-review does. Audit is what exists, not
what's wrong with what exists.
Contract
- Inputs: repository path (default cwd); optional scope hints from the calling skill. Calls
_internal/dependency-classification to label dependencies (mocked / substituted / real).
- Preconditions: in a git repo (or a directory with a recognisable project shape); read access only — never modifies the working tree.
- Outputs: structured audit report listing existing packages, public surfaces, persistence layout, current verification posture, dependency classifications, and gaps relative to the requested feature scope.
- Postconditions: caller (
/execute-prd, /modernize) consumes the audit as a plan input; the audit reports state-of-the-repo, not opinions about state-of-the-repo.
- Failure modes: repo unreadable → halt; asked to propose fixes → refuse and surface the request as a finding (fixes belong to the planner); duplication with
/domain-review requested → refuse — audit is "what exists", review is "what's wrong with what exists".
1---2name: audit-existing3description: Audit a repository before planning or extending it. Produces an implemented/missing/duplicated/broken checklist without editing files.4---56# audit-existing78Purpose: produce a fast, structured inventory of what exists before code9generation begins. This prevents plans from assuming greenfield state and10surfaces duplicated contracts, missing tests, and broken wiring early.1112## When to Use1314- Before `/execute-prd` drafts a plan from a PRD/prompt/RFC.15- When the requirements source predates the repo and may be out of sync.16- When a user asks "what's already here?" before extending a package.1718## When NOT to Use1920- The repo is provably greenfield (an empty workspace stub) and the21 requirement is to scaffold from zero — `/execute-prd` will say so and22 skip the audit.23- You need to *change* code — this skill is read-only by contract.2425## Workflow26271. Read repo instructions (`CLAUDE.md`) and the active requirements28 source, if any.292. List source files, manifests, configs, schemas, migrations, and tests.303. Identify implemented surfaces by package/module.314. Compare current state to the requested scope.325. Flag duplicated public contracts/constants, mismatched API/runtime33 types, missing validation, missing failure-path tests, and34 generated/native artifacts that may need runtime probes.356. **Classify external dependencies** using `_internal/dependency-classification/SKILL.md`. Flag miscategorizations as test gaps — e.g., Postgres mocked instead of substituted with PGLite, internal services treated as true-external, filesystem mocked instead of using `memfs`. These miscategorizations are coverage smells: tests pass but exercise the mock, not the real semantics.367. Return an audit only; do not edit files.3738## Output3940```markdown41## Existing State42- Package/module: implemented surfaces and key files4344## Missing Or Partial45- Requirement or surface: evidence4647## Duplicated Or Divergent Contracts48- Contract: locations and risk4950## Test And Verification Gaps51- Gap: suggested focused verification5253## Planning Implications54- Tasks or ownership constraints the execution plan should include55```5657Keep it concise and cite file paths. If the repo is genuinely greenfield,58say so and list the evidence.5960## Things you must not do6162- Do not edit files. The audit is read-only by contract.63- Do not propose fixes — only surface gaps. Fixes are the planner's job.64- Do not duplicate work `/domain-review` does. Audit is *what exists*, not65 *what's wrong with what exists*.6667## Contract6869- **Inputs:** repository path (default cwd); optional scope hints from the calling skill. Calls `_internal/dependency-classification` to label dependencies (mocked / substituted / real).70- **Preconditions:** in a git repo (or a directory with a recognisable project shape); read access only — never modifies the working tree.71- **Outputs:** structured audit report listing existing packages, public surfaces, persistence layout, current verification posture, dependency classifications, and gaps relative to the requested feature scope.72- **Postconditions:** caller (`/execute-prd`, `/modernize`) consumes the audit as a plan input; the audit reports state-of-the-repo, not opinions about state-of-the-repo.73- **Failure modes:** repo unreadable → halt; asked to propose fixes → refuse and surface the request as a finding (fixes belong to the planner); duplication with `/domain-review` requested → refuse — audit is "what exists", review is "what's wrong with what exists".