agentleFS
arcasilesgrouparcasilesgroup/ai-engineering/skills/code-audit/SKILL.md

code-audit

Skill65 starsChanged 2 months agoApache-2.0View on GitHub

Review code for correctness bugs, concurrency and lifecycle errors, type-safety holes, error handling gaps, API-contract breaks, and maintainability problems, with every finding gated on a concrete failure scenario. Use when asked to review code, check a diff or branch for bugs, look for problems before committing or opening a PR, or assess code quality.

27 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use database-security, malware-analysis and 6 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • JeremyMorganSkill

    database-security

    Examines all database interactions for injection, access control, encryption, and data-exposure risks. Use when auditing database and data-layer security.

    Also in 3 projects that use this

  • tsaleSkill

    malware-analysis

    Professional malware analysis workflow for PE executables and suspicious files. Triggers on file uploads with requests like "analyze this malware", "analyze this sample", "what does this executable do", "check this file for malware", or any request to examine suspicious files. Performs static analysis, threat intelligence triage, behavioral inference, and produces analyst-grade reports with reasoned conclusions.

    Also in 3 projects that use this

  • jefflesterSkill

    api-security

    API security best practices and common vulnerability prevention. Enforces security checks for authentication, input validation, SQL injection, XSS, and OWASP Top 10 vulnerabilities. Use when building or modifying APIs.

    Also in 3 projects that use this

  • QiuChenlySkill

    reverse-engineering

    专业二进制逆向工程分析技能。使用IDA Pro MCP工具分析二进制文件、反编译代码、识别漏洞、理解程序逻辑。当用户要求分析可执行文件、反汇编、逆向工程、漏洞挖掘、恶意软件分析时使用此技能。

    Also in 3 projects that use this

  • SentrySkill

    ui-design

    Also in 3 projects that use this

  • GitHubSkill

    refactor

    Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read .claude/review/CONVENTIONS.md first — stack detection, scope, severity, the false-positive gate, and the report format.

    line 11
  2. Distinctive:

    Do not report style the linter owns, formatting, or subjective preferences.

    line 94
  3. Very specific:

    Check what the project actually has first (per CONVENTIONS.md §1).

    line 98
  4. Distinctive:

    Read every changed file completely, plus the files it imports from and the files that call it.

    line 108
  5. Very specific:

    Follow the output contract in CONVENTIONS.md.

    line 122
  6. Distinctive:

    Every finding needs a Fix that names the specific change — "move the allocation above the early return at line 30 so the deferred close …

    line 125
  7. Distinctive:

    Read by: the human, full-review Dies: with the reviewed diff Next: ai-verify

    line 137

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code audit

Find defects that will actually bite.

Read .claude/review/CONVENTIONS.md first — stack detection, scope, severity, the false-positive gate, and the report format. The installed-version rule is the single most important constraint here: verify against the installed source before calling any framework or library API misuse. Most false positives in a review like this come from reviewing the code as if it were an older version of its framework.

Security is out of scope — that is security-audit. Accessibility is a11y-audit, performance is perf-audit. Overlap is fine; do not go hunting outside your lane.

What to look for

Ordered by how often each actually causes damage. Read files fully — the bug is usually in the interaction between two functions, not inside one.

1. Correctness Logic that produces a wrong result: off-by-one and boundary conditions, inverted or short-circuiting conditionals, null/nil/undefined reaching a dereference, zero-values hitting a truthiness check that meant "absent" (0, "", empty collection, false), index and slice assumptions, integer division and rounding, timezone and DST handling, float comparison, mutation of shared or aliased state, and the classic mutate-while-iterating.

2. Async, concurrency, and ordering Whatever this language's concurrency model is, the failure modes rhyme: operations awaited in the wrong order or not awaited at all; a result used before it is ready; two paths racing on shared state with no synchronization; a lock held across a suspension point or acquired in inconsistent order (deadlock); cancellation that leaves work half-done; retries that are not idempotent; a callback that closes over a value it expects to still be current and is not.

3. Resource and lifecycle management Anything acquired must be released on every path including the error path: file handles, sockets, DB connections and transactions, locks, subscriptions, timers, listeners, watchers, background tasks. Look for a close/unsubscribe/ cancel that exists on the happy path only. In UI frameworks this is the component-teardown path; in servers it is the request-error path.

4. Type safety and data modeling Escape hatches that hide a real mismatch: unchecked casts and assertions, any or its equivalent leaking through an untyped boundary, non-null assertions on values that can genuinely be null, suppression comments with no stated reason, optional fields treated as guaranteed. Then the deeper version: types that model impossible states as valid — an object where two fields must agree and nothing enforces it, a status enum that permits combinations the domain forbids.

5. Error handling Errors swallowed silently, or logged and then execution continues with bad state. Failures with no user-visible or caller-visible outcome. Catch blocks so broad they hide unrelated bugs. Thrown or returned values that are not the language's error type. Missing loading and error states for async work. Error paths that themselves can fail. Partial writes with no rollback.

6. API and contract changes A signature, return shape, status code, event payload, or DB column changed without updating every caller — check the callers, don't assume. Behavior changes that are technically compatible but break a documented promise. Defaults changed underneath existing users. Migrations that are not backwards compatible with the currently deployed code.

7. Framework-specific semantics Load the checks that match the stack you detected, and verify each against the installed version before reporting:

  • Component UI frameworks — stale closures over props/state; missing or dishonest dependency arrays; effects that should have been event handlers or derived values; missing cleanup; unstable list keys over reorderable data; state updates assumed to apply synchronously; derived state duplicated into local state and then desynced.
  • Server frameworks — handler signatures, middleware ordering, request lifecycle, what runs per-request versus once at boot, and any server/client or trusted/untrusted module boundary the framework defines.
  • ORMs and data layers — lazy loading outside a session, N+1 access patterns, transaction boundaries that do not cover the whole unit of work, and implicit connection reuse across concurrent tasks.

8. Maintainability — only where the cost is concrete Duplicated logic that must be changed in lockstep (name both sites). Dead code and unused exports. Functions doing several unrelated things at a level of abstraction their name does not suggest. Names that mislead about behavior. Magic values repeated across files.

Do not report style the linter owns, formatting, or subjective preferences. "I would have structured this differently" is not a finding.

9. Test coverage Check what the project actually has first (per CONVENTIONS.md §1). If a test framework is configured, treat missing coverage of genuinely risky new logic — non-obvious branching, data transforms, parsing, money, dates — as a finding, and name the specific case that is untested. If no framework is configured, do not fabricate failures for missing tests: note it once in Not covered and, if the change is load-bearing, recommend adding a test setup. One note, not one per file.

Method

  1. Detect the stack and resolve scope per CONVENTIONS.md.
  2. Read every changed file completely, plus the files it imports from and the files that call it. A diff read in isolation hides most real bugs.
  3. Collect candidate findings while reading — do not judge yet.
  4. Verify pass. For each candidate, go back to the code and try to disprove it. Check the caller's guarantees, the type, the guard clause you skimmed. If it depends on framework or library behavior, check the installed source now. Drop what does not survive.
  5. Write the report.

Step 4 is the one that determines whether this review is worth reading. Do not skip it, and do not compress it into "looks right".

Report

Follow the output contract in CONVENTIONS.md. Write to .claude/reviews/code-audit-<stamp>.md.

Every finding needs a Fix that names the specific change — "move the allocation above the early return at line 30 so the deferred close always runs", not "improve the resource handling". If the right fix is genuinely a judgment call between two approaches, give both and say which you would pick and why.

Order findings by severity, then by blast radius. Do not pad the report to look thorough — the Checked and clean section is where you demonstrate coverage.

Lifecycle

Lane: full Writes: the code audit report Read by: the human, full-review Dies: with the reviewed diff Next: ai-verify

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.