codebase-research
Orchestrates comprehensive codebase research by decomposing user queries into parallel sub-agent tasks and synthesizing findings. This skill should be used when users ask questions about how code works, where functionality exists, how components interact, or need comprehensive documentation of existing implementations. It focuses exclusively on documenting and explaining the codebase as it exists today.
mhylle · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add mhylle/claude-skills-collection --skill codebase-research技能说明
name: codebase-research description: Orchestrates comprehensive codebase research by decomposing user queries into parallel sub-agent tasks and synthesizing findings. This skill should be used when users ask questions about how code works, where functionality exists, how components interact, or need comprehensive documentation of existing implementations. It focuses exclusively on documenting and explaining the codebase as it exists today. context: fork allowed-tools: Read, Glob, Grep, Bash
Codebase Research
Contents
- Overview
- Critical Constraint
- Initial Response
- Available Sub-Agents
- Research Workflow
- Agent Selection Guide
- Best Practices
- Example Research Questions
Overview
This skill enables comprehensive codebase research through parallel sub-agent orchestration. It decomposes research questions into focused sub-tasks, executes them in parallel for efficiency, and synthesizes findings into structured research documents.
Critical Constraint
THE ONLY JOB IS TO DOCUMENT AND EXPLAIN THE CODEBASE AS IT EXISTS TODAY.
Do NOT:
- Suggest improvements unless explicitly requested
- Perform uninvited root cause analysis
- Propose enhancements or optimizations
- Critique implementation choices or identify problems
- Recommend refactoring or architectural changes
DO:
- Describe what exists
- Explain where functionality lives
- Document how components work
- Map component interactions and dependencies
Initial Response
When this skill is invoked, respond:
"I'm ready to research the codebase. Please provide your research question or area of interest, and I'll analyze it thoroughly by exploring relevant components and connections."
Available Sub-Agents
Codebase Agents
| Agent | Purpose | When to Use |
|---|---|---|
codebase-locator | Finds files by topic/feature | Need to locate all files related to a feature |
codebase-analyzer | Traces implementation with file:line refs | Need to understand how code works |
codebase-pattern-finder | Finds code patterns with examples | Need to see how patterns are implemented |
Documentation Agents
| Agent | Purpose | When to Use |
|---|---|---|
docs-locator | Finds docs, ADRs, design documents | Need to find documentation about a topic |
docs-analyzer | Extracts decisions and specs from docs | Need to understand documented decisions |
External Research
| Agent | Purpose | When to Use |
|---|---|---|
web-search-researcher | Researches external documentation | Explicitly requested or need external context |
Research Workflow
Step 1: Read Mentioned Files
Read any files directly mentioned by the user completely (without limit/offset parameters) before spawning sub-tasks. This establishes baseline context.
Step 2: Analyze and Decompose
Analyze the research question considering:
- Patterns and architectural implications
- Related components and dependencies
- Potential sub-questions to explore
- Whether documentation exists that provides context
Create a research plan using TodoWrite with specific investigation areas.
Step 3: Spawn Parallel Sub-Agents
Use the Task tool to spawn parallel sub-agents. Match agents to research needs:
For "Where is X? questions:
Task(subagent_type="codebase-locator", prompt="Find all files related to [topic]...")
For "How does X work?" questions:
Task(subagent_type="codebase-analyzer", prompt="Trace the implementation of [feature]...")
For "How should I implement X?" questions:
Task(subagent_type="codebase-pattern-finder", prompt="Find patterns for [type] including examples...")
For "Why was X done this way?" questions:
Task(subagent_type="docs-locator", prompt="Find design docs and ADRs related to [topic]...")
Task(subagent_type="docs-analyzer", prompt="Extract decisions and rationale for [topic]...")
For external documentation needs (only if explicitly requested):
Task(subagent_type="web-search-researcher", prompt="Research [library/API] documentation for [topic]...")
Spawn multiple agents in parallel (single message with multiple Task tool calls) for efficiency.
Step 4: Await and Compile Results
Wait for all sub-agents to complete using AgentOutputTool, then compile results with:
- Live codebase findings as primary source
- Documentation findings as supplementary context
- Historical context from design documents
Step 5: Generate Research Document
Create a structured research document with the following format:
# Research: [Topic]
**Date:** YYYY-MM-DD
**Branch:** [current branch]
**Commit:** [current commit hash]
## Research Question
[The original question being investigated]
## Summary
[2-3 parag
阅读完整来源 ↗