🛰️Subagents

Parallel code audit

Dispatches one Explore subagent per top-level directory and consolidates findings into a tech-debt punch list.

Surfaces
skill · subagent
Complexity
advanced
Trigger
natural
Est. tokens
12,000

What It Does

Scans a large codebase in parallel by launching one Explore subagent per top-level source directory. Each subagent works in its own 200k context window, and only returns a short structured summary. The main agent consolidates, ranks by impact × effort, and produces a punch list.

When It Triggers

  • "Audit this repo for tech debt"
  • "Review the whole codebase"
  • "Find dead code across the monorepo"

Why Subagents

A whole-repo audit would blow past any single context window. Subagents let you parallelize while keeping the main session clean — the main agent only ever sees the consolidated findings, never raw source.

SKILL.md

markdown
---
name: parallel-code-audit
description: Audits a large codebase in parallel by dispatching one Explore subagent per top-level directory. Consolidates findings into a single report. Use when user says "audit this repo", "review the whole codebase", or "find all the tech debt".
---

# Parallel Code Audit

## Steps
1. List top-level source directories (`src/*`, `packages/*`)
2. For each directory, launch an Explore subagent in parallel:
   - Task: identify dead code, TODO comments, N+1 queries, missing tests
   - Return: findings as a JSON list
3. Merge subagent results into a single report
4. Rank findings by impact × effort
5. Produce a punch list for the next tech-debt cycle

## Why Subagents
Each directory gets its own 200k context window. The main agent never sees
the full code — only the consolidated findings.

Cost Notes

  • Each subagent is a full Claude session — 10 subagents on 10 directories ≈ 10× cost.
  • Cap the number of subagents based on repo size; 5-8 is usually the sweet spot.
  • Have subagents return JSON, not prose, to keep the merge step cheap.