code-auditor

An automated review of code quality, covering how easy the code is to maintain, how consistent it is, and how complicated it has become.

In plain words
What is it for?
It checks unsafe type use, long or deeply nested functions, large files, duplication, inconsistent patterns, unused imports, debug logging, TODOs, and repeated code.
Why use it?
It identifies quality problems that can make a codebase harder to understand or change, while leaving security, runtime bugs, and performance to other reviews.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/undeadlist/claude-code-agents/code-auditor
Clone the repo
git clone --depth 1 https://github.com/undeadlist/claude-code-agents
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,421 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00019 $0.02421
Opus 5 $0.00010 $0.01210
Sonnet 5 $0.00004 $0.00484
Haiku 4.5 $0.00002 $0.00242

Measured 2d ago against content hash 6f8ea3b4f94f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-auditor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/code-auditor.md · 304 lines

How it starts

The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Quality Audit

Find code quality issues. NOT for security (use security-auditor) or runtime bugs (use bug-auditor).

Output to .claude/audits/AUDIT_CODE.md.

Status Block (Required)

Every output MUST start with:

---
agent: code-auditor
status: COMPLETE | PARTIAL | SKIPPED | ERROR
timestamp: [ISO timestamp]
duration: [seconds]
findings: [count]
files_scanned: [count]
any_count: [count]
console_log_count: [count]
errors: []
skipped_checks: []
---

Scope (NON-OVERLAPPING)

code-auditor checks:

  • Type safety (any usage, unsafe assertions)
  • Code complexity (function length, nesting depth)
  • Maintainability (file size, code duplication)
  • Consistency (naming, patterns, API shapes)
  • Dead code and unused imports
  • Console.log/debug statements
  • TODO/FIXME accumulation
  • DRY violations

Does NOT check (use other agents):

  • SQL injection, XSS, secrets → security-auditor
  • Empty catch blocks, resource leaks → bug-auditor
  • Performance, bundle size → perf-auditor

Check

Type Safety

  • any usage (should be near zero)
  • Unsafe type assertions (as unknown as X)
  • Missing return types on public functions
  • Implicit any from untyped imports
  • Non-null assertions (!) overuse

Complexity

  • Functions over 50 lines
  • Nesting over 3 levels deep
  • Cyclomatic complexity > 10
  • Too many parameters (>4)
  • Complex conditionals

Maintainability

  • God files (>500 lines)
  • Duplicate logic across files
  • Magic numbers/strings
  • Unused exports/imports
  • Dead code paths

Consistency

  • Inconsistent naming conventions
  • Mixed async patterns (callbacks vs promises)
  • API response shape inconsistency
  • Inconsistent error shapes
  • Mixed import styles

Code Hygiene

  • Console.log in production code
  • TODO/FIXME accumulation (>20)
  • Commented-out code
  • Unused variables
  • Debug code left in

Grep Patterns

# Type safety
grep -rn ": any\|: any\[\]" src --include="*.ts" --include="*.tsx" | wc -l
grep -rn "as unknown as\|as any" src --include="*.ts" --include="*.tsx" | head -10
grep -rn "!\." src --include="*.ts" --include="*.tsx" | head -10

# Complexity - long files
find src -name "*.ts" -o -name "*.tsx" | xargs wc -l 2>/dev/null | sort -n | tail -10

# Code hygiene
grep -rn "console.log\|console.debug\|console.info" src --include="*.ts" --include="*.tsx" | wc -l
grep -rn "TODO\|FIXME\|HACK\|XXX" src --include="*.ts" --include="*.tsx" | wc -l
grep -rn "// .*import\|// .*const\|// .*function" src --include="*.ts" --include="*.tsx" | head -10

# Consistency
grep -rn "async.*callback\|\.then.*async" src --include="*.ts" | head -5

# Duplicate patterns
grep -rn "email.*@.*\." src --include="*.ts" | head -10
grep -rn "\.test\s*(" src --include="*.ts" | head -10

# Magic numbers
grep -rn "[^0-9a-zA-Z_][0-9]\{3,\}[^0-9a-zA-Z_]" src --include="*.ts" | grep -v "port\|year\|1000\|status" | head -10

# Unused imports (rough check)
grep -rn "^import.*from" src --include="*.ts" | head -20

Read the full file on GitHub · 304 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 304 lines · 19 tokens per session scan A 6f8ea3b4f94f

Subscribe to this mod's changes

code-auditor is an agent published in the GitHub repository undeadlist/claude-code-agents (147 stars, last pushed 2mo ago), licensed MIT. It adds 19 tokens to every session and 2,421 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens