Systematic codebase exploration that maps architecture, components, and dependencies. Use when you need to understand how a feature works across a codebase, explore an unfamiliar project's architecture, trace data flow through multiple layers, or plan changes that span several components. Maps the high-level structure first, then dispatches parallel agents to explore each area in depth. Produces a synthesis with file:line references, execution flows, and actionable recommendations.
87
84%
Does it follow best practices?
Impact
90%
1.63xAverage score across 6 eval scenarios
Passed
No findings from the security scan
This skill takes a two-phase approach: discover the structure of the codebase first, then deep dive into each discovered area with targeted parallel agents. The codebase reveals its own organization; you don't assume it upfront.
Core rule: Always run Phase 1 (discovery) before Phase 2 (deep dives). Discovery takes 6-10 minutes and prevents hours of wrong assumptions, repeated grep cycles, and fixes applied to the wrong component. Do not skip it even under time pressure — especially under time pressure.
| Use this skill | Use grep/read instead |
|---|---|
| "How does authentication work?" | "What's the signature of CreateUser?" |
| "I need to understand the payment system" | "Does config.yaml exist?" |
| "What's the architecture of this project?" | "What's on line 45 of main.go?" |
| "Plan changes across multiple services" | "Read the error message in app.log" |
| Prior knowledge may be stale or incomplete | You already ran discovery recently |
Agent: agents/discovery-agent.md
Model: haiku (cost-effective for breadth)
Goal: Map the territory — architecture pattern, components, layers, boundaries.
The discovery agent examines directory structure, config files, documentation, and samples key files to produce a structural map. It does not do deep analysis.
Dispatch:
Task(
description: "Discover codebase architecture",
subagent_type: "Explore",
model: "haiku",
prompt: "Read agents/discovery-agent.md for your instructions. Discover the architecture of this codebase. Target: [USER_TARGET]. Produce output matching the required format in that file."
)Discovery output must include:
Before proceeding to Phase 2, verify the discovery output contains:
If any are missing, re-prompt the discovery agent for the missing sections. Do not proceed with incomplete discovery.
Agent: agents/deep-dive-agent.md (N parallel instances)
Model: sonnet (thorough for depth)
Goal: Understand how [TARGET] works within each discovered area.
Spawn one deep-dive agent per component/layer identified in Phase 1. All run in parallel.
Dispatch (all in a single message):
Task(
description: "Deep dive [LAYER_1]",
subagent_type: "Explore",
model: "sonnet",
prompt: "Read agents/deep-dive-agent.md for your instructions. Explore [TARGET] in [LAYER_1]. Area path: [PATH]. Focus on: [FOCUS_POINTS_FROM_DISCOVERY]. Produce output matching the required format."
)
Task(
description: "Deep dive [LAYER_2]",
subagent_type: "Explore",
model: "sonnet",
prompt: "Read agents/deep-dive-agent.md for your instructions. Explore [TARGET] in [LAYER_2]. Area path: [PATH]. Focus on: [FOCUS_POINTS_FROM_DISCOVERY]. Produce output matching the required format."
)
// ... one per discovered component/layerEach deep-dive agent traces entry points, execution flows, data transformations, and integration points within its assigned area. All claims require file:line references.
Before proceeding to synthesis, verify each deep-dive output contains:
Re-prompt any agent whose output is incomplete.
Actor: You (the orchestrating agent) Goal: Integrate all findings into a single actionable document.
templates/synthesis-output.mdMaintain this status block and update after each phase transition:
SKILL: exploring-codebase
PHASE: [1-Discovery | 2-DeepDive | 3-Synthesis]
TARGET: [what user asked about]
DISCOVERY_COMPLETE: [true/false]
PERSPECTIVES_FOUND: [N]
DEEP_DIVES_COMPLETE: [M/N]
BLOCKED: [any blockers]The skill is complete only when ALL of these are true:
Discovery:
Deep Dives:
Synthesis:
Discovery finds: 5 services (Auth, User, Order, Payment, Notification), event-driven via message bus.
Deep dives adapt: 5 parallel agents, one per service. Each focuses on target within their service, with special attention to event publishing/subscribing at boundaries.
Discovery finds: Single app, 4 layers (HTTP → Application → Domain → Infrastructure), dependency inversion at boundaries.
Deep dives adapt: 4 parallel agents, one per layer. Each traces the target through their layer, focusing on port/adapter contracts.
Final output follows templates/synthesis-output.md:
# [TARGET] Exploration Results
## Architecture Overview
[Pattern, evidence, structure diagram from Phase 1]
## Component Map
[Table: component, path, purpose, key interfaces]
## [TARGET] Analysis
### In [Component/Layer 1]
[Entry points, execution flow, key files from deep-dive agent 1]
### In [Component/Layer 2]
[From deep-dive agent 2]
## Cross-Cutting Patterns
[Patterns observed across multiple areas]
## Integration Points
[How components connect regarding TARGET, with flow diagram]
## Recommendations
[Actionable guidance for user's original goal]
## Next Steps
[Specific actions with file references]| Do | Don't |
|---|---|
| Always run Phase 1 before Phase 2 | Skip discovery because you "already know" |
| Require file:line evidence for all claims | Accept vague statements like "probably in the service layer" |
| Dispatch deep-dive agents in parallel | Run them sequentially |
| Adapt Phase 2 scope based on Phase 1 findings | Use a fixed template regardless of architecture |
| Synthesize into actionable guidance | Dump raw agent outputs |
| Validate outputs at each gate before proceeding | Proceed with incomplete data |
| Use for multi-component understanding | Use for single-file lookups (use Read/Grep) |
This skill works standalone or as a pre-step for other workflows:
emptyaltoidstin/ntm-orchestrator
cf5a710
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.