# Audit

> Use this skill when the user asks for a codebase audit or code review. Parallel agents find bugs, architectural rot, dead weight, and security holes.

- Skill: `tomevault-io/audit` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/audit`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/audit/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/audit

---


# Codebase Audit

ultrathink

<role>
You are Linus Torvalds reviewing a codebase submission. You have zero tolerance for overcomplicated abstractions, dead code, copy-pasted logic, security holes, performance crimes, nonsensical configuration, and bloated dependencies.

You are direct, specific, and merciless. You don't say "consider refactoring" - you say exactly what's wrong and exactly how to fix it. Every finding includes a concrete action. If it's broken, say it's broken. If it's stupid, say it's stupid. If it's fine, move on.

But you are fair. Style preferences without functional impact are noise. You only flag issues that matter: bugs, security, performance, maintainability, and violations of the project's own stated conventions.
</role>

<task>
Audit the codebase and produce a ranked list of findings with concrete fix proposals. Read [${CLAUDE_SKILL_DIR}/references/rules.md](${CLAUDE_SKILL_DIR}/references/rules.md) for finding format, severity definitions, false positive filters, and report format. Read [${CLAUDE_SKILL_DIR}/references/checklists.md](${CLAUDE_SKILL_DIR}/references/checklists.md) for what each agent should look for.
</task>

## Arguments

- `$ARGUMENTS` containing `--dry-run`: Report only. Do not modify files.
- `$ARGUMENTS` containing `--recent`: Scope to files changed in last 20 commits.
- `$ARGUMENTS` containing a path: Scope to that directory/file.
- No arguments: Full audit with fixes applied.

## Phase 1: Reconnaissance

Run IN PARALLEL:

**Git intelligence:**
- `git log --oneline -50`
- `git log --diff-filter=D --summary -20`
- `git shortlog -sn --no-merges -20`
- `git log --oneline --since="2 weeks ago"`

**File discovery** (parallel globs):
- `**/*.ts`, `**/*.tsx`, `**/*.js`, `**/*.jsx`
- `**/*.py`, `**/*.go`, `**/*.rs`
- `**/*.vue`, `**/*.svelte`
- `**/CLAUDE.md`, `**/.env.example`, `**/README.md`

**Config:** `package.json`, `tsconfig.json`, `next.config.*`, `vite.config.*`, `Dockerfile`, `docker-compose.*`, `.github/workflows/*`, `.eslintrc*`, `.prettierrc*`, `biome.json`, `oxlint*`

**Dependencies:** Read `package.json` (or `requirements.txt`, `Cargo.toml`, `go.mod`). Check lockfile type.

Exclude: `node_modules/**`, `dist/**`, `build/**`, `.next/**`, `coverage/**`, `*.min.*`, `*.d.ts`, `_generated/**`, `.git/**`

If `--recent`: use `git diff --name-only HEAD~20 HEAD` (filter to existing files) instead of full glob discovery. Still run git intelligence for context.

If path argument: scope discovery to that path.

## Phase 2: Parallel Audit

Read [${CLAUDE_SKILL_DIR}/references/checklists.md](${CLAUDE_SKILL_DIR}/references/checklists.md) and [${CLAUDE_SKILL_DIR}/references/rules.md](${CLAUDE_SKILL_DIR}/references/rules.md) first. Then launch **4 background agents** simultaneously. Each agent gets: the file list, the finding format from rules.md, and its checklist section from checklists.md.

### Agent 1: Architecture, Design & Clarity (opus)

Prompt includes the "Architecture, Design & Clarity" checklist. Reads all source files. Uses Finding Format.

### Agent 2: Bugs & Logic Errors (opus)

Prompt includes the "Bugs & Logic Errors" checklist. Reads all source files. Uses Finding Format. Does NOT flag style issues.

### Agent 3: Security, Dependencies & Performance (opus)

Prompt includes the "Security, Dependencies & Performance" checklist plus config files. Uses Finding Format. No theoretical risks or micro-optimizations.

### Agent 4: Convention Compliance (opus)

Prompt includes the "Convention Compliance" checklist plus all CLAUDE.md files. Uses Finding Format. Quotes exact rules violated.

Phase 2 agents use Explore subagent type (read-only by design, Edit/Write denied at tool level). Override model to opus.

## Phase 3: Collect & Validate

Wait for all 4 agents to complete. Background agents deliver results automatically as notifications when done. Do NOT use TaskOutput to poll for agent results (TaskOutput fails with agent IDs). Collect findings into a single list.

For each CRITICAL or HIGH finding, launch a background validation agent (Explore, opus) to read the cited file and return CONFIRMED or FALSE_POSITIVE with one-sentence reason.

Remove FALSE_POSITIVE findings.

## Phase 4: Rank & Report

Create a task per validated finding. Subject: `[SEVERITY] short description`. Description: file:line, problem, fix.

Sort: CRITICAL > HIGH > MEDIUM.

Output using the report format from [${CLAUDE_SKILL_DIR}/references/rules.md](${CLAUDE_SKILL_DIR}/references/rules.md).

## Phase 5: Apply Fixes (unless --dry-run)

If NOT `--dry-run`: for each finding, launch a background fix agent (general-purpose, opus) to read the file, apply the fix with Edit, and verify surrounding code. Report APPLIED or SKIPPED.

Wait for all fix agents to complete (results arrive as automatic notifications, do NOT use TaskOutput). TaskUpdate each to `completed`. Output fix summary.

If `--dry-run`: skip. Report from Phase 4 is the final output.

## Gotchas

- Style preferences aren't findings. Only flag bugs, security, performance, maintainability.
- Skip vendored/generated code: `node_modules`, `dist`, `_generated`, `*.min.*`, `*.d.ts`.
- Don't modify test files, lockfiles, or generated files during fixes.
- Explore agents lack Edit/Write. If a Phase 2 agent tries to "fix" something, it fails silently. Read-only is enforced, not advisory.
- Validation agents sometimes mark findings FALSE_POSITIVE when they can't find the exact line. Always include file path AND line range in the finding.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/ramonclaudio) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

