Skip to main content
skill CX Codex

audit · rainmanjam — Claude Code skill for code structure reviews

This skill reviews working code for structural issues and ranks findings by the cost of leaving them in place. Use it when planning a refactor and deciding which problems matter first.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add rainmanjam/poka-yoke --skill audit -a claude-code
Open on GitHub

What audit does

The review covers public functions and classes, names, imports, long functions, and tests. It looks for mixed responsibilities, stale names, dependencies that point toward infrastructure, diverged copies, and implicit state. Formatting and import order do not count as findings.

Findings should point to specific lines, appear in order of expected cost, and explain the structural problem before suggesting a small fix. The skill also asks the reviewer to say which areas were checked and left alone, with a reason. It focuses on code structure, not whether business rules are correct; a long function alone is not enough to flag it.

What it helps with

  • spot functions that combine unrelated responsibilities
  • catch names that no longer match their implementation
  • find business logic tied to infrastructure
  • identify which diverged copy should be treated as correct
  • rank structural findings by the cost of leaving them

Example prompts for the agent

  • Review this code's structure and report significant issues with line references.
  • Find copies of the same logic that have drifted, and say which one is correct.
  • Check dependency direction and testability, then suggest the smallest useful changes.

How to install audit

1Skills CLI (Vercel)

npx skills add rainmanjam/poka-yoke --skill audit -a claude-code

2Manually: put the files in place

~/.claude/skills/audit/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/audit/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about audit

How do I install audit in Claude Code?

Run npx skills add rainmanjam/poka-yoke --skill audit -a claude-code. The skill file is installed at ~/.claude/skills/audit/SKILL.md.

What does the audit skill do?

It reviews working code for structural issues and orders its findings by the expected cost of leaving them in place. Findings should include line references and a targeted fix.

Does audit flag every long function?

No. It looks for responsibilities that have ended up together and weighs how often the code changes; length alone is not a finding.

Source text

SKILL.md · MIT
---
name: audit
description: >-
  Reviewing code that already exists for structural problems: responsibilities that have drifted
  together, names that no longer describe what they name, dependencies pointing the wrong way,
  and duplication that has hardened into divergence.
---

# Audit: Reading Code That Already Works

Everything you are looking at ships and passes its tests. That is the constraint. You are not
hunting for bugs; you are finding the places where the structure will make the *next* change
expensive or risky, and saying which ones are worth paying to fix now.

That framing matters, because a review that lists everything imperfect is indistinguishable
from a review that found nothing important.

## Read in this order

**1. The public surface.** Exported functions, classes and endpoints. This is what other code
depends on, so problems here have the largest blast radius and the highest migration cost.

**2. The names.** Read them without reading the bodies. Any name that turns out to be wrong
once you read the implementation is a finding, because every future reader will make the same
mistake you just did.

**3. The imports.** They show the dependency direction at a glance. Business logic importing a
web framework, an ORM or a mail client is the single most reliable structural smell.

**4. The longest functions.** Not because length is the problem, but because that is where
several responsibilities usually ended up together.

**5. The tests.** Tests are a readout of the design. Heavy mocking means tangled dependencies.
Long setup means complicated construction. Absent tests for the core logic usually means the
core logic is hard to reach.

## What to look for

**Responsibilities that drifted together.** Describe the unit in one sentence. If you need
"and", note where the seam is: which parts change for different reasons, and on whose schedule.

**Names that have gone stale.** A function called `validate_user` that also creates a session.
A `TempFile` class that outlives the request. A `config` parameter that is actually a feature
flag. The code changed, the name did not, and the name is what the next reader trusts.

**Dependency direction.** Which module could not be tested, reused or moved without dragging
something heavy behind it? That is coupling with a cost you can name.

**Duplication that has diverged.** Two copies that started identical and have drifted are worse
than either one alone, because a fix applied to one leaves the other wrong. Note which is
correct.

**Ambient state.** Module-level singletons, globals, and implicit context. Each makes a unit's
behaviour depend on something not visible at its call site.

**Boolean parameters at call sites.** `render(rows, True, False)` cannot be read. Note it where
the call sites are numerous enough for the confusion to be real.

**Comments explaining what the code does.** Usually a sign the code does not say it. The
comment is not the finding; what forced it is.

## Ranking, which is most of the value

An unordered list of twenty observations moves nothing. Rank by expected cost of leaving it,
which is roughly *how often this code changes* multiplied by *how badly the structure hurts
when it does*.

- **High:** misleading names on widely-called functions; business logic that cannot be tested without infrastructure; diverged duplication where one copy is wrong.
- **Medium:** long multi-responsibility functions in code that changes regularly; ambient state; unclear module boundaries.
- **Low:** long functions in stable code nobody touches; naming that is imperfect but unambiguous; local inconsistency in a file that is otherwise clear.
- **Not a finding:** formatting, brace style, import order, and anything a tool should own. Raising these spends the reader's attention and teaches them to skim the rest.

## Say what you did not flag

A review that lists only problems reads as though everything unmentioned was examined and
approved. Name what you looked at and considered acceptable, and why:

> The `reports/` package has three near-identical builders. I left them: they render for
> different audiences and have changed independently twice, so the duplication is carrying real
> variation rather than hiding it.

That sentence is worth more than three more findings, because it tells the reader what your
threshold was.

## What good output looks like

- **Anchored to lines.** `orders.py:142, apply_discount` is reviewable; "the discount logic" is not.
- **Problem before fix.** State what the structure costs, then what you would do.
- **Ordered by cost**, with the ordering visible, so the reader can stop partway and still have covered the important ones.
- **Sized honestly.** If three findings matter, give three. Padding to a round number buries them.
- **With the shape shown.** A short before-and-after communicates faster than a paragraph.

## What to avoid

**Rewriting to taste.** Code that is consistent and clear but not your style is not a finding.
Local consistency beats individual improvement.

**Findings that are true everywhere.** "Consider adding tests" and "reduce coupling" apply to
every codebase and therefore inform nothing about this one.

**Reviewing the domain instead of the code.** Whether the discount rules are correct is a
question for whoever owns them; whether they are legible and changeable is yours.

**Proposing a rewrite.** A large restructuring cannot be reviewed, so it will be merged on
trust. Propose the smallest change that removes the problem you named.

**Counting lines as complexity.** A hundred-line function doing one thing in sequence is easier
to follow than five short ones threading state between them.

© rainmanjam · MIT · rainmanjam/poka-yoke

Similar skills

All skills for Code review and refactoring →

audit by other authors comes first.

audit jsmastery-pro Scans codebases to generate and gap fill AGENTS.md context files. Helps bootstrap shared rules for AI assistants on greenfield or legacy repos. CX Codex +1 4,300installs audit educlopez Runs a technical UI audit across accessibility, performance and responsiveness, then hands back a prioritized findings table. CX Codex +1 929installs audit calm-north This skill walks a site through five layers of SEO review: technical foundation, on-page work, content quality, link profile and competitive position. CX Codex +1 6,400installs audit official OpenAI Walks through product flows step by step, captures verified screenshots, and flags UX and accessibility issues in chat. CX Codex GP ChatGPT 10installs audit aladicf Runs code-level checks on accessibility, performance, theming, responsive design and anti-patterns. Returns a scored report with a fix plan. CX Codex +1 625installs improve-codebase-architecture Matt Pocock This skill scans a codebase for architectural friction, then builds a visual HTML report with refactoring candidates. Use it before a deeper architecture review. 1,163,035installs tdd Matt Pocock Guides the red-green TDD loop: ensures tests are written first, keep them at public interfaces, and avoid coupling to implementation details. 1,141,062installs triage Matt Pocock This skill moves issues and external PRs through triage states, verification, and agent briefs. It fits maintainers managing an issue queue. 990,453installs codebase-design Matt Pocock This skill helps design modules with small interfaces and hidden complexity. Use it when refactoring code, choosing a seam, or making tests easier to write. 850,344installs code-review Matt Pocock Reviews changes from a chosen reference point against repository standards and the originating spec. Use it for a branch, PR, or work in progress. 789,521installs implement Matt Pocock Implements work from a specification or tickets, following a test-driven flow and ending with review and a commit. Use it when a coding task needs a defined delivery routine. 774,700installs

From the same set20

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor