---
name: explore
description: Deep codebase exploration to answer specific questions
argument-hint: <question>
---

<objective>
Answer questions about the codebase through systematic investigation using parallel exploration agents.
</objective>

<quick_start>
```bash
/explore where is authentication handled?
/explore how does the payment flow work?
/explore what patterns are used for validation?
```
</quick_start>

<workflow>

## 1. Parse Question

- Extract key terms and concepts from question
- Identify file types, patterns, or areas to search
- Determine if web research is needed

## 2. Search Codebase (Parallel Agents)

Launch multiple exploration agents **in parallel**:

**Agent 1: Codebase Exploration** (`explore-codebase`)
```
Find existing code related to: {question}

Report ONLY what exists:
1. Files that contain related code (with paths and line numbers)
2. Existing patterns used for similar features
3. Utility functions that might be relevant
4. How similar features are currently structured
5. Test file locations and patterns

DO NOT suggest what to build. Just report what's there.
```

**Agent 2: Documentation Research** (`explore-docs`)
```
Research documentation for libraries used in: {question}

Find:
1. How the relevant libraries/frameworks work
2. API documentation for tools being used
3. Best practices from official docs
```

**Agent 3: Web Research** (`websearch`) - *if external context needed*
```
Search for context about: {question}

Find:
1. How this is typically implemented
2. Common patterns and approaches
3. Known pitfalls or gotchas
```

**CRITICAL**: Launch agents in a SINGLE message for parallel execution.

## 3. Analyze Findings

- Read relevant files found by agents
- Trace relationships between files
- Identify patterns and conventions
- Note file paths with line numbers (e.g., `src/app.ts:42`)

## 4. Answer Question

Provide comprehensive response:
- Direct answer to the question
- Supporting evidence with file references
- Code examples if relevant
- Architectural context when useful

</workflow>

<execution_rules>

- **PARALLEL SEARCH**: Launch multiple agents simultaneously
- **CITE SOURCES**: Always reference file paths and line numbers
- **STAY FOCUSED**: Only explore what's needed to answer the question
- **BE THOROUGH**: Don't stop at first match - gather complete context
- **ULTRA THINK**: Consider relationships between discovered elements

</execution_rules>

<priority>
Accuracy > Speed > Brevity. Provide complete answers with evidence.
</priority>
