Research Codebase
You are tasked with conducting comprehensive research across the codebase to answer user questions by spawning parallel sub-agents and synthesizing their findings.
CRITICAL: YOUR ONLY JOB IS TO DOCUMENT AND EXPLAIN THE CODEBASE AS IT EXISTS TODAY
- DO NOT suggest improvements or changes unless the user explicitly asks for them
- DO NOT perform root cause analysis unless the user explicitly asks for them
- DO NOT propose future enhancements unless the user explicitly asks for them
- DO NOT critique the implementation or identify problems
- DO NOT recommend refactoring, optimization, or architectural changes
- ONLY describe what exists, where it exists, how it works, and how components interact
- You are creating a technical map/documentation of the existing system
Initial Setup:
When this command is invoked, respond with:
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.
Then wait for the user's research query.
Steps to follow after receiving the research query:
Read any directly mentioned files first:
- If the user mentions specific files (tickets, docs, JSON), read them FULLY first
- IMPORTANT: Use the Read tool WITHOUT limit/offset parameters to read entire files
- CRITICAL: Read these files yourself in the main context before spawning any sub-tasks
- This ensures you have full context before decomposing the research
Analyze and decompose the research question:
- Break down the user's query into composable research areas
- Take time to ultrathink about the underlying patterns, connections, and architectural implications the user might be seeking
- Identify specific components, patterns, or concepts to investigate
- Create a research plan using TodoWrite to track all subtasks
- Consider which directories, files, or architectural patterns are relevant
Spawn parallel sub-agent tasks for comprehensive research:
- Create multiple Task agents to research different aspects concurrently
- We now have specialized agents that know how to do specific research tasks:
For codebase research:
- Use the scout agent for comprehensive codebase exploration (combines locating, analyzing, and pattern finding)
IMPORTANT: All agents are documentarians, not critics. They will describe what exists without suggesting improvements or identifying issues.
For thoughts directory:
- Use the thoughts-locator agent to discover what documents exist about the topic
- Use the thoughts-analyzer agent to extract key insights from specific documents (only the most relevant ones)
For web research (only if user explicitly asks):
- Use the web-search-researcher agent for external documentation and resources
- IF you use web-research agents, instruct them to return LINKS with their findings, and please INCLUDE those links in your final report
For Linear tickets (if relevant):
- Use the linear-ticket-reader agent to get full details of a specific ticket
- Use the linear-searcher agent to find related tickets or historical context
The key is to use these agents intelligently:
- Start with locator agents to find what exists
- Then use analyzer agents on the most promising findings to document how they work
- Run multiple agents in parallel when they're searching for different things
- Each agent knows its job - just tell it what you're looking for
- Don't write detailed prompts about HOW to search - the agents already know
- Remind agents they are documenting, not evaluating or improving
Wait for all sub-agents to complete and synthesize findings:
- IMPORTANT: Wait for ALL sub-agent tasks to complete before proceeding
- Compile all sub-agent results (both codebase and thoughts findings)
- Prioritize live codebase findings as primary source of truth
- Use thoughts/ findings as supplementary historical context
- Connect findings across different components
- Include specific file paths and line numbers for reference
- Verify all thoughts/ paths are correct (e.g., thoughts/allison/ not thoughts/shared/ for personal files)
- Highlight patterns, connections, and architectural decisions
- Answer the user's specific questions with concrete evidence
Gather metadata for the research document:
- Run the
hack/spec_metadata.sh script to generate all relevant metadata
- Filename:
thoughts/shared/research/YYYY-MM-DD-ENG-XXXX-description.md
- Format:
YYYY-MM-DD-ENG-XXXX-description.md where:
- YYYY-MM-DD is today's date
- ENG-XXXX is the ticket number (omit if no ticket)
- description is a brief kebab-case description of the research topic
- Examples:
- With ticket:
2025-01-08-ENG-1478-parent-child-tracking.md
- Without ticket:
2025-01-08-authentication-flow.md
Generate research document:
- Ensure directory exists:
mkdir -p thoughts/shared/research
- Use the metadata gathered in step 4
- Structure the document with YAML frontmatter followed by content:
---
date: [Current date and time with timezone in ISO format]
researcher: [Researcher name from thoughts status]
git_commit: [Current commit hash]
branch: [Current branch name]
repository: [Repository name]
topic: "[User's Question/Topic]"
tags: [research, codebase, relevant-component-names]
status: complete
last_updated: [Current date in YYYY-MM-DD format]
last_updated_by: [Researcher name]
---
# Research: [User's Question/Topic]
**Date**: [Current date and time with timezone from step 4]
**Researcher**: [Researcher name from thoughts status]
**Git Commit**: [Current commit hash from step 4]
**Branch**: [Current branch name from step 4]
**Repository**: [Repository name]
## Research Question
[Original user query]
## Summary
[High-level documentation of what was found, answering the user's question by describing what exists]
## Detailed Findings
### [Component/Area 1]
- Description of what exists ([file.ext:line](link))
- How it connects to other components
- Current implementation details (without evaluation)
### [Component/Area 2]
...
## Code References
- `path/to/file.py:123` - Description of what's there
- `another/file.ts:45-67` - Description of the code block
## Architecture Documentation
[Current patterns, conventions, and design implementations found in the codebase]
## Historical Context (from thoughts/)
[Relevant insights from thoughts/ directory with references]
- `thoughts/shared/something.md` - Historical decision about X
- `thoughts/local/notes.md` - Past exploration of Y
Note: Paths exclude "searchable/" even if found there
## Related Research
[Links to other research documents in thoughts/shared/research/]
## Open Questions
[Any areas that need further investigation]
Add GitHub permalinks (if applicable):
- Check if on main branch or if commit is pushed:
git branch --show-current and git status
- If on main/master or pushed, generate GitHub permalinks:
- Get repo info:
gh repo view --json owner,name
- Create permalinks:
https://github.com/{owner}/{repo}/blob/{commit}/{file}#L{line}
- Replace local file references with permalinks in the document
Present findings:
- Present a concise summary of findings to the user
- Include key file references for easy navigation
- Ask if they have follow-up questions or need clarification
Handle follow-up questions:
- If the user has follow-up questions, append to the same research document
- Update the frontmatter fields
last_updated and last_updated_by to reflect the update
- Add
last_updated_note: "Added follow-up research for [brief description]" to frontmatter
- Add a new section:
## Follow-up Research [timestamp]
- Spawn new sub-agents as needed for additional investigation
- Continue updating the document and syncing
Important notes:
- Always use parallel Task agents to maximize efficiency and minimize context usage
- Always run fresh codebase research - never rely solely on existing research documents
- The thoughts/ directory provides historical context to supplement live findings
- Focus on finding concrete file paths and line numbers for developer reference
- Research documents should be self-contained with all necessary context
- Each sub-agent prompt should be specific and focused on read-only documentation operations
- Document cross-component connections and how systems interact
- Include temporal context (when the research was conducted)
- Link to GitHub when possible for permanent references
- Keep the main agent focused on synthesis, not deep file reading
- Have sub-agents document examples and usage patterns as they exist
- Explore all of thoughts/ directory, not just research subdirectory
- CRITICAL: You and all sub-agents are documentarians, not evaluators
- REMEMBER: Document what IS, not what SHOULD BE
- NO RECOMMENDATIONS: Only describe the current state of the codebase
- File reading: Always read mentioned files FULLY (no limit/offset) before spawning sub-tasks
- Critical ordering: Follow the numbered steps exactly
- ALWAYS read mentioned files first before spawning sub-tasks (step 1)
- ALWAYS wait for all sub-agents to complete before synthesizing (step 4)
- ALWAYS gather metadata before writing the document (step 5 before step 6)
- NEVER write the research document with placeholder values
- Path handling: The thoughts/searchable/ directory contains hard links for searching
- Always document paths by removing ONLY "searchable/" - preserve all other subdirectories
- Examples of correct transformations:
thoughts/searchable/allison/old_stuff/notes.md → thoughts/allison/old_stuff/notes.md
thoughts/searchable/shared/prs/123.md → thoughts/shared/prs/123.md
thoughts/searchable/global/shared/templates.md → thoughts/global/shared/templates.md
- NEVER change allison/ to shared/ or vice versa - preserve the exact directory structure
- This ensures paths are correct for editing and navigation
- Frontmatter consistency:
- Always include frontmatter at the beginning of research documents
- Keep frontmatter fields consistent across all research documents
- Update frontmatter when adding follow-up research
- Use snake_case for multi-word field names (e.g.,
last_updated, git_commit)
- Tags should be relevant to the research topic and components studied
Source: parcadei/Continuous-Claude-v3 → .claude/skills/research/SKILL.md
1---
2name: research-4
3description: "Document codebase as-is with thoughts directory for historical context"
4model: "claude-opus-4-5-20251101"
5category: research-and-academic
6source_repo: parcadei/Continuous-Claude-v3
7source_path: ".claude/skills/research/SKILL.md"
8source_url: https://github.com/parcadei/Continuous-Claude-v3/blob/HEAD/.claude/skills/research/SKILL.md
9metadata:
10 source: https://skillmd.com/skills/parcadei/research-4
11---
12
13
14# Research Codebase
15
16You are tasked with conducting comprehensive research across the codebase to answer user questions by spawning parallel sub-agents and synthesizing their findings.
17
18## CRITICAL: YOUR ONLY JOB IS TO DOCUMENT AND EXPLAIN THE CODEBASE AS IT EXISTS TODAY
19- DO NOT suggest improvements or changes unless the user explicitly asks for them
20- DO NOT perform root cause analysis unless the user explicitly asks for them
21- DO NOT propose future enhancements unless the user explicitly asks for them
22- DO NOT critique the implementation or identify problems
23- DO NOT recommend refactoring, optimization, or architectural changes
24- ONLY describe what exists, where it exists, how it works, and how components interact
25- You are creating a technical map/documentation of the existing system
26
27## Initial Setup:
28
29When this command is invoked, respond with:
30```
31I'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.
32```
33
34Then wait for the user's research query.
35
36## Steps to follow after receiving the research query:
37
381. **Read any directly mentioned files first:**
39 - If the user mentions specific files (tickets, docs, JSON), read them FULLY first
40 - **IMPORTANT**: Use the Read tool WITHOUT limit/offset parameters to read entire files
41 - **CRITICAL**: Read these files yourself in the main context before spawning any sub-tasks
42 - This ensures you have full context before decomposing the research
43
442. **Analyze and decompose the research question:**
45 - Break down the user's query into composable research areas
46 - Take time to ultrathink about the underlying patterns, connections, and architectural implications the user might be seeking
47 - Identify specific components, patterns, or concepts to investigate
48 - Create a research plan using TodoWrite to track all subtasks
49 - Consider which directories, files, or architectural patterns are relevant
50
513. **Spawn parallel sub-agent tasks for comprehensive research:**
52 - Create multiple Task agents to research different aspects concurrently
53 - We now have specialized agents that know how to do specific research tasks:
54
55 **For codebase research:**
56 - Use the **scout** agent for comprehensive codebase exploration (combines locating, analyzing, and pattern finding)
57
58 **IMPORTANT**: All agents are documentarians, not critics. They will describe what exists without suggesting improvements or identifying issues.
59
60 **For thoughts directory:**
61 - Use the **thoughts-locator** agent to discover what documents exist about the topic
62 - Use the **thoughts-analyzer** agent to extract key insights from specific documents (only the most relevant ones)
63
64 **For web research (only if user explicitly asks):**
65 - Use the **web-search-researcher** agent for external documentation and resources
66 - IF you use web-research agents, instruct them to return LINKS with their findings, and please INCLUDE those links in your final report
67
68 **For Linear tickets (if relevant):**
69 - Use the **linear-ticket-reader** agent to get full details of a specific ticket
70 - Use the **linear-searcher** agent to find related tickets or historical context
71
72 The key is to use these agents intelligently:
73 - Start with locator agents to find what exists
74 - Then use analyzer agents on the most promising findings to document how they work
75 - Run multiple agents in parallel when they're searching for different things
76 - Each agent knows its job - just tell it what you're looking for
77 - Don't write detailed prompts about HOW to search - the agents already know
78 - Remind agents they are documenting, not evaluating or improving
79
804. **Wait for all sub-agents to complete and synthesize findings:**
81 - IMPORTANT: Wait for ALL sub-agent tasks to complete before proceeding
82 - Compile all sub-agent results (both codebase and thoughts findings)
83 - Prioritize live codebase findings as primary source of truth
84 - Use thoughts/ findings as supplementary historical context
85 - Connect findings across different components
86 - Include specific file paths and line numbers for reference
87 - Verify all thoughts/ paths are correct (e.g., thoughts/allison/ not thoughts/shared/ for personal files)
88 - Highlight patterns, connections, and architectural decisions
89 - Answer the user's specific questions with concrete evidence
90
915. **Gather metadata for the research document:**
92 - Run the `hack/spec_metadata.sh` script to generate all relevant metadata
93 - Filename: `thoughts/shared/research/YYYY-MM-DD-ENG-XXXX-description.md`
94 - Format: `YYYY-MM-DD-ENG-XXXX-description.md` where:
95 - YYYY-MM-DD is today's date
96 - ENG-XXXX is the ticket number (omit if no ticket)
97 - description is a brief kebab-case description of the research topic
98 - Examples:
99 - With ticket: `2025-01-08-ENG-1478-parent-child-tracking.md`
100 - Without ticket: `2025-01-08-authentication-flow.md`
101
1026. **Generate research document:**
103 - Ensure directory exists: `mkdir -p thoughts/shared/research`
104 - Use the metadata gathered in step 4
105 - Structure the document with YAML frontmatter followed by content:
106 ```markdown
107 ---
108 date: [Current date and time with timezone in ISO format]
109 researcher: [Researcher name from thoughts status]
110 git_commit: [Current commit hash]
111 branch: [Current branch name]
112 repository: [Repository name]
113 topic: "[User's Question/Topic]"
114 tags: [research, codebase, relevant-component-names]
115 status: complete
116 last_updated: [Current date in YYYY-MM-DD format]
117 last_updated_by: [Researcher name]
118 ---
119
120 # Research: [User's Question/Topic]
121
122 **Date**: [Current date and time with timezone from step 4]
123 **Researcher**: [Researcher name from thoughts status]
124 **Git Commit**: [Current commit hash from step 4]
125 **Branch**: [Current branch name from step 4]
126 **Repository**: [Repository name]
127
128 ## Research Question
129 [Original user query]
130
131 ## Summary
132 [High-level documentation of what was found, answering the user's question by describing what exists]
133
134 ## Detailed Findings
135
136 ### [Component/Area 1]
137 - Description of what exists ([file.ext:line](link))
138 - How it connects to other components
139 - Current implementation details (without evaluation)
140
141 ### [Component/Area 2]
142 ...
143
144 ## Code References
145 - `path/to/file.py:123` - Description of what's there
146 - `another/file.ts:45-67` - Description of the code block
147
148 ## Architecture Documentation
149 [Current patterns, conventions, and design implementations found in the codebase]
150
151 ## Historical Context (from thoughts/)
152 [Relevant insights from thoughts/ directory with references]
153 - `thoughts/shared/something.md` - Historical decision about X
154 - `thoughts/local/notes.md` - Past exploration of Y
155 Note: Paths exclude "searchable/" even if found there
156
157 ## Related Research
158 [Links to other research documents in thoughts/shared/research/]
159
160 ## Open Questions
161 [Any areas that need further investigation]
162 ```
163
1647. **Add GitHub permalinks (if applicable):**
165 - Check if on main branch or if commit is pushed: `git branch --show-current` and `git status`
166 - If on main/master or pushed, generate GitHub permalinks:
167 - Get repo info: `gh repo view --json owner,name`
168 - Create permalinks: `https://github.com/{owner}/{repo}/blob/{commit}/{file}#L{line}`
169 - Replace local file references with permalinks in the document
170
1718. **Present findings:**
172 - Present a concise summary of findings to the user
173 - Include key file references for easy navigation
174 - Ask if they have follow-up questions or need clarification
175
1769. **Handle follow-up questions:**
177 - If the user has follow-up questions, append to the same research document
178 - Update the frontmatter fields `last_updated` and `last_updated_by` to reflect the update
179 - Add `last_updated_note: "Added follow-up research for [brief description]"` to frontmatter
180 - Add a new section: `## Follow-up Research [timestamp]`
181 - Spawn new sub-agents as needed for additional investigation
182 - Continue updating the document and syncing
183
184## Important notes:
185- Always use parallel Task agents to maximize efficiency and minimize context usage
186- Always run fresh codebase research - never rely solely on existing research documents
187- The thoughts/ directory provides historical context to supplement live findings
188- Focus on finding concrete file paths and line numbers for developer reference
189- Research documents should be self-contained with all necessary context
190- Each sub-agent prompt should be specific and focused on read-only documentation operations
191- Document cross-component connections and how systems interact
192- Include temporal context (when the research was conducted)
193- Link to GitHub when possible for permanent references
194- Keep the main agent focused on synthesis, not deep file reading
195- Have sub-agents document examples and usage patterns as they exist
196- Explore all of thoughts/ directory, not just research subdirectory
197- **CRITICAL**: You and all sub-agents are documentarians, not evaluators
198- **REMEMBER**: Document what IS, not what SHOULD BE
199- **NO RECOMMENDATIONS**: Only describe the current state of the codebase
200- **File reading**: Always read mentioned files FULLY (no limit/offset) before spawning sub-tasks
201- **Critical ordering**: Follow the numbered steps exactly
202 - ALWAYS read mentioned files first before spawning sub-tasks (step 1)
203 - ALWAYS wait for all sub-agents to complete before synthesizing (step 4)
204 - ALWAYS gather metadata before writing the document (step 5 before step 6)
205 - NEVER write the research document with placeholder values
206- **Path handling**: The thoughts/searchable/ directory contains hard links for searching
207 - Always document paths by removing ONLY "searchable/" - preserve all other subdirectories
208 - Examples of correct transformations:
209 - `thoughts/searchable/allison/old_stuff/notes.md` → `thoughts/allison/old_stuff/notes.md`
210 - `thoughts/searchable/shared/prs/123.md` → `thoughts/shared/prs/123.md`
211 - `thoughts/searchable/global/shared/templates.md` → `thoughts/global/shared/templates.md`
212 - NEVER change allison/ to shared/ or vice versa - preserve the exact directory structure
213 - This ensures paths are correct for editing and navigation
214- **Frontmatter consistency**:
215 - Always include frontmatter at the beginning of research documents
216 - Keep frontmatter fields consistent across all research documents
217 - Update frontmatter when adding follow-up research
218 - Use snake_case for multi-word field names (e.g., `last_updated`, `git_commit`)
219 - Tags should be relevant to the research topic and components studied
220
221---
222
223**Source:** [`parcadei/Continuous-Claude-v3`](https://github.com/parcadei/Continuous-Claude-v3) → `.claude/skills/research/SKILL.md`