بنقرة واحدة
audit-code
Run a single-session code review audit on the codebase
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Run a single-session code review audit on the codebase
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | audit-code |
| description | Run a single-session code review audit on the codebase |
| supports_parallel | true |
| fallback_available | true |
| estimated_time_parallel | 15 min |
| estimated_time_sequential | 50 min |
/audit-code| 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 |
When to use: Task tool available, sufficient context budget
Focus Areas:
Files:
src/**/*.ts, src/**/*.tsxlib/**/*.ts, hooks/**/*.tstypes/**/*.tsFocus Areas:
Files:
src/**/*.tsx (routing, layouts)components/**/*.tsx (component patterns)tests/**/*.test.tsFocus Areas:
Files:
lib/auth*.ts, middleware.tsInvoke 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 framework 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 file
Dependency constraints: All 3 agents are independent -- no ordering required. Each writes to a separate JSONL section. Results are merged after all agents complete.
When to use: Task tool unavailable, context limits, or user preference
Execution Order:
Total: ~50 min (vs ~15 min parallel)
{
"started_at": "ISO timestamp",
"categories_completed": ["Hygiene", "Types"],
"current_category": "Framework",
"findings_count": 18,
"last_file_written": "stage-2-findings.jsonl"
}
Step 0: Episodic Memory Search
Before running code audit, search for context from past code review sessions:
mcp__plugin_episodic_memory_episodic_memory__search({
query: ['code audit', 'patterns', 'quality'],
limit: 5,
});
mcp__plugin_episodic_memory_episodic_memory__search({
query: ['AICode', 'hallucinated', 'dead code'],
limit: 5,
});
Why this matters:
Step 1: Check Thresholds
Run npm run review:check and report results. If no thresholds are triggered:
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
Step 3: Load False Positives Database
Read docs/technical-debt/FALSE_POSITIVES.jsonl and filter findings matching:
codeexpires date passed)Note patterns to exclude from final findings.
Focus Areas (7 Categories):
For each category:
Category Token Requirement (MANDATORY):
category MUST be one of:
Hygiene|Types|Framework|Testing|Security|AICode|DebuggingAICode, not AICode (AI-Generated Code Failure Modes))AI-Code Specific Checks:
expect(true).toBe(true) or trivial assertionsScope:
src/, components/, lib/, hooks/, types/node_modules/, dist/, build/, docs/tests/ excluded for code hygiene, but included when analyzing
Testing Coverage (category 4) and AI-Generated Code (category 6)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.
Read
CANON/templates/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):
| Version | Date | Description |
|---|---|---|
| 1.0 | 2026-02-25 | Initial implementation |
Run a single-session AI optimization audit on the codebase
Run a single-session engineering productivity audit on the codebase
Run a comprehensive enhancement audit across the entire project - code, product, UX, content, workflows, infrastructure, external services, and meta-tooling.
Run a single-session performance audit on the codebase
Run a comprehensive multi-stage automation audit with parallel agents
Run a single-session refactoring audit on the codebase