skills/code-audit/SKILL.md
Use this skill whenever existing implementation code needs a rigorous multi-dimensional review — covering code smells, SOLID violations, duplication, algorithm efficiency, security, performance, design pattern fitness, architecture conformance, technology fitness, and a devil's advocate challenge. ALWAYS trigger on: "code audit", "code review", "review this code", "code quality", "code smells", "design patterns review", "architecture review", "is this code good", "review the implementation", "audit this module", "quality check", "assess this codebase". Implicit triggers: user asks whether code is "production-ready", user wants a second opinion on a module, user suspects tech debt but wants specifics, user is onboarding and wants a map of problem areas, user needs evidence for a refactoring ticket. Orchestrates a multi-agent expert panel with model routing (opus for LEAD/ARCH/SEC/SKEPTIC, sonnet for SMELL/DUP/ALGO/PERF/PATTERN/TECH). Reviews **code that exists** — for reviewing **specs before implementation**, use `/spec-panel` instead. Produces a findings report with severity ratings, a quality scorecard, and an ordered improvement roadmap. Does NOT modify code inline — findings route through the fix workflow (systematic-debugging → writing-plans → code-generator skill → requesting-code-review).
npx skillsauth add OmexIT/claude-skills-pack code-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Orchestrates a multi-agent expert panel to conduct a comprehensive review of implemented code — combining static analysis, internet research, expert perspectives, and quantified quality scoring across 10 review dimensions.
This skill reviews code that exists (implementation). For reviewing specs before implementation, use /spec-panel.
This skill is read-only — it produces a findings report, never inline fixes. It sits at a specific point in the superpowers workflow.
Before invoking this skill: nothing. Reviewers analyze existing work and don't need brainstorming or planning upfront.
Invoke this skill (code-audit) to audit existing code across 10 dimensions. Produces findings with severity ratings (CRITICAL/HIGH/MEDIUM/LOW/POSITIVE), quality scorecard, and improvement roadmap.
After findings are produced — for each CRITICAL or HIGH finding, route through the fix workflow:
api-first for controller/service/DTO restructuringtemporal-workflow for saga/orchestration extractionfintech-ledger for money-code restructuringarch-review (paired with this skill for deeper architecture analysis)Hard rule: this skill NEVER produces inline fixes. It produces findings. Fixes happen in a separate pass through the code-generator workflow.
/code-audit $ARGUMENTS
Step 1 — Parse target:
src/payment/PaymentService.javasrc/payment/"the payment processing module"#123 or branch nameStep 2 — Scope determination. Ask only if unclear:
Step 3 — Codebase scan:
# Map the target
find <target> -type f -name "*.java" -o -name "*.ts" -o -name "*.tsx" -o -name "*.py" -o -name "*.go" -o -name "*.dart" | head -50
wc -l <target files>
# Identify test coverage
find <target> -path "*/test*" -type f | head -20
# Check git activity
git log --oneline -20 -- <target>
git shortlog -sn -- <target>
Step 4 — Confirm:
🔍 CODE AUDIT TARGET
Scope: <n> files, ~<n> lines
Language: <detected>
Framework: <detected>
Tests: <n> test files found
Recent activity: <n> commits in last 30 days, <n> contributors
Review dimensions activating: [list based on scope]
Proceeding to Phase 1: Research...
| Agent ID | Role | Review Dimension | Activated When |
|---|---|---|---|
| LEAD | Lead Reviewer / Orchestrator | Overall quality, synthesis | Always |
| ARCH | Architecture Analyst | Architecture conformance, coupling, modularity | Module+ scope |
| SMELL | Code Quality Analyst | Code smells + SOLID violations | Always |
| DUP | Duplication Detective | Code clones (Types 1-4), feature duplication | Always |
| ALGO | Algorithm Analyst | Complexity, data structures, optimization | Always |
| SEC | Security Reviewer | OWASP, auth, injection, secrets, crypto | Always |
| PERF | Performance Analyst | N+1 queries, memory, concurrency, caching | Always |
| PATTERN | Design Pattern Evaluator | Pattern fitness, anti-patterns, over-engineering | Module+ scope |
| ARCH2 | Deep Architecture (optional — delegated to /arch-review) | Clean arch invariants, dep direction | Module+ scope, when deeper structural review needed |
| TECH | Technology Evaluator | Stack fitness, dependency health, alternatives | Feature/codebase scope |
| TESTING | Test Coverage & Quality | Coverage gaps, test smells, flake signals, assertion quality | Always |
| SKEPTIC | Devil's Advocate | Challenges design decisions, finds hidden assumptions | Always |
LEAD always orchestrates and produces the final synthesis. Other agents activate based on scope:
ARCH, ARCH2, TECHTECH unless dependencies are in scope/arch-review via chain, not ARCH2 inline| Agent | Model family | Rationale |
|---|---|---|
| LEAD | opus (claude-opus-4-6) | Synthesis across 10 parallel finding streams — deepest reasoning |
| ARCH, SEC, SKEPTIC | opus | Structural reasoning + vulnerability analysis + independent challenge |
| SMELL, DUP, ALGO, PERF, PATTERN, TESTING | sonnet (claude-sonnet-4-6) | Pattern-recognition tasks — best coding model |
| TECH | sonnet | Dependency and technology evaluation |
All 11 agents execute in a single parallel wave during Phase 2:
run_in_background: true for TECH and PATTERN (lower criticality)Phase 1: LEAD runs Phase 1 — tools + Evidence Manifest (sequential, ~15 tool calls)
↓
Phase 2: 10 analysis agents launch in one message (parallel, 1 wave)
↓
Phase 3: LEAD synthesizes scorecard + roadmap (sequential)
When moving from Phase 1 to Phase 2, launch agents using this exact pattern in a single message:
Agent(subagent_type="code-reviewer", description="Code smells + SOLID",
model="sonnet",
prompt="<Evidence Manifest> + agents/review-dimensions.md §1-2 + files: [...]")
Agent(subagent_type="code-reviewer", description="Duplication detective",
model="sonnet",
prompt="<Evidence Manifest> + agents/review-dimensions.md §3 + files: [...]")
Agent(subagent_type="security-auditor", description="Security review",
model="opus",
prompt="<Evidence Manifest> + agents/review-dimensions.md §5 + files: [...]")
Agent(subagent_type="performance-engineer", description="Performance review",
model="sonnet",
prompt="<Evidence Manifest> + agents/review-dimensions.md §6 + files: [...]")
Agent(subagent_type="quality-engineer", description="Test coverage + quality",
model="sonnet",
prompt="<Evidence Manifest> + agents/review-dimensions.md §11 + files: [...]")
Agent(subagent_type="backend-architect", description="Architecture conformance",
model="opus",
prompt="<Evidence Manifest> + agents/review-dimensions.md §8 + files: [...]")
Agent(subagent_type="general-purpose", description="Devil's advocate",
model="opus",
prompt="<Evidence Manifest> + agents/review-dimensions.md §10 + files: [...]")
# ...plus ALGO, PATTERN, TECH in the same message
Each agent receives:
agents/review-dimensions.mdFor large codebases (1000+ files), enable Agent Teams for competing-hypothesis investigation:
SMELL and SKEPTIC can challenge each other's findingsSEC and PERF can identify tradeoffs between security and performanceCLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 for this modeFrequently confused with /spec-panel and /arch-review. Distinctions:
| Skill | When to use | Input | Output |
|---|---|---|---|
| /code-audit (this) | Reviewing existing implemented code across 11 quality dimensions | Files / modules / directories of real code | Multi-dimensional findings report with scorecard and roadmap |
| /spec-panel | Reviewing a spec before implementation (PRD, BRD, design doc, RFC) | A markdown spec document | IEEE 830 audit + expert panel findings + pre-impl gate |
| /arch-review | Deep dive on clean-architecture invariants (dep direction, tx boundaries, etc.) | A Java/Spring module | Architecture-specific findings + optional ArchUnit setup |
Boundaries:
/spec-panel, not here/arch-review (or chain: code-audit first, then arch-review for deeper structure)/code-audit with focus on PATTERN + ARCH dimensions/code-audit full runWhat this skill will refuse:
/spec-panel with a notePhase 1 is non-negotiable and must complete before any agent is dispatched. A code audit that reviews without reading the real files is speculation. Every step below uses real tools — don't fabricate findings from memory.
Use Glob, Grep, Read, and Bash(git ...). Do not assume — verify.
Enumerate:
# Glob every source file in scope
Glob("<target>/**/*.{java,kt,ts,tsx,js,jsx,py,go,rs,rb,dart}")
Glob("<target>/**/test/**/*.{java,ts,py}") # tests
Glob("<target>/**/*.sql") # migrations / DDL
Read targeted files:
package-info.java / index.ts / __init__.py for public API surfaceMap dependencies via Grep:
Grep("import .*<target-package>", "*.java") → reverse-imports (who uses this code)Grep("new <ClassName>|<ClassName>\\.", <parent>) → instantiation sitesGrep("@RestController|@Controller", <target>) → API surfaceGrep("@Entity|@Table|@Document", <target>) → persistence surfaceGit activity — use Bash with explicit git commands:
git log --oneline -30 -- <target> → recent change frequency (high churn = smell signal)git shortlog -sn -- <target> → ownership (one author = bus factor risk; many = coordination cost)git log --format="%ad %an %s" --date=short -20 -- <target> → authorship over timegit blame <hotspot-file> on suspicious files only — overuse wastes tokensConvention detection — read these files if present:
CLAUDE.md (project root, .claude/, and any subdirectory of the target)README.md (architecture section).editorconfig, .prettierrc, checkstyle.xml, ruff.toml, pyproject.tomlbuild.gradle*, pom.xml, package.json → detect versions, test framework, lint tools*ArchTest.java) → codified architecture rulesdocs/adr/**/*.md → architectural decisions that constrain the codeMinimum evidence required before Phase 2 (this is a hard gate):
git log run — recent commit count and top contributors knownTraining data goes stale. Use real tools.
mcp__context7__resolve-library-id + mcp__context7__query-docs — use this FIRST for every library/framework the code depends on. Required trigger cases:
use, etc.)WebSearch / WebFetch for:
TECH findings)SEC findingsSEC and PERF findingsRules:
CLAUDE.md and quote relevant conventions in the final reportclaudedocs/*-code-audit.md — if this code has been audited before, check whether old findings were addressed, reopened, or ignored. Reopened findings are especially valuable signals.Before Phase 2, produce this manifest and include it verbatim in the final report:
EVIDENCE MANIFEST — <target>
==============================
CODEBASE
Files enumerated: <n> ({<lang>: <n>, <lang>: <n>})
Files read: <n> / <n> in scope (<%>)
Tests read: <n>
Reverse-imports: <n> callers outside target
API surface: <n> public entrypoints ({<n> REST, <n> events, <n> CLI})
GIT ACTIVITY (30d)
Commits on target: <n>
Contributors: <n>
Hotspots (top 3): <file1> (<n>), <file2> (<n>), <file3> (<n>)
Concurrent work: <yes/no> — flag files in open PRs touching the target
STACK VERIFICATION
Language: <e.g. Java 25>
Framework: <e.g. Spring Boot 4.0.4>
Test framework: <e.g. JUnit 5 + Mockito 5 + Testcontainers>
Build tool: <Gradle / Maven / pnpm>
Detected convention sources: [CLAUDE.md, .editorconfig, ArchUnit, ...]
EXTERNAL RESEARCH
context7 queries: [library @ version → key insight]
WebSearch queries: [query → finding]
CVEs surfaced: <n>
Standards consulted: [OWASP / CWE / NIST / RFC ...]
PRIOR AUDIT HISTORY
Previous audits: <n> (paths)
Reopened findings: <n> (these get severity boost)
Never-addressed: <n>
BLOCKERS
<anything preventing reliable review — surface here, do not proceed silently>
Phase 2 cannot start until the Evidence Manifest is produced. Findings without manifest-backed evidence are speculation and must be marked [EVIDENCE: missing] — a reviewer's failure mode.
Read agents/review-dimensions.md for the full 10-dimension protocol. That file defines:
Dispatch all 10 agents in parallel after loading that file. Each agent uses its relevant sections and produces findings in the standard format.
Read references/roadmap-templates.md for the scorecard template, findings summary format, and scoring guide (1-10 with interpretation). Populate the scorecard from the agent outputs.
Read references/roadmap-templates.md for the action-tier tables (Tier 1 — fix now, Tier 2 — this sprint, Tier 3 — schedule) and the refactoring plan template. Group findings into tiers, populate the tables, and produce a concrete refactoring plan for each Tier 1 finding.
Save the full analysis to:
claudedocs/<target-name>-code-audit.md
Use the final report header template from references/roadmap-templates.md at the top of the file.
Tell the user: "Audit saved to claudedocs/<name>-code-audit.md. Next steps: run superpowers:systematic-debugging on CRITICAL findings, then superpowers:writing-plans to turn findings into tickets, then route to a code-generator skill for fixes, then /finalize to commit."
Upstream skills that feed into this:
/spec-to-impl — Code produced from spec implementation/finalize — Code ready for final review before commitDownstream skills that consume this output:
superpowers:systematic-debugging — per CRITICAL findingsuperpowers:writing-plans — remediation planapi-first / temporal-workflow / fintech-ledger — for code-generator fixesarch-review — deeper architecture-specific analysis/test-plan — Test planning informed by coverage gaps found/tech-debt-assessment — Tier 2/3 findings feed debt inventory/performance-review — Deep-dive on performance findings/security-review — Deep-dive on security findingssuperpowers:requesting-code-review — after fixes, before merging/finalize — Commit after fixing Tier 1 findingsAfter audit completes, save reusable patterns:
| File | When to read |
|---|---|
| agents/review-dimensions.md | Phase 2 — dispatching the 10 analysis agents with their dimension-specific checklists |
| references/roadmap-templates.md | Phase 3-5 — scorecard, action tiers, refactoring plan, final report header |
produces:
- type: "code-audit"
format: "markdown"
path: "claudedocs/<target-name>-code-audit.md"
sections:
- scope-and-context
- codebase-investigation
- internet-research
- code-smells-findings
- solid-violations
- duplication-report
- algorithm-analysis
- security-checklist
- performance-checklist
- design-pattern-fitness
- architecture-conformance
- technology-evaluation
- skeptic-challenges
- quality-scorecard
- findings-summary
- improvement-roadmap-tier-1
- improvement-roadmap-tier-2
- improvement-roadmap-tier-3
- refactoring-plans
- recommended-reading
- action-tracker
handoff: "Run superpowers:systematic-debugging per CRITICAL finding. Write claudedocs/handoff-code-audit-<timestamp>.yaml — suggest: superpowers:writing-plans, api-first/temporal-workflow/fintech-ledger (for fixes), arch-review (deeper structure), superpowers:requesting-code-review, /finalize"
tools
Use this skill to verify a completed implementation through live testing — API calls, database state checks, and UI automation with Playwright. Triggers include: "test the implementation", "verify this works", "run API tests", "check the database", "test the UI", "end-to-end verify", "smoke test", "sanity check the implementation", "manually test", or any time an implementation needs post-build validation beyond unit tests. Also triggered automatically by spec-to-impl during the integration review phase. Use this when you want real evidence the system works — not just that tests compile. Can consume a pre-generated e2e/test-plan.yaml from spec-to-impl for fully automated test execution.
development
--- name: ux-review description: Evaluate a UI/UX design or implementation using heuristic analysis, accessibility audit, and cognitive walkthrough. Triggers: "UX review", "usability review", "heuristic evaluation", "accessibility audit", "is this usable". argument-hint: "[feature / screen / URL / mockup]" effort: high --- # UX review ## What I'll do Evaluate a design or implementation for usability, accessibility, and user experience quality using established heuristic frameworks. ## Inputs
development
--- name: user-flow description: Map user journeys through a feature or product, identifying key paths, decision points, friction, error states, and edge cases. Triggers: "user flow", "user journey", "flow diagram", "happy path", "user path". argument-hint: "[feature / user goal]" effort: medium --- # User flow ## What I'll do Map the complete user journey for a feature — from entry point through completion — including happy paths, error states, edge cases, and decision points. > **user-flow
development
Use this skill to produce complete UI/UX design artifacts from a specification document or panel analysis. Triggers include: "design the UI for this spec", "create wireframes", "design this panel", "UX design from spec", "generate component specs", "design tokens", "create the UI design for", "design system for", "wireframe this feature", "design a UI", "create a design system", "design this component", "design the layout", "create a style guide", "design a screen", "UI/UX review", "typography system", "color system", "spacing system", "design this feature", "design the dashboard", "design the onboarding", "create a component library", "design review", "audit the design", "improve the UI", "redesign this", "design system documentation", "create design guidelines", "responsive design", "mobile design", "dark mode design", "design the brand", or any time a spec/panel analysis document needs to be transformed into actionable UI/UX deliverables before implementation. Also triggers for standalone design system creation, component design, design reviews, dark mode/responsive variants, and developer handoff — even before code is involved. Orchestrates a multi-agent design team (UX Lead, UI Designer, Component Architect, Accessibility Reviewer, Design System Engineer, Design Reviewer) in parallel waves. Outputs feed directly into spec-to-impl's FE agent and figma-to-code.