audit-code
Skill2 starsChanged 9 months agoApache-2.0View on GitHub
Run a single-session code review audit on the codebase
We split this skill into the rules it gives an agent
13 rules. 0 are common, 6 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
When the task doesn't match this skill's scope -- check related skills
- Distinctive: line 20
When a more specialized skill exists for the specific task
- Distinctive: line 96
Dependency constraints: All 3 agents are independent -- no ordering required.
- Distinctive: line 140
Before running code audit, search for context from past code review sessions:
- Very specific: line 171
Run npm run review:check and report results.
- Very specific: line 197
If mcp__sonarcloud__get_issues is available, fetch current issue counts:
- Very specific: line 208
Read docs/technical-debt/FALSE_POSITIVES.jsonl and filter findings matching:
- Very specific: line 217
Read docs/audits/multi-ai/templates/CODE_REVIEW_PLAN.md and verify:
- Distinctive: line 224
If outdated, note discrepancies but proceed with current values.
- Distinctive: line 260
Search relevant files using Grep/Glob
- Very specific: line 270
Do NOT include spaces, parentheses, or descriptive suffixes (e.g., output AICode, not AICode (AI-Generated Code Failure Modes))
- Very specific: line 276
Test files with expect(true).toBe(true) or trivial assertions
- Very specific: line 277
Import statements for packages not in package.json
“Common” is measured: kept by at least 6 in 10 of the 8 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.
Files
Single-Session Code Review Audit
When to Use
- Tasks related to audit-code
- User explicitly invokes
/audit-code
When NOT to Use
- When the task doesn't match this skill's scope -- check related skills
- When a more specialized skill exists for the specific task
Execution Mode Selection
| Condition | Mode | Time |
| Task tool available + no context pressure | Parallel | ~15 min |
| Task tool unavailable | Sequential | ~50 min |
| Context running low (<20% remaining) | Sequential | ~50 min |
| User requests sequential | Sequential | ~50 min |
Section A: Parallel Architecture (3 Agents)
When to use: Task tool available, sufficient context budget
Agent 1: hygiene-and-types
Focus Areas:
- Code Hygiene (unused imports, dead code, console.logs)
- Types & Correctness (any types, type safety, null checks)
Files:
app/**/*.tsx,components/**/*.tsxlib/**/*.ts,hooks/**/*.tstypes/**/*.ts
Agent 2: framework-and-testing
Focus Areas:
- Framework Best Practices (React patterns, Next.js conventions)
- Testing Coverage (untested functions, missing edge cases)
Files:
app/**/*.tsx(routing, layouts)components/**/*.tsx(component patterns)tests/**/*.test.ts
Agent 3: security-and-debugging
Focus Areas:
- Security Surface (input validation, auth checks)
- AI-Generated Code Failure Modes
- Debugging Ergonomics
Files:
lib/auth*.ts,middleware.tsfunctions/src/**/*.ts- Error handling code, logging patterns
Parallel Execution Command
Invoke all 3 agents in a SINGLE Task message:
Task 1: hygiene-and-types agent - audit code hygiene and TypeScript patterns
Task 2: framework-and-testing agent - audit React/Next.js patterns and test
coverage Task 3: security-and-debugging agent - audit security, AI patterns,
debugging
Each agent prompt MUST end with:
CRITICAL RETURN PROTOCOL:
- Write findings to the specified output file using Write tool or Bash
- Return ONLY: `COMPLETE: [agent-id] wrote N findings to [output-path]`
- Do NOT return full findings content — orchestrator checks completion via fileDependency constraints: All 3 agents are independent -- no ordering required. Each writes to a separate JSONL section. Results are merged after all agents complete.
Coordination Rules
- Each agent writes findings to separate JSONL section
- Hygiene findings have lowest priority in conflicts
- Security findings have highest priority
- Framework agent handles boundary issues
Section B: Sequential Fallback (Single Agent)
When to use: Task tool unavailable, context limits, or user preference
Execution Order:
- AICode Patterns (catches hallucinations early) - 15 min
- Types & Correctness - 10 min
- Testing Coverage - 10 min
- Remaining categories - 15 min
Total: ~50 min (vs ~15 min parallel)
Checkpoint Format
{
"started_at": "ISO timestamp",
"categories_completed": ["Hygiene", "Types"],
"current_category": "Framework",
"findings_count": 18,
"last_file_written": "stage-2-findings.jsonl"
}Pre-Audit Validation
Step 0: Episodic Memory Search (Session #128)
Before running code audit, search for context from past code review sessions:
// Search for past code audit findings
mcp__plugin_episodic -
memory_episodic -
memory__search({
query: ["code audit", "patterns", "quality"],
limit: 5,
});
// Search for AI-generated code issues addressed before
mcp__plugin_episodic -
memory_episodic -
memory__search({
query: ["AICode", "hallucinated", "dead code"],
limit: 5,
});Why this matters:
- Compare against previous code quality findings
- Identify recurring anti-patterns (may indicate architectural debt)
- Track which issues were resolved vs regressed
- Prevent re-flagging known patterns
Step 1: Check Thresholds
Run npm run review:check and report results. If no thresholds are triggered:
- Display: "⚠️ No review thresholds triggered. Proceed anyway? (This is a lightweight single-session audit)"
- Continue with audit regardless (user invoked intentionally)
Step 2: Gather Current Baselines
Collect these metrics by running commands:
# Test count
npm test 2>&1 | grep -E "Tests:|passing|failed" | head -5
# Lint status
npm run lint 2>&1 | tail -10
# Pattern compliance
npm run patterns:check 2>&1
# Stack versions
grep -E '"(next|react|typescript)"' package.json | head -5Step 2b: Query SonarCloud (if MCP available)
If mcp__sonarcloud__get_issues is available, fetch current issue counts:
- Query with
types: "CODE_SMELL,BUG"andseverities: "CRITICAL,MAJOR" - Compare against baseline from previous SonarCloud sync (778 issues as of 2026-01-05)
- Note any significant changes (>10% increase/decrease)
This provides real-time issue data to cross-reference with audit findings.
Step 3: Load False Positives Database
Read docs/technical-debt/FALSE_POSITIVES.jsonl and filter findings matching:
- Category:
code - Expired entries (skip if
expiresdate passed)
Note patterns to exclude from final findings.
Step 4: Check Template Currency
Read docs/audits/multi-ai/templates/CODE_REVIEW_PLAN.md and verify:
- Stack versions match package.json
- Test count baseline is accurate
- File paths in scope still exist
- Review range in AI_REVIEW_LEARNINGS_LOG.md is current
If outdated, note discrepancies but proceed with current values.
Audit Execution
Focus Areas (7 Categories):
- Code Hygiene (unused imports, dead code, console.logs)
- Types & Correctness (any types, type safety, null checks)
- Framework Best Practices (React patterns, Next.js conventions)
- Testing Coverage (untested functions, missing edge cases)
- Security Surface (input validation, auth checks)
- AICode (AI-Generated Code Failure Modes):
- "Happy-path only" logic, missing edge cases and error handling (S1)
- Tests that exist but don't assert meaningful behavior (S1)
- Hallucinated dependencies/APIs that don't exist (S1)
- Copy/paste anti-patterns (similar code blocks that should be abstracted) (S2)
- Inconsistent architecture patterns across files (S2)
- Overly complex functions (deep nesting, >50 lines) (S2)
- Session Boundary Inconsistencies: Conflicting patterns from different AI sessions (S2)
- Dead Code from Iterations: Commented code, unused variables from AI iterations (S3)
- AI TODO Markers: "TODO: AI should fix this", "FIXME: Claude" patterns (S3)
- Over-Engineering: Unnecessary abstractions, premature optimization (S2)
- Debugging (Debugging Ergonomics) (NEW - 2026-01-13):
- Correlation IDs / request tracing (frontend to backend)
- Structured logging with context (not just console.log)
- Sentry/error tracking integration completeness
- Error messages include actionable fix hints
- Offline/network status captured in error context
For each category:
- Search relevant files using Grep/Glob
- Identify specific issues with file:line references
- Classify severity: S0 (Critical) | S1 (High) | S2 (Medium) | S3 (Low)
- Estimate effort: E0 (trivial) | E1 (hours) | E2 (day) | E3 (major)
- Assign confidence level (see Evidence Requirements below)
Category Token Requirement (MANDATORY):
- In JSONL output,
categoryMUST be one of:Hygiene|Types|Framework|Testing|Security|AICode|Debugging - Do NOT include spaces, parentheses, or descriptive suffixes (e.g., output
AICode, notAICode (AI-Generated Code Failure Modes))
AI-Code Specific Checks:
- Functions with only happy-path logic (no try/catch, no null checks)
- Test files with
expect(true).toBe(true)or trivial assertions - Import statements for packages not in package.json
- Multiple similar code blocks (>10 lines duplicated)
- Functions with >3 levels of nesting
Scope:
- Include:
app/,components/,lib/,hooks/,types/ - Exclude:
node_modules/,.next/,docs/ - Conditional:
tests/excluded for code hygiene, but included when analyzing Testing Coverage (category 4) and AI-Generated Code (category 6)
Output Requirements
1. Markdown Summary (display to user):
## Code Review Audit - [DATE]
### Baselines
- Tests: X passing, Y failing
- Lint: X errors, Y warnings
- Patterns: X violations
### Findings Summary
| Severity | Count | Top Issues | Confidence |
| -------- | ----- | ---------- | ----------- |
| S0 | X | ... | HIGH/MEDIUM |
| S1 | X | ... | HIGH/MEDIUM |
| S2 | X | ... | ... |
| S3 | X | ... | ... |
### Top 5 Issues
1. [file:line] - Description (S1/E1) - DUAL_PASS_CONFIRMED
2. ...
### False Positives Filtered
- X findings excluded (matched FALSE_POSITIVES.jsonl patterns)
### Quick Wins (E0-E1)
- ...
### Recommendations
- ...2. JSONL Findings (save to file):
Create file: docs/audits/single-session/code/audit-[YYYY-MM-DD].jsonl
Category field: category MUST be code-quality
3. Markdown Report (save to file):
Create file: docs/audits/single-session/code/audit-[YYYY-MM-DD].md
Full markdown report with all findings, baselines, and recommendations.
Standard Audit Procedures
Read
.claude/skills/_shared/AUDIT_TEMPLATE.mdfor: Evidence Requirements, Dual-Pass Verification, Cross-Reference Validation, JSONL Output Format, Context Recovery, Post-Audit Validation, MASTER_DEBT Cross-Reference, Interactive Review, TDMS Intake & Commit, Documentation References, Agent Return Protocol, and Honesty Guardrails.
Skill-specific TDMS intake:
node scripts/debt/intake-audit.js <output.jsonl> --source "audit-code-<date>"Code audit triggers (check AUDIT_TRACKER.md):
- 25+ commits since last code audit, OR
- 15+ code files modified since last code audit
Version History
| Version | Date | Description |
| 1.0 | 2026-02-25 | Initial implementation |
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- danielvm-git/bigpowers★ 286same name
- NVIDIA/elements★ 106same name
- Swader/agent-skills-audit★ 19same name
- amatray/claude-skills-public★ 9same name
- ItsNishi/AI-Agent-Security★ 4same name
- FabianVegaA/skills★ 1same name
- Evan-Daruwalla/claude-skill-suite★ 0same name
- tomharris/engineer-agent★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository81 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- find-skillsSkill
- add-debtSkill
- alertsSkill
- analyzeSkill
- artifacts-builderSkill
- audit-agent-qualitySkill
- audit-aggregatorSkill
- audit-ai-optimizationSkill
- audit-comprehensiveSkill
- audit-documentationSkill
- audit-engineering-productivitySkill
- audit-enhancementsSkill
- audit-healthSkill
- audit-performanceSkill
- audit-processSkill
- audit-refactoringSkill
- audit-securitySkill
- brainstormSkill
- checkpointSkill
- code-reviewerSkill
- comprehensive-ecosystem-auditSkill
- content-research-writerSkill
- convergence-loopSkill
- create-auditSkill
- data-effectiveness-auditSkill
- debt-runnerSkill
- decrypt-secretsSkill
- deep-planSkill
- deep-researchSkill
- developer-growth-analysisSkill
- doc-ecosystem-auditSkill
- doc-optimizerSkill
- docs-maintainSkill
- document-analysisSkill
- ecosystem-healthSkill
- Excel AnalysisSkill
- find-skillsSkill
- frontend-designSkill
- gh-fix-ciSkill
- github-healthSkill
- health-ecosystem-auditSkill
- hook-ecosystem-auditSkill
- market-research-reportsSkill
- mcp-builderSkill
- media-analysisSkill
- multi-ai-auditSkill
- pre-commit-fixerSkill
- pr-ecosystem-auditSkill
- pr-retroSkill
- pr-reviewSkill
- quick-fixSkill
- recallSkill
- repo-analysisSkill
- repo-synthesisSkill
- script-ecosystem-auditSkill
- session-beginSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

