Navigate a large codebase with Claude Code
Set up Claude Code for a big repo or monorepo in 25 minutes, with folder CLAUDE.md files, a code intelligence plugin and rules that skip generated code.

What you need
Step 1: Start Claude in the folder you work in
3 minWhere you launch Claude decides which CLAUDE.md files load and which files it can edit.
- In a terminal,
cdinto the package or subsystem you work on, such aspackages/api. - Run
claude, then type/initat its prompt. - Read the CLAUDE.md it writes, and delete anything Claude could work out from the code.
You should see a new CLAUDE.md in that folder, with its build and test commands.
/initdidn't make a new file?A CLAUDE.md is already there, so
/initsuggests improvements instead of overwriting it. Accept the ones that help.Started from a subfolder, Claude can edit only that part of the repo until you grant it more.
- In a terminal,
Step 2: Keep the root file for rules that apply everywhere
4 minThe root CLAUDE.md loads in every session, so each extra line costs attention on every task.
- Open
CLAUDE.mdat the repository root. - Keep rules that hold in every folder: commit style, generated files and things never to touch.
- Delete folder maps and architecture notes. Claude reads the repo itself, and Anthropic's docs now list that habit as old advice.
Your root CLAUDE.md# Rules for every folder - Run scripts from the folder you changed, not the repo root. - Start commit subjects with the folder name, like `api: fix login timeout`. - Never edit files in [GENERATED FOLDER]. Run [CODEGEN COMMAND] instead.
You should see a root file of a few lines, far under the 200 lines Anthropic suggests as a limit.
Claude keeps ignoring a rule in the file?
The file is probably too long, so the line gets lost. Cut it down. A rule that must never bend belongs in a hook or a deny rule.
- Open
Step 3: Give each folder its own commands
5 minA folder's CLAUDE.md loads only when Claude works there, so it runs that folder's tests instead of the whole suite.
- Add a
CLAUDE.mdto each busy folder, such aspackages/web/CLAUDE.md. - List how to test one file, run the folder's tests and lint, as in the example.
- Start a session in that folder, run
/context alland check the list under Memory files.
Your folder CLAUDE.md# packages/api - Test one file: npm test -- [PATH TO TEST FILE] - All API tests: npm test - Lint: npm run lint - Copy .env.example to .env before you run tests.
You should see the root CLAUDE.md and your folder's file under Memory files, and none from other folders.
Other teams' CLAUDE.md files keep loading?
Add their paths to
claudeMdExcludesin.claude/settings.local.json, such as"/packages/web/". Or start Claude from your own folder.- Add a
Step 4: Install a code intelligence plugin
6 minA language server lets Claude find a function's definition and callers by symbol, instead of reading file after file.
- Install your language's server first. For TypeScript, run the first line below in your terminal.
- Start
claudeand run the/plugin installline at its prompt. - Other languages have their own plugin, such as
pyright-lspfor Python orgopls-lspfor Go.
Run these, the second one inside Claude Codenpm install -g typescript-language-server typescript /plugin install typescript-lsp@claude-plugins-official
You should see a message that the plugin is active, or that you need to run
/reload-pluginsfirst.It says the marketplace wasn't found?
Add it with
/plugin marketplace add anthropics/claude-plugins-official, then run the install again.Code intelligence works in terminal sessions. Cloud sessions don't start plugin language servers.
Step 5: Block generated and vendored code
3 minDeny rules stop Claude from opening big files that were never meant to be read.
- Open
.claude/settings.jsonin the folder you start Claude from, or create it. - Add the rules below, and change the paths to match your build folders.
- Commit the file so your whole team gets the same rules.
Your config{ "permissions": { "deny": [ "Read(./**/dist/**/*)", "Read(./**/build/**/*)", "Read(./**/*.generated.*)", "Read(./**/vendor/**/*)" ] } }You should see your 4 new rules listed in
/permissions, with the settings file each one came from.Claude still reads files in a denied folder?
Rules that start with
./count from the folder you launched in. If you launch from different folders, write full paths that start with//.Paths in
.gitignore, likenode_modules/, already stay out of Claude's searches.- Open
Step 6: Test it on a real call path
4 minOne trace across folders shows whether the setup works before you rely on it.
- Paste the prompt below, with a real function name from your code.
- Watch which files Claude opens. Each one should sit on the path you asked about.
Your promptTrace how [FUNCTION NAME] gets called, from the entry point down to where it does its work. Use the language server to find references. List each file and line in order. Don't edit anything.
You should see a short, ordered list of files and lines, with no detours through build output.
Claude still searches file by file?
Run
/pluginand open the Errors tab. A row readingExecutable not found in $PATHnames the language server to install.
You get
A large codebase where Claude loads only the rules it needs, finds code by symbol and skips generated files
Try next
Did this guide work for you?
Thanks. It helps us fix the steps.


