Run all 9 domain audits in staged waves and aggregate results
Version: 3.1 (9-Domain Coverage with Stage 2.5) Time Savings: 65% faster than sequential (250min -> 65min) Stages: 4 stages with 4+3+2+1 agent configuration
What This Does: Spawns 9 specialized audit agents in staged waves (respecting max 4 concurrent limit), with verification checkpoints and S0/S1 escalation, then aggregates findings into a comprehensive report.
/audit-comprehensiveThis skill orchestrates a complete codebase audit across all 9 domains:
audit-code) - Code hygiene, types, framework patternsaudit-security) - Auth, input validation, OWASP complianceaudit-performance) - Load times, queries, cachingaudit-documentation) - README, API docs, architectureaudit-refactoring) - Technical debt, complexity, DRYaudit-process) - CI/CD, testing, workflowsaudit-engineering-productivity) - DX,
debugging, offline supportaudit-enhancements) - Feature gaps, UX improvementsaudit-ai-optimization) - Token waste, skill overlap,
hook latencyOutput: Single unified report in
docs/audits/comprehensive/audit-YYYY-MM-DD/COMPREHENSIVE_AUDIT_REPORT.md
This skill supports two orchestration modes. Check which is available:
Requires: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in
.claude/settings.json
When agent teams are enabled, use team-based orchestration:
Team advantages: Cross-cutting findings via messages, S0/S1 escalation as team messages, lead handles aggregation directly, no artificial stage boundaries.
Team execution flow:
Token budget: 250K total for the team. If approaching budget, lead messages teammates to wrap up and collects partial results.
CRITICAL RETURN PROTOCOL for all agents (both team and subagent modes):
COMPLETE: [audit-domain] wrote N findings to [output-path]Fallback: If team formation fails or teammates error out, fall back to the staged subagent execution flow below.
When agent teams are NOT enabled, use the 3-stage subagent execution flow below.
Pre-Flight Validation
- Verify all 9 audit skills exist
- Create output directory
- Gather baselines (tests, lint, patterns)
- Load false positives database
|
v
Stage 1: Technical Core (4 agents parallel)
- audit-code, audit-security, audit-performance, audit-refactoring
- Dependency: All 4 agents are independent -- no ordering required
- Checkpoint: verify 4 reports + S0/S1 escalation check
|
v
Stage 2: Supporting (3 agents parallel)
- audit-documentation, audit-process, audit-engineering-productivity
- Dependency: All 3 agents are independent. Stage 2 depends on Stage 1 completion
- Checkpoint: verify 3 reports
|
v
Stage 2.5: Meta & Enhancement (2 agents parallel)
- audit-enhancements, audit-ai-optimization
- Dependency: Both agents are independent. Stage 2.5 depends on Stage 2 completion
- Checkpoint: verify 2 reports
|
v
Stage 3: Aggregation (sequential)
- audit-aggregator -> COMPREHENSIVE_AUDIT_REPORT.md
- Dependency: Requires all 9 domain reports from Stages 1, 2, and 2.5
|
v
Stage 3.5: MASTER_DEBT Deduplication (MANDATORY)
- Cross-reference findings against MASTER_DEBT.jsonl
- Skip already-tracked items, flag possibly-related
- Output: DEDUP_VS_MASTER_DEBT.md
|
v
Post-Audit
- Update AUDIT_TRACKER.md
- Display final summary
- Recommend next steps
Details: See reference/WAVE_DETAILS.md for full agent launch instructions, checkpoint scripts, and status display templates.
Step 0: Episodic Memory Search
Before running audits, search for context from past audit sessions:
mcp__plugin_episodic_memory_episodic_memory__search({
query: ['comprehensive audit', 'findings', 'patterns'],
limit: 5,
});
Why: Compare against previous findings, identify recurring issues, avoid known false positives, track trends.
Step 1: Verify Skills Exist
ls -1 .claude/skills/audit-*/SKILL.md | wc -l
# Should return 9 (excludes audit-comprehensive and audit-aggregator)
If not all present, notify user which audits are missing.
Step 2: Create Output Directory
AUDIT_DATE=$(date +%Y-%m-%d)
mkdir -p docs/audits/comprehensive/audit-${AUDIT_DATE}
Step 2.5: Verify Output Directory (CRITICAL)
AUDIT_DATE=$(date +%Y-%m-%d)
AUDIT_DIR="docs/audits/comprehensive/audit-${AUDIT_DATE}"
AUDIT_PATH=$(realpath "${AUDIT_DIR}" 2>/dev/null || echo "${AUDIT_DIR}")
if [ -z "${AUDIT_DIR}" ] || [ "${AUDIT_PATH}" = "/" ] || [[ "${AUDIT_DIR}" == ".."* ]]; then
echo "FATAL: Invalid or unsafe AUDIT_DIR"
exit 1
fi
Why: Context compaction can cause variable loss. Always verify before agent launches.
Step 3: Run Baseline Checks
npm test 2>&1 | grep -E "Tests:|passing|failed" | head -5
npm run lint 2>&1 | tail -10
npm run patterns:check 2>&1 | head -20
Store results in docs/audits/comprehensive/audit-YYYY-MM-DD/baseline.txt for
reference.
Step 4: Load False Positives
Read docs/technical-debt/FALSE_POSITIVES.jsonl to pass to aggregator.
The COMPREHENSIVE_AUDIT_REPORT.md should contain:
Table format:
| Rank | ID | Severity | Domains | File:Line | Description | Effort |
|---|---|---|---|---|---|---|
| 1 | COMP-001 | S0 | 3 | auth.ts:45 | Missing auth check | E1 |
Complete table grouped by severity, with links to original audit reports.
Do NOT present findings for review until they have been cross-referenced against MASTER_DEBT.jsonl. Skipping this step causes duplicate TDMS intake and inflated debt counts.
docs/technical-debt/MASTER_DEBT.jsonl (all entries)${AUDIT_DIR}/DEDUP_VS_MASTER_DEBT.md# Audit vs MASTER_DEBT Deduplication Report
## Already Tracked (skip intake)
| COMP ID | Matching DEBT ID(s) | DEBT Title | DEBT Status | Notes |
## New Findings (proceed to intake)
| COMP ID | Severity | Description |
## Possibly Related (manual review needed)
| COMP ID | Possible DEBT Match | Similarity | Notes |
Only present New Findings and Possibly Related items in the Interactive Review below. Already Tracked items are skipped entirely — they already exist in TDMS.
Do NOT ingest findings into TDMS until the user has reviewed them.
Present findings in batches of 3-5 items, grouped by severity (S0 first). Each item shows:
### DEBT-XXXX: [Title]
**Severity:** S* | **Effort:** E* | **Confidence:** \_% **Current:** [What
exists now] **Suggested Fix:** [Concrete remediation] **Acceptance Tests:** [How
to verify] **Counter-argument:** [Why NOT to do this] **Recommendation:**
ACCEPT/DECLINE/DEFER -- [Reasoning]
Wait for user decisions on each batch before presenting the next.
Create ${AUDIT_DIR}/REVIEW_DECISIONS.md after the first batch. Update after
each batch. This file survives context compaction.
Add an entry to each of the 9 category tables in
docs/audits/AUDIT_TRACKER.md:
| Date | Session | Commits Covered | Files Covered | Findings | Reset Threshold |
|---|---|---|---|---|---|
| {TODAY} | Comprehensive | Full codebase | All | Session #{N} - [report link] | all |
node scripts/reset-audit-triggers.js --type=comprehensive --apply
Verify with npm run review:check (should show no triggers).
After TDMS intake, triage new items into the roadmap with priority scoring and track assignment.
Details: See reference/TRIAGE_GUIDE.md for priority scoring formula, track assignment matrix, and consistency checks.
If context compacts mid-audit, resume from last completed checkpoint.
Details: See reference/RECOVERY_PROCEDURES.md for recovery matrix, resume commands, and error handling procedures.
Display Final Summary:
COMPREHENSIVE AUDIT COMPLETE
Results Summary:
142 raw findings -> 97 unique (45 merged)
S0 Critical: 3
S1 High: 24
S2 Medium: 42
S3 Low: 28
Cross-Domain Insights:
8 files need comprehensive refactor (4+ audits)
12 security/performance overlaps
5 documentation gaps in complex areas
Full Report:
docs/audits/comprehensive/audit-YYYY-MM-DD/COMPREHENSIVE_AUDIT_REPORT.md
Recommended Next Steps:
1. Review top 20 priority findings
2. Create GitHub issues for S0/S1
3. Plan refactor for hotspot files
Quarterly Health Check / Pre-Release / After Major Refactor:
/audit-comprehensive
Focused Audit (Not Comprehensive):
Use individual skills instead:
/audit-security (25 min - when you only need security review)
/audit-code (30 min - when you only need code quality)
--audits code,security to run subset/audit-code - Individual code quality audit/audit-security - Individual security audit/audit-performance - Individual performance audit/audit-documentation - Individual documentation audit/audit-refactoring - Individual refactoring audit/audit-process - Individual process/automation audit/audit-enhancements - Individual enhancements audit/audit-ai-optimization - Individual AI optimization audit/audit-aggregator - Standalone aggregation (if you have existing reports)/create-audit - Wizard to scaffold new audit typesBefore running this audit, review:
| Version | Date | Description |
|---|---|---|
| 3.2 | 2026-02-22 | Add mandatory MASTER_DEBT dedup step before interactive review |
| 3.1 | 2026-02-14 | Extract reference docs: wave details, recovery, triage guide |
| 3.0 | 2026-02-14 | 9-domain coverage: add enhancements + ai-optimization as Stage 2.5 |
| 2.1 | 2026-02-03 | Added Triage & Roadmap Integration section with priority scoring formula |
| 2.0 | 2026-02-02 | Staged execution (4+2+1), S0/S1 escalation, checkpoints, context recovery |
| 1.0 | 2026-01-28 | Initial version - flat parallel execution of all 6 audits |