Audit code

From danielvm-git/bigpowers · View interactive version

Audit code is an AI agent skill from the GitHub repository danielvm-git/bigpowers. Self-review checklist for the coding agent to run before dispatching a reviewer. Checks CONVENTIONS.md compliance, Boy Scout Rule, test coverage, types, and SOLID. Produces a pass/fail checklist. Use before request-review, before committing, or when user asks for a code quality check.

How to use this skill

Skill file

Audit Code

HARD GATE — Audit must check for: bugs (correctness), security, performance, and clarity. Do NOT skip security review if the code touches user data, auth, or external APIs.

Target (argument)

If an argument was passed after /audit (e.g. /audit abc1234 or /audit HEAD~3..HEAD), use it as the diff target:

git diff <arg>        # range or two-ref form: abc..def, HEAD~3..HEAD
git show <arg>        # single commit: abc1234

If no argument was given, review uncommitted working-tree changes (git diff + git diff --staged).

Run this self-review before asking anyone else to look at the code. The goal is to catch everything that is clearly wrong or missing — so the reviewer can focus on design and architecture, not hygiene.

Distinct from request-review: This is the coding agent checking its own work. No second agent is involved. Run this first; run request-review after this passes.

Look-here-first (churn heuristic)

Before the checklist, rank changed files by git churn and review high-churn hotspots first — they carry the most latent risk regardless of diff size.

bash scripts/bp-churn-rank.sh --since 90.days --limit 15

Apply the full checklist to churn-ranked files in descending order. Files with zero recent commits but large diffs still get reviewed; churn only sets priority, not scope.

Modes

bash scripts/lib/parallel-review-worktrees.sh audit-code

Checklist

Supply Chain & Security

Provenance & Metadata

Law of Demeter

CONVENTIONS.md Compliance

Scope

Boy Scout Rule

Types and Safety

Test Coverage

SOLID and Heuristics

Refactoring Smells (Fowler)

Explicitly name any detected smells: Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, Primitive Obsession, Message Chains, Middle Man.

Code Style (CONVENTIONS.md)

Red Flags

Before reporting, name any rationalization you caught yourself making for skipping a checklist item. Silence is not acceptable — if you skipped an item, state the reason explicitly.

Output

Report the checklist with ✓ / ✗ per item. For each ✗, describe what needs to be fixed.

If all items pass: suggest running request-review for an independent second opinion.

If any items fail: fix them before proceeding.

In --gate mode, print one summary line per checklist section (PASS Supply Chain / FAIL Provenance (2 items)). Exit 0 only if all PASS. Write full report to specs/verifications/AUDIT-<epic>-<story>.md.

Verify

→ verify: test -f CONVENTIONS.md && test -d skills/enforce-first && test -d skills/request-review

Handoff

Gate: READY -> next: commit-message

Writes: state.yaml handoff.next_skill = commit-message

<!-- story: e01s02 -->

<!-- story: e06s03 -->

<!-- story: e07s01 -->


Clean Code Heuristics (Chapter 17)

A summary of Robert C. Martin's catalogue of code smells and heuristics, used as the technical benchmark for audit-code.

Comments (C)

Environment (E)

Functions (F)

General (G)

Naming (N)

Tests (T)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.