/code-search:analyzefrom code-search
Investigates a codebase read-only to understand architecture, trace feature flows, locate implementations, or track bugs to their origin. Returns file locations and relationships.
Ships in code-search. Installing the plugin adds it to Claude Code.
Dispatch the code-search:analyze agent at one question about this codebase. The answer
comes back as file:line locations and the flow between them. Nothing is modified.
$ARGUMENTS
Parse three things out of $ARGUMENTS before dispatching:
A specific question beats a broad one. "Analyze the codebase" buys a tour; "where is the email validation logic" buys a file and a line number. If the request is broad enough that the investigation would be spent on orientation, narrow it first — ask which part matters, or state the narrower question you are about to answer and why.
Agent(
subagent_type: "code-search:analyze",
run_in_background: false,
description: "Investigate [brief description]",
prompt: `
Investigate the following in the codebase:
[the request, restated as one specific question]
Context: [debugging | learning | refactoring]
Working directory: [current working directory]
Anchor: [the symbol, file, or specific behaviour to start from]
Job: [locate | trace a flow | map dependencies | find a bug's origin]
Return your Location report.
`
)
Do not tell the agent which retrieval tool to use. It reads the tool list itself and routes per question — structural tools when the engine offers them, text search when the question is genuinely about an exact literal or a filename pattern. Prescribing a tool from here is how the command and the agent ended up contradicting each other.
/code-search:analyze Where is user authentication handled?
Comes back as: the login handler, the middleware that validates the token, the service that issues it — each with a file and a line range, plus the order they run in.
/code-search:analyze The profile page shows "undefined" for the email field
Comes back as: where the field is rendered, where the data is fetched, and the point between them where the shape stops matching — a file:line, not a theory.
/code-search:analyze How does payment processing work?
Comes back as: entry point, validation, gateway call, persistence, failure handling — the files involved and what each contributes.
Location report: <what was investigated>
Method <which tools answered, and anything the engine could not do>
Primary files path/to/file.ts:45-67 <what happens there>
Flow entry -> processing -> result, a file:line per hop
Related <component or service> — <what it contributes>
Caveats <anything static analysis cannot see>
Next steps <what this makes possible>
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub madappgang/magus --plugin code-search3 commands in this plugin
/helpShow what the code-search plugin provides — its agent, commands, skills, tool surface, and which one to reach for/setupSet up code-search in this project: choose, install and configure a search engine, build its index, and verify. Asks before every change, and undoes an earlier ignore-for-this-project.Other plugins' commands for the same job