research-codebase
Skill0 starsChanged 2 months agoMITView on GitHub
Investigate a codebase with system awareness — read boundaries, ownership, control flows, data flows, contracts, and blast radius BEFORE recommending action. Produces a structured understanding artifact with every claim cited file:line. Use when the user asks to "understand this codebase", "deep-dive this feature", "trace this flow", "why is this slow/flaky/coupled", "is this PR safe", "what breaks if I change Y", "prepare to refactor Z", "investigate this bug at the system level". For research from external sources (URLs, docs, Slack), use a research command in mtg or similar. For greenfield architecture design, this is not the right tool.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- lithammer/aitheir own version, first seen Oct 17, 2026
- charly-vibes/incitacionestheir own version, first seen Oct 14, 2026
- sipandey/create-agent-roomtheir own version, first seen Sep 26, 2026
- ConsolaDev/Consolatheir own version, first seen Sep 23, 2026
- atomicinnovation/acceleratortheir own version, first seen Sep 22, 2026
- jurgendn/agent-skillstheir own version, first seen Sep 17, 2026
Used with
Projects with it also use validate-plan, iterate-plan and 4 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
shawn-dumasSkillvalidate-plan
Validate an orchestration plan after pre-flight certification. Runs adversarial review, deep review (verify prompt data against codebase), and PoC gate for risky approaches. Auto-invoked by orchestrate-* skills at Step 8.
Also in 4 projects that use this
corticalstackSkilliterate-plan
Revise an existing implementation plan in flow/plans/ based on feedback, researching when needed. Explicit-only; run only when invoked via /iterate-plan or explicitly asked.
Also in 3 projects that use this
parcadeiSkilldescribe-pr
Generate comprehensive PR descriptions following repository templates
Also in 4 projects that use this
JasonPaffSkillimplement-plan
Execute implementation plan with structured tracking and validation using subagent architecture
Also in 4 projects that use this
JetBrainsSkillcreate-plan
Research the codebase and create an implementation plan with architecture notes, design document, and track decomposition. Use when starting a new feature or large change.
Also in 3 projects that use this
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 4 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- atomicinnovation/accelerator★ 34same name
- joshuaalpuerto/mcp-agent★ 18same name
- jurgendn/agent-skills★ 10same name
- ConsolaDev/Consola★ 1same name
- corticalstack/flow★ 1same name
- fabianmagrini/skills★ 1same name
- charly-vibes/incitaciones★ 0same name
- lithammer/ai★ 0same name
- sipandey/create-agent-room★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- create-web-manifestSkill
- design-critiqueSkill
- md2htmlSkill
- optimize-skillSkill
- search-skillSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 6 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Hard gates: before recommending any change that:
- Distinctive: line 59
Ask one focused clarifying question only when the answer materially changes scope or depth.
- Very specific: line 72
Write inventory findings to a numbered shard inside the investigation folder, e.g.
- Distinctive: line 76
Read code to answer the scoped question.
- Very specific: line 99
Every claim has a file:line (or file for structural, or command-output for behavioral)
- Very specific: line 100
Every confidence label is honestly assigned (confirmed / likely / uncertain)
- Distinctive: line 101
Every gap is named (what you didn't inspect, and why it was out of scope)
- Very specific: line 103
If any claim can't be cited, mark it uncertain and downgrade.
- Very specific: line 107
Before writing understanding.md, re-read each numbered shard from disk using an available read tool, then build the understanding artifact.
- Very specific: line 137
Write the artifact to .ai/codebase-research/<NNN>-<topic>/understanding.md.
- Distinctive: line 157
If a change recommendation is in scope, end with one of:
- Distinctive: line 168
Before reporting, verify the artifact answers all of:
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
research-codebase
Understand a codebase by reading its boundaries, contracts, flows, and blast radius before recommending any action. Do not infer system behavior or impact from a single-file view. A literal source fact may need only one exact file.
Tools
Built-in: Read, Grep, Glob, Edit, Write Shell: Bash — preferred when available:
rg(ripgrep) — fast structural search; respects.gitignoresg(ast-grep) — AST pattern matching across languages- Static analyzers / dependency scanners configured in the host project (invoke via
npxor the project's equivalent for its language) - Plain
grep/findas the floor — name the checks these tools cannot establish
LSP-backed navigation (definitions, references) is an editor concern, not a shell concern. Confidence depends on evidence for the claim, not tool availability alone. Missing LSP matters when the remaining evidence cannot establish symbol identity or reachability.
Operating Model
SCOPE → INVENTORY → INVESTIGATE → CITE → SYNTHESIZE → REPORTCompress when the user's scope is narrow (e.g., one specific function). Keep INDEX.md, at least one numbered shard and understanding.md even for literal lookups. Expand when investigating across modules, across packages, or across system boundaries. Follow the phase order for tool calls, not just report headings; do not gather evidence first and backfill phase files afterward.
Hard Rules
- Every claim cites
file:line— code claims need file path + line number; structural claims need a file path; behavioral claims need command output (test result, build log, runtime trace). No uncited assertions. - Confidence labels are explicit — every architecture-level claim is
confirmed(sufficient inspected evidence),likely(indirect or incomplete proof), oruncertain(a material gap or surviving contradiction). Never present uncertain claims as confirmed. - Match breadth to the claim — literal source facts can stop at sufficient exact evidence. System, flow, behavior and impact conclusions require relevant boundaries and consumers; go wider before making them.
- Hard gates before recommending any change that:
- Touches public contracts (types, schemas, wire protocols affecting external consumers)
- Crosses architecture layers (UI calling DB directly, service reaching into UI, etc.)
- Is destructive (file deletes, table drops, force-pushes, irreversible migrations)
- Has large blast radius (>10 files or >3 modules)
- No recommendation without supporting evidence — if you can't cite it, you can't claim it. Mark gaps as
uncertainand proceed.
Stop Conditions
- The understanding artifact answers the user's actual question
- 3 investigation angles have returned no new evidence not already examined
- A change recommendation is blocked by a hard gate awaiting user approval
- Cost (time, file reads) has clearly exceeded the value of more depth
Phase 1: Scope
Extract before reading code:
- Question: what is the user actually asking? (understand-the-system / trace-a-flow / safety-of-a-change / find-root-cause / prepare-for-refactor)
- Boundary: which directories, files, modules, or domain entities are in scope?
- Depth target: quick perspective check / focused trace / full architecture-health investigation
- Constraints: language, framework, IDE, what tools are available
- Output expectation: what does the user want to walk away with?
Ask one focused clarifying question only when the answer materially changes scope or depth. Otherwise proceed with stated assumptions.
Before the first code read, write the scope as the first section of INDEX.md inside a new numbered folder at .ai/codebase-research/<NNN>-<topic>/ (find the next available NNN by scanning the directory; derive a short kebab-case <topic> from the user's question). The folder is the investigation's anchor; INDEX.md is its manifest.
Phase 2: Inventory
Map the surface area before diving in.
- List entry points (CLI commands, HTTP routes, exported APIs, message handlers, scheduled jobs)
- List modules / packages / layers and their dependency direction
- Identify ownership signals:
CODEOWNERS, module READMEs, package authors, commit-author concentration - Note language-server / AST / scanner tool availability for the codebase
Write inventory findings to a numbered shard inside the investigation folder, e.g. .ai/codebase-research/<NNN>-<topic>/01-inventory.md, then update INDEX.md with a one-line summary and a link to the shard. Finish these writes before tracing flows, evaluating callers or diagnosing a cause.
Phase 3: Investigate
Read code to answer the scoped question. Investigation moves through these surfaces — touch only what the question requires:
| Surface | What to gather | Evidence |
| Control flows | Numbered call paths from entry point to terminal action | rg / sg for symbol → file:line; editor-side language-server goto-definition for confirmation when available |
| Data flows | Writers, readers, transaction boundaries, caches, per entity | rg / sg for writer patterns (update, insert, set, save) → trace to readers |
| Types & protocols | Boundary DTOs / schemas / wire contracts; compatibility posture | inspect type definitions, schema files, API contracts |
| Boundaries & ownership | Module ownership, ports, contract tests | CODEOWNERS, module READMEs, dependency scanner output (whatever the project provides) |
| Duplication | Top near-clones; the missing abstraction | sg patterns for structural duplication; otherwise rg + careful reading |
| Execution profile | Hot paths, async/sync posture, retry/timeout/lifecycle, runtime risks | inspect concurrency primitives, queue use, timeout configs |
| Architecture health | One line per principle and per dimension; confidence-labeled | aggregated from above; cite per claim |
| Clean-code hotspots | Top static-analyzer findings worth fixing | static-analyzer output from project's configured tools → file:line |
For a bug claim, identify actual behavior, the expected supported contract and evidence of its violation. Confirm root cause only with mechanism, trigger, first divergence and decisive causal evidence. Test and rule out credible competing explanations when present. If none is credible, record why and require direct causal/counterfactual proof; do not invent an alternate. Missing decisive evidence or a surviving explanation keeps the result a hypothesis with a named next check.
An empty search establishes only what was searched. For absence, unused-code or safe-change claims, record scope, filters/exclusions, dynamic paths and relevant consumers/tests/configuration; corroborate with another relevant evidence angle. If coverage or corroboration is missing, report the bounded observation and gap. Lexical hits alone do not establish semantic identity or global absence.
After each surface, write its findings to a numbered shard in .ai/codebase-research/<NNN>-<topic>/, e.g. 02-control-flows.md, 03-data-flows.md, 04-boundaries.md, then update INDEX.md with the shard link and a one-line summary before investigating the next surface. Do NOT batch findings in memory across surfaces — write per surface so context compaction can't lose work.
Phase 4: Cite
Verify before reporting:
- Every claim has a
file:line(orfilefor structural, or command-output for behavioral) - Every confidence label is honestly assigned (
confirmed/likely/uncertain) - Every gap is named (what you didn't inspect, and why it was out of scope)
If any claim can't be cited, mark it uncertain and downgrade. Check root-cause and search-coverage receipts before assigning confidence; a source snippet alone does not prove runtime causality or global absence.
Phase 5: Synthesize
Before writing understanding.md, re-read each numbered shard from disk using an available read tool, then build the understanding artifact. Do not substitute remembered text or a previous Write result for this read, or claim a read that did not occur.
Required sections (always present, even as "N/A + reason"). For a literal lookup, keep entries short and apply self-checks only to relevant claims; do not infer an effective runtime value from a declared default when overrides may apply:
| # | Section | Contents |
| 1 | System summary | What it does, who consumes it, invariants — 2-4 sentences |
| 2 | Control flows | Numbered call paths, each step cited |
| 3 | Boundaries & ownership | Module ownership table |
| 4 | Architecture health | Per-principle / per-dimension status (confirmed / likely / uncertain) |
| 5 | Next step | One sentence |
Applicable sections (present when the question touches that surface):
| Section | Present when |
| Data flows | The question involves state, persistence, or caching |
| Types & protocols | The question involves contracts, schemas, or wire formats |
| Duplication inventory | The question is refactor- or quality-oriented |
| Execution profile | The question is perf or reliability oriented |
| Clean-code hotspots | The question is quality-oriented |
For change-impact questions, also include:
- Change flow — the call path the change traverses
- Data-flow impact — entities read/written; transaction/cache semantics preserved
- Contract impact — types/schemas/protocols touched; compatibility posture (backwards-compatible / breaking-with-migration / additive-only)
- Blast radius — callers and consumers touched, labeled by layer
- Risk vector — which principles/dimensions the change stresses; how each is preserved
Write the artifact to .ai/codebase-research/<NNN>-<topic>/understanding.md. Add a link to it as the final entry in INDEX.md under a ## Synthesis heading.
Phase 6: Report
Present a compact summary to the user, leading with the answer to the original question. Link to understanding.md for the full artifact.
Output shape:
Question: <restated>
Answer: <one paragraph — the actual answer, cited>
Confidence: confirmed | likely | uncertain (per major claim)
Gaps: <what wasn't inspected, and why>
Next step: <one sentence>
Full artifact: .ai/codebase-research/<NNN>-<topic>/understanding.md
Investigation folder: .ai/codebase-research/<NNN>-<topic>/ (INDEX.md + shards)If a change recommendation is in scope, end with one of:
1. Approve the change as analyzed
2. Investigate further — name surface (control flow / data flow / contracts / blast radius / ...)
3. Hard-gate held — public-contract / cross-layer / destructive / large-blast-radius change blocked for explicit approval
4. CancelArtifact Self-Check
Before reporting, verify the artifact answers all of:
- Ownership — who owns this code?
- Boundary — what layer / module is this in? Does the change (if any) respect it?
- Blast radius — consumers (cited), layers touched, contracts affected
- Contract safety — types/schemas/protocols, compatibility posture explicit
- Local vs structural vs architectural — what level of change is this really?
- Build/config involvement — does the change touch CI, deploy, config files?
- Reliability under failure / retry / concurrency — what happens on the unhappy path?
- Observability sufficiency — can ops see this in traces / metrics / logs?
- Rollout / migration reversibility — can the change be backed out?
- Folder bloat and naming fitness — does this fit the module's existing shape?
- Modularity trajectory — does this change increase or decrease coupling?
- Documented assumptions — what did the original author assume? Still true?
- Safest next move — single concrete sentence
For system, flow, behavior or impact conclusions, verify relevant boundaries and consumers before reporting. A literal source lookup can use one exact file; mark unrelated self-checks N/A with a reason.
Recovery
- No language-server / AST / scanner available — use grep + careful reading; assign confidence from the remaining evidence and name missing checks. Exact literal facts may still be confirmed.
- Scope too broad to inspect fully — present the user with a narrower scope offer; ask for re-scope before investing further reading
- Conflicting evidence across files — record both, mark
uncertain, surface the conflict in the report — don't paper over it - Hard gate triggered — STOP, present the change profile, require explicit user approval before recommending; do not soft-pedal to bypass
- Out-of-scope symbol or file shows up repeatedly — note it in the inventory shard and
INDEX.mdas a discovery, ask user whether to expand scope or skip
Anti-Patterns
| # | Anti-pattern | Why it fails |
| 1 | Inferring the system from one file | Literal facts can be local; system and impact claims need relevant boundaries |
| 2 | Reporting without citations | The user has to re-verify everything; the artifact has no audit trail |
| 3 | Marking everything confirmed | Inflated confidence misleads decisions |
| 4 | Recommending a change before mapping blast radius | Surprises in production |
| 5 | Batching multiple-surface findings in memory before writing | Context compaction erases work |
| 6 | "It looks fine" as a finding | Not a finding — no citation, no judgment, no value |
| 7 | Skipping the gate when the change is destructive but "obviously fine" | The gate exists for exactly that confidence failure mode |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

