{"id":"explore","name":"explore","summary":"内部コードベースの探索を様々な深さ(クイック/ディープ/アーキテクチャ)で探求するためのメタスキル","body":"# Explore - Internal Codebase Exploration\n\nMeta-skill for exploring an internal codebase at varying depths. READ-ONLY workflow - no code changes.\n\n## Usage\n\n```\n/explore <depth> [options]\n```\n\n## Question Flow (No Arguments)\n\nIf the user types just `/explore` with no or partial arguments, guide them through this question flow. Use AskUserQuestion for each phase.\n\n### Phase 0: Workflow Selection\n\n```yaml\nquestion: \"How would you like to explore?\"\nheader: \"Explore\"\noptions:\n  - label: \"Help me choose (Recommended)\"\n    description: \"I'll ask questions to pick the right exploration depth\"\n  - label: \"Quick - fast overview\"\n    description: \"Chain: tldr tree → tldr structure (~1 min)\"\n  - label: \"Deep - comprehensive analysis\"\n    description: \"Chain: onboard → tldr → research → document (~5 min)\"\n  - label: \"Architecture - layers & dependencies\"\n    description: \"Chain: tldr arch → call graph → layer mapping (~3 min)\"\n```\n\n**Mapping:**\n- \"Help me choose\" → Continue to Phase 1-4 questions\n- \"Quick\" → Set depth=quick, skip to Phase 2 (scope)\n- \"Deep\" → Set depth=deep, skip to Phase 2 (scope)\n- \"Architecture\" → Set depth=architecture, skip to Phase 2 (scope)\n\n**If Answer is Unclear (via \"Other\"):**\n```yaml\nquestion: \"I want to understand how deep you want to explore. Did you mean...\"\nheader: \"Clarify\"\noptions:\n  - label: \"Help me choose\"\n    description: \"Not sure - guide me through questions\"\n  - label: \"Quick - fast overview\"\n    description: \"Just want to see what's here\"\n  - label: \"Deep - comprehensive analysis\"\n    description: \"Need thorough understanding\"\n  - label: \"Neither - let me explain differently\"\n    description: \"I'll describe what I need\"\n```\n\n### Phase 1: Exploration Goal\n\n```yaml\nquestion: \"What are you trying to understand?\"\nheader: \"Goal\"\noptions:\n  - label: \"Get oriented in the codebase\"\n    description: \"Quick overview of structure\"\n  - label: \"Understand how something works\"\n    description: \"Deep dive into specific area\"\n  - label: \"Map the architecture\"\n    description: \"Layers, dependencies, patterns\"\n  - label: \"Find where something is\"\n    description: \"Locate specific code/functionality\"\n```\n\n**Mapping:**\n- \"Get oriented\" → quick depth\n- \"Understand how\" → deep depth\n- \"Map architecture\" → architecture depth\n- \"Find where\" → quick with --focus\n\n### Phase 2: Scope\n\n```yaml\nquestion: \"What area should I focus on?\"\nheader: \"Focus\"\noptions:\n  - label: \"Entire codebase\"\n    description: \"Explore everything\"\n  - label: \"Specific directory or module\"\n    description: \"I'll specify the path\"\n  - label: \"Specific concept/feature\"\n    description: \"e.g., 'authentication', 'API routes'\"\n```\n\nIf \"Specific directory\" or \"Specific concept\" → ask follow-up for the path/keyword.\n\n### Phase 3: Output Format\n\n```yaml\nquestion: \"What should I produce?\"\nheader: \"Output\"\noptions:\n  - label: \"Just tell me what you find\"\n    description: \"Interactive summary in chat\"\n  - label: \"Create a documentation file\"\n    description: \"Write to thoughts/shared/docs/\"\n  - label: \"Create handoff for implementation\"\n    description: \"Prepare context for coding agent\"\n```\n\n**Mapping:**\n- \"Documentation file\" → --output doc\n- \"Handoff for implementation\" → --output handoff\n\n### Phase 4: Entry Point (Architecture only)\n\nIf architecture depth selected:\n\n```yaml\nquestion: \"Where should I start the analysis?\"\nheader: \"Entry point\"\noptions:\n  - label: \"Auto-detect (main, cli, app)\"\n    description: \"Find common entry points\"\n  - label: \"Specific function/file\"\n    description: \"I'll specify the entry point\"\n```\n\n### Summary Before Execution\n\n```\nBased on your answers, I'll run:\n\n**Depth:** deep\n**Focus:** \"authentication\"\n**Output:** handoff\n**Path:** src/\n\nProceed? [Yes / Adjust settings]\n```\n\n### Depths\n\n| Depth | Time | What it does |\n|-------|------|--------------|\n| `quick` | ~1 min | tldr-explorer only - fast structure overview |\n| `deep` | ~5 min | onboard + tldr-explorer + research-codebase + write doc |\n| `architecture` | ~3 min | tldr arch + call graph + layer mapping + circular dep detection |\n\n### Options\n\n| Option | Description | Example |\n|--------|-------------|---------|\n| `--focus \"area\"` | Focus on specific area | `--focus \"auth\"`, `--focus \"api\"` |\n| `--output handoff` | Create handoff for next agent | `--output handoff` |\n| `--output doc` | Create documentation file | `--output doc` |\n| `--entry \"func\"` | Start from specific entry point | `--entry \"main\"`, `--entry \"process_request\"` |\n\n## Examples\n\n```bash\n# Quick structure overview\n/explore quick\n\n# Deep exploration focused on auth\n/explore deep --focus \"auth\" --output doc\n\n# Architecture analysis from specific entry\n/explore architecture --entry \"cli\" --output handoff\n\n# Quick focused exploration\n/explore quick --focus \"hooks\"\n```\n\n## Workflow Details\n\n### Quick Depth\n\nFast structure overview using tldr-explorer. Best for:\n- Initial orientation\n- Quick questions about structure\n- Finding where things are\n\n**Steps:**\n1. Run `tldr tree` for file structure\n2. Run `tldr structure` for codemaps\n3. If `--focus` provided, run `tldr search` for targeted results\n4. Return summary\n\n**Commands:**\n```bash\n# 1. File tree\ntldr tree ${PATH:-src/} --ext .py\n\n# 2. Code structure\ntldr structure ${PATH:-src/} --lang python\n\n# 3. Focused search (if --focus provided)\ntldr search \"${FOCUS}\" ${PATH:-src/}\n```\n\n### Deep Depth\n\nComprehensive exploration with documentation output. Best for:\n- First time in a codebase\n- Preparing for major work\n- Creating reference documentation\n\n**Steps:**\n1. Check if onboarded (look for `.claude/cache/tldr/`), if not run onboard\n2. Run tldr-explorer for structure\n3. Spawn research-codebase agent for patterns\n4. Write findings to doc or handoff\n\n**Subprocess:**\n```\n# 1. Onboard check\nif [ ! -f .claude/cache/tldr/arch.json ]; then\n    # Spawn onboard agent\nfi\n\n# 2. Structure analysis\ntldr structure src/ --lang python\ntldr calls src/\n\n# 3. Research patterns (via scout agent)\nTask: research-codebase → \"Document existing patterns in ${FOCUS:-codebase}\"\n\n# 4. Write output\n→ thoughts/shared/research/YYYY-MM-DD-explore-{focus}.md\n→ OR thoughts/shared/handoffs/{session}/explore-{focus}.yaml\n```\n\n### Architecture Depth\n\nArchitecture-focused analysis with layer detection. Best for:\n- Understanding system boundaries\n- Preparing for refactoring\n- Identifying coupling issues\n\n**Steps:**\n1. Run `tldr arch` for layer detection\n2. Run `tldr calls` for cross-file call graph\n3. Analyze entry/middle/leaf layers\n4. Detect circular dependencies\n5. Map architectural boundaries\n\n**Commands:**\n```bash\n# 1. Architecture detection\ntldr arch ${PATH:-src/}\n# Returns: entry_layer, middle_layer, leaf_layer, circular_deps\n\n# 2. Call graph\ntldr calls ${PATH:-src/}\n# Returns: edges, nodes\n\n# 3. Impact analysis from entry point (if --entry provided)\ntldr impact ${ENTRY} ${PATH:-src/} --depth 3\n```\n\n**Output Structure:**\n```yaml\nlayers:\n  entry: [routes.py, cli.py, main.py]  # Controllers/handlers\n  middle: [services.py, auth.py]        # Business logic\n  leaf: [utils.py, helpers.py]          # Utilities\n\ncall_graph:\n  total_edges: 142\n  hot_paths: [process_request → validate → authorize]\n\ncircular_deps:\n  - [module_a, module_b]  # A imports B, B imports A\n\nboundaries:\n  - name: API layer\n    files: [src/api/*]\n    calls_to: [src/services/*]\n```\n\n## Output Formats\n\n### --output doc\n\nCreates: `thoughts/shared/research/YYYY-MM-DD-explore-{focus}.md`\n\n```markdown\n---\ndate: {ISO timestamp}\ntype: exploration\ndepth: {quick|deep|architecture}\nfocus: {focus area or \"full\"}\ncommit: {git hash}\n---\n\n# Codebase Exploration: {focus}\n\n## Summary\n{High-level findings}\n\n## Structure\n{File tree / codemaps}\n\n## Architecture\n{Layer analysis - for architecture depth}\n\n## Key Components\n{Important files and their roles}\n\n## Patterns Found\n{Existing patterns - for deep depth}\n\n## References\n- `path/to/file.py:line` - Description\n```\n\n### --output handoff\n\nCreates: `thoughts/shared/handoffs/{session}/explore-{focus}.yaml`\n\n```yaml\n---\ntype: exploration\nts: {ISO timestamp}\ndepth: {quick|deep|architecture}\nfocus: {focus area}\ncommit: {git hash}\n---\n\nsummary: {One-line summary of findings}\n\nstructure:\n  entry_points: [{main.py}, {cli.py}]\n  key_modules: [{auth.py}, {routes.py}]\n  test_coverage: [{tests/}]\n\narchitecture:\n  layers:\n    entry: [{files}]\n    middle: [{files}]\n    leaf: [{files}]\n  circular_deps: [{pairs}]\n\nfindings:\n  - {key finding with file:line}\n\nnext_steps:\n  - {Recommended action based on exploration}\n\nrefs:\n  - path: {file.py}\n    role: {what it does}\n```\n\n## Integration with /build\n\nThe explore skill is designed to feed into `/build brownfield`:\n\n```bash\n# Step 1: Explore to understand\n/explore architecture --output handoff\n\n# Step 2: Build with context from exploration\n/build brownfield --from-handoff thoughts/shared/handoffs/session/explore-full.yaml\n```\n\n## Implementation\n\nWhen user invokes `/explore <depth> [options]`:\n\n### Parse Arguments\n```python\ndepth = args[0]  # quick | deep | architecture\nfocus = extract_option(args, \"--focus\")\noutput = extract_option(args, \"--output\")  # handoff | doc\nentry = extract_option(args, \"--entry\")\n```\n\n### Execute Based on Depth\n\n**Quick:**\n```bash\n# Just tldr commands, no agents\ntldr tree ${src_dir} --ext .py\ntldr structure ${src_dir} --lang python\nif [ -n \"$focus\" ]; then\n    tldr search \"$focus\" ${src_dir}\nfi\n```\n\n**Deep:**\n```bash\n# 1. Check/run onboard\nif [ ! -f .claude/cache/tldr/meta.json ]; then\n    # Spawn onboard agent via Task tool\nfi\n\n# 2. Structure\ntldr structure src/ --lang python\n\n# 3. Research (spawn scout agent)\n# Task tool with subagent_type: \"scout\"\n# Prompt: \"Research patterns in ${focus:-codebase}\"\n\n# 4. Write output\n# → doc or handoff based on --output\n```\n\n**Architecture:**\n```bash\n# 1. Arch detection\narch_output=$(tldr arch ${src_dir})\n\n# 2. Call graph\ncalls_output=$(tldr calls ${src_dir})\n\n# 3. Impact from entry (if provided)\nif [ -n \"$entry\" ]; then\n    impact_output=$(tldr impact $entry ${src_dir} --depth 3)\nfi\n\n# 4. Synthesize and write output\n```\n\n## Key Principles\n\n1. **READ-ONLY** - This skill never modifies code\n2. **Uses scout, not Explore** - Per project rules, scout (Sonnet) over Explore (Haiku)\n3. **Token-efficient** - Uses tldr commands (95% savings over raw reads)\n4. **Outputs to shared locations** - `thoughts/shared/research/` or handoff directory\n5. **Entry point to /build** - Exploration handoffs feed into brownfield builds\n\n## Related Skills\n\n| Skill | When to Use |\n|-------|-------------|\n| **tldr-explorer** | Direct tldr commands (used internally by explore) |\n| **tldr-code** | Specific analysis commands (cfg, dfg, slice) |\n| **onboard** | First-time project setup (used by deep depth) |\n| **research-codebase** | Pattern documentation (used by deep depth) |\n| **create_handoff** | Handoff format (used by --output handoff) |\n\n## Troubleshooting\n\n**tldr not found:**\n```bash\n# Check if installed\nwhich tldr\n# Install if missing\nuv tool install llm-tldr\n# or: pip install llm-tldr\n```\n\n**No Python files found:**\n```bash\n# Check language, adjust --lang\ntldr structure src/ --lang typescript  # or go, rust\n```\n\n**Empty architecture output:**\n```bash\n# May need to specify src directory\ntldr arch ./  # Current directory\ntldr arch src/  # Explicit src\n```","author":"@parcadei","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/parcadei/Continuous-Claude-v3/tree/main/.claude/skills/explore","license":"MIT","category":"document","lang":"en","tokens":2975,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":["Bash","Task","Read","Glob","Grep","Write"]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}