Let Claude Code Explore the Repo Before It Edits
What it is
Working with Claude Code — Anthropic's agentic CLI — by letting it read and understand the codebase first, agree a plan, then make edits and run the tests itself, rather than demanding a change blind.
Why it works
Claude Code can open files, search, and run commands. Its edits are only as good as its understanding of the repo. A quick explore-and-plan step means it changes the right things for the right reasons, and running the tests closes the loop before you ever look.
When to use it
Real tasks in a real repository: features, fixes, migrations. Especially anything where the correct change depends on conventions elsewhere in the code.
When not to use it
A one-line snippet with no repository context — a normal chat is faster than spinning up the agent.
Prompt
Before changing anything: explore the repo and tell me how <feature/area> currently works and which files own it. Then propose a plan for <goal>. Only after I approve the plan, make the edits and run the test suite.Example
Asked to add rate limiting, Claude Code first finds the existing middleware pattern, proposes matching it, then implements and runs the tests — the new code looks like it was always there.
Advanced version
Give Claude Code a CLAUDE.md with your conventions and commands so its exploration starts from your rules, not its guesses. It's the repo-scale version of context engineering.
Common mistakes
- Telling Claude Code to 'just fix it' with no explore step, so it invents a pattern the repo doesn't use.
- Skipping the plan approval and discovering the wrong direction after the edits land.
- Not letting it run the tests, throwing away its best self-correction signal.