LESSON · 1 OF 3

Working across files

Working across files

A single file is easy. Real work spans a repo: a function defined in one file, called from three others, with config off to the side. Claude Code is built for exactly this. Point it at a project and it will search, read, and follow the trail between files on its own.

How it finds the right code

You do not hand Claude the files one by one. It explores the repo the way you would, just faster:

  • It greps for names, strings, and patterns to locate where something lives.
  • It reads the files that matched, plus the ones they reference.
  • It follows imports and calls from file to file until it has the full picture.

So when a function is called in one place and defined in another, Claude reads across that boundary without you pasting anything.

Point it at the right place

You steer the search by how you phrase the request. A few habits that help:

  • Say "in this repo" or "across the codebase" so it looks widely instead of guessing.
  • Name the file when you know it: "in server.py, the load_config function...".
  • Name the symbol - a function, class, or variable - and let Claude find every place it appears.

The more specific your anchor, the less Claude has to search and the tighter its answer.

Coordinated multi-file edits

Once Claude understands how the pieces connect, it can change them together. Rename a function and update every caller. Add a parameter and thread it through. Move logic from one module to another and fix the imports. It plans the set of edits, shows you the diffs, and applies them across files in one pass.

You still review before anything lands. But the tedious part - knowing which files a change touches - is what Claude handles best.

Scoping a change

When you want an edit kept small, tell Claude where the edges are: "only touch files under src/auth/" or "change the parser, not the tests". Scope is just another anchor, and it keeps a coordinated edit from sprawling further than you meant.


Your lab setup

This VM comes with Claude Code preinstalled and signed in - just run claude to start.

Spin up a fresh environment and practice live.
claude-code-ubuntu · fresh machine · ready in under a minute