How to Use Claude Code in Large Codebases: Best Practices from Real Deployments
Claude Code is already running in production environments that include multi‑million‑line monorepos, legacy systems built over decades, distributed architectures with dozens of separate repositories, and organizations with thousands of developers. These environments create challenges that small, simple codebases simply don’t have – for example, build commands that differ from one subdirectory to the next, or legacy code scattered across folders without a shared root.
This article summarises the patterns we have seen lead to successful adoption of Claude Code at scale. When we say “large codebase”, we mean a wide range of situations: a monorepo with millions of lines, a legacy system that has grown over decades, dozens of microservices in separate repos, or any mix of these. It also includes codebases written in languages that teams don’t always associate with AI coding tools – C, C++, C#, Java, PHP. (In practice, Claude Code often performs better than teams expect in those languages, especially with recent model releases.) While every large‑codebase deployment is shaped by its own version control, team structure and accumulated conventions, the patterns below generalise well and are a good starting point for teams thinking about adopting Claude Code.

1. How Claude Code navigates large codebases
Claude Code navigates a codebase the way a software engineer would: it walks the file system, reads files, uses grep to find exactly what it needs, and follows references across the codebase. It runs locally on the developer’s machine and does not need any codebase index to be built, maintained or uploaded to a server.
Some earlier AI coding tools relied on RAG (retrieval‑augmented generation). They embed the whole codebase and retrieve relevant chunks at query time. At large scale this often fails, because the embedding pipeline cannot keep up with an active engineering team. By the time a developer queries the index, it might reflect the codebase as it was days or weeks ago. The retrieval might then return a function that was renamed two weeks earlier, or reference a module that was deleted in the last sprint – with no indication that the information is out of date.
Claude Code’s agentic search avoids those failure modes. There is no embedding pipeline and no centralised index to maintain, even as thousands of engineers commit new code every day. Each developer’s instance works directly on the live codebase.
But this approach has a trade‑off: it works best when Claude has enough initial context to know where to look. That means the quality of Claude’s navigation is shaped by how well the codebase is set up – layering context with CLAUDE.md files and skills. If you ask it to find every occurrence of a vague pattern across a billion‑line codebase, you will hit context‑window limits before the work even begins. Teams that invest in codebase setup see much better results.
2. The harness matters as much as the model
A common misconception is that Claude Code’s capabilities are determined solely by the underlying model. Teams focus on benchmark scores and how the model performs on test tasks. In practice, the ecosystem built around the model – the harness – often has a bigger impact on real‑world performance than the model alone.
This harness is built from five extension points: CLAUDE.md files, hooks, skills, plugins, and MCP servers. Each serves a different purpose, and the order in which you build them matters because each layer builds on the one before. Two additional capabilities – LSP integration and subagents – complete the picture.
2.1 CLAUDE.md files come first
CLAUDE.md files are context files that Claude reads automatically at the start of every session: a root file for the big picture, and subdirectory files for local conventions. They give Claude the codebase knowledge it needs to do anything well. Because they load in every session regardless of the task, keeping them focused on what applies broadly stops them from becoming a drag on performance.
2.2 Hooks make the setup self‑improving
Most teams think of hooks as scripts that prevent Claude from doing something wrong. But their more valuable use is continuous improvement. A stop hook can reflect on what happened during a session and propose updates to CLAUDE.md while the context is still fresh. A start hook can load team‑specific context dynamically, so every developer gets the right setup for their module without manual configuration. For automated checks like linting and formatting, hooks enforce the rules deterministically and give more consistent results than relying on Claude to remember an instruction.
2.3 Skills keep expertise on demand, without bloating every session
In a large codebase with dozens of task types, not every piece of expertise needs to be present in every session. Skills solve this through progressive disclosure: they offload specialised workflows and domain knowledge, loading only when the task calls for them. For example, a security‑review skill loads when Claude is assessing code for vulnerabilities, while a documentation skill loads when a code change requires updating the docs.
Skills can also be scoped to specific paths, so they only activate in the relevant part of the codebase. A team that owns a payment service can bind their deployment skill to that directory, so it never auto‑loads when someone is working elsewhere in the monorepo.
2.4 Plugins distribute what works
One challenge with large codebases is that good setups often stay tribal. A plugin bundles skills, hooks and MCP configurations into a single installable package. When a new engineer installs that plugin on day one, they immediately get the same context and capabilities as those who have been using Claude Code for a while. Plugin updates can be distributed across the organisation through managed marketplaces.
For example, a large retail organisation built a skill that connects Claude to their internal analytics platform, so business analysts could pull performance data without leaving their workflow. They distributed it as a plugin before the broad rollout to the business.
2.5 LSP integration gives Claude IDE‑level code intelligence
Language Server Protocol (LSP) integration gives Claude the same navigation that a developer has in their IDE. Most large‑codebase IDEs already run an LSP that powers “go to definition” and “find all references”. Surfacing this to Claude gives it symbol‑level precision: it can follow a function call to its definition, trace references across files, and distinguish between identically named functions in different languages. Without LSP, Claude pattern‑matches on text and can land on the wrong symbol. One enterprise software company we worked with deployed LSP integration org‑wide before their Claude Code rollout, specifically to make C and C++ navigation reliable at scale. For multi‑language codebases, this is one of the highest‑value investments you can make.
2.6 MCP servers extend everything
MCP (Model Context Protocol) servers are how Claude connects to internal tools, data sources and APIs that it cannot otherwise reach. The most sophisticated teams build MCP servers that expose structured search as a tool Claude can call directly. Others connect Claude to internal documentation, ticketing systems or analytics platforms.
2.7 Subagents split exploration from editing
A subagent is an isolated Claude instance with its own context window. It takes a task, does the work, and returns only the final result to the parent. Once the harness is in place, some teams spin up a read‑only subagent to map a subsystem and write findings to a file, and then have the main agent edit with the full picture.
The table below summarises what each component does, when it loads, and the most common mistakes we see.
3. Three configuration patterns from successful deployments
How you configure Claude Code for a large codebase depends heavily on how that codebase is structured. Still, three patterns appear consistently across the deployments we have observed.
Pattern 1: Make the codebase navigable at scale
Claude’s ability to help in a large codebase is limited by its ability to find the right context. Too much context loaded into every session degrades performance; too little leaves Claude navigating blind. The most effective deployments invest upfront in making the codebase legible to Claude.
-
Keep CLAUDE.md files lean and layered. Claude loads them additively as it moves through the codebase: root file for the big picture, subdirectory files for local conventions. The root file should be pointers and critical gotchas only – everything else becomes noise. -
Initialise in subdirectories, not at the repo root. Claude works best when it is scoped to the part of the codebase that is actually relevant to the task. In monorepos this can feel counterintuitive because tooling often assumes root access, but Claude automatically walks up the directory tree and loads every CLAUDE.mdfile it finds along the way, so root‑level context is never lost. -
Scope test and lint commands per subdirectory. Running the full test suite when Claude changed only one service causes timeouts and wastes context on irrelevant output. CLAUDE.mdfiles at the subdirectory level should specify the commands that apply to that part of the codebase. This works well for service‑oriented codebases where each directory has its own test and build commands. In compiled‑language monorepos with deep cross‑directory dependencies, per‑subdirectory scoping is harder and may need project‑specific build configurations. -
Use .ignorefiles to exclude generated files, build artifacts and third‑party code. Committingpermissions.denyrules in.claude/settings.jsonmeans the exclusions are version‑controlled, so every developer on the team gets the same noise reduction without configuring it themselves. Developers who work on code generators can override project‑level exclusions in their local settings without affecting the rest of the team. -
Build a codebase map when the directory structure does not do the work. For organisations where code is not consolidated in a conventional directory structure, a lightweight Markdown file at the repo root listing each top‑level folder with a one‑line description of what lives there gives Claude a table of contents it can scan before opening files. For codebases with hundreds of top‑level folders, a layered approach works best: the root file describes only the highest‑level structure, and subdirectory CLAUDE.mdfiles provide the next level of detail, loading on demand as Claude moves through the tree. For simpler cases, @‑mentioning the specific files or directories works just as well. -
Run LSP servers so Claude searches by symbol, not by string. Grepping for a common function name in a large codebase returns thousands of matches, and Claude burns context opening files to figure out which ones matter. LSP returns only the references that point to the same symbol, so the filtering happens before Claude reads anything. Setting this up requires installing a code intelligence plugin for your language and the corresponding language server binary. The Claude Code documentation covers the available plugins and troubleshooting.
One caveat: there are edge cases where even the layered CLAUDE.md approach breaks down – for example, codebases with hundreds of thousands of folders and millions of files, or legacy systems on non‑git version control. Those challenges will be addressed in future posts in this series.
Pattern 2: Actively maintain CLAUDE.md files as model intelligence evolves
As models evolve, instructions written for your current model can work against a future one. CLAUDE.md files that once guided Claude through patterns it used to struggle with may become unnecessary or actively constraining when the next model ships. For example, a CLAUDE.md rule that tells Claude to break every refactor into single‑file changes might have helped an earlier model stay on track, but it would prevent a newer model from making coordinated cross‑file edits that it handles perfectly well.
Skills and hooks built to compensate for specific model limitations (whether in the model’s reasoning or in Claude Code’s own tooling) become overhead once those limitations disappear. For example, a hook that intercepted file writes to enforce p4 edit in a Perforce codebase became redundant once Claude Code added native Perforce mode.
Teams should expect to do a meaningful configuration review every three to six months. It is also worth doing one whenever performance feels like it has plateaued after a major model release.
Pattern 3: Assign ownership for Claude Code management and adoption
Technical configuration alone does not drive adoption. The organisations that got it right also invested in the organisational layer.
The rollouts that spread fastest had dedicated infrastructure investment before broad access. A small team, sometimes just one person, wired up the tooling so Claude already fitted developer workflows when they first touched it. At one company, a couple of engineers built a suite of plugins and MCP servers that were available on day one. At another, an entire team focused on managing AI coding tools had the infrastructure in place before the rollout began. In both cases, developers’ first experience was productive rather than frustrating, and adoption spread from there.

The teams doing this work today usually sit under Developer Experience or Developer Productivity – the functions already responsible for onboarding new engineers and building developer tooling. An emerging role in several organisations is an “agent manager”: a hybrid PM/engineer role dedicated to managing the Claude Code ecosystem. For organisations without a dedicated team, the minimum viable version is a DRI (directly responsible individual) – one person with ownership over the Claude Code configuration, authority to make calls on settings, permissions policy, the plugin marketplace and CLAUDE.md conventions, and the responsibility to keep them current.
Bottom‑up adoption generates enthusiasm, but without someone to centralise what works, fragmentation happens. You need an individual or a team to assemble and evangelise the right Claude Code conventions (such as a standardised CLAUDE.md hierarchy or a curated set of skills and plugins). Without that work, knowledge stays tribal and adoption plateaus.
In large organisations, especially in regulated industries, governance questions come up early: who controls which skills and plugins are available? How do you prevent thousands of engineers from independently rebuilding the same thing? How do you make sure AI‑generated code goes through the same review process as human‑generated code? To address these early on, we suggest starting with a defined set of approved skills, required code review processes, and limited initial access, and then expand as confidence builds.
The smoothest deployments we have seen are at organisations that establish cross‑functional working groups early – bringing together engineering, information security and governance representatives to define requirements together and build a rollout roadmap.
Frequently Asked Questions (FAQ)
Q: Does Claude Code need to build a code index like traditional AI tools?
No. Claude Code does not use an embedding pipeline or a centralised index. It works directly on your live codebase by walking the file system, reading files and using grep. This means it always sees the latest code state, and there is no risk of an outdated index.
Q: My codebase has millions of lines. Won’t Claude run out of context window?
It can, but you can prevent it with good configuration. The key is not to load too much context in every session. Use layered CLAUDE.md files (high‑level at the root, details in subdirectories), initialise sessions inside subdirectories instead of the repo root, exclude generated files with .ignore, and use LSP for symbol‑level search instead of text grep. These techniques dramatically reduce unnecessary context consumption.
Q: My project uses Python, Java and C++ together. Can Claude handle that?
Yes. For multi‑language codebases, LSP integration is one of the most valuable investments you can make. Install the language servers and code intelligence plugins for each language, and Claude will navigate at symbol level with precision, distinguishing between identically named functions in different languages. Many large enterprises have successfully deployed Claude Code in exactly this kind of environment.
Q: How can I give the same good setup to everyone on my team?
Use plugins. Plugins bundle skills, hooks and MCP configurations into a single installable package. Through a managed marketplace you can distribute plugin updates across your organisation. A new hire then gets the same context and capabilities on day one as someone who has been using Claude Code for months. Also, assign a DRI (or a small team) to maintain and evangelise those configurations.
Q: Will generated code confuse Claude?
You can exclude generated files using version‑controlled permission rules. Add permissions.deny rules in .claude/settings.json, commit that file, and everyone on the team automatically gets the same noise reduction. Developers who work on the code generators themselves can override the rules in their local settings without affecting the rest of the team.
Q: My codebase does not use Git – it uses Perforce or another VCS. Can I still use Claude Code?
Yes, but you may need some extra configuration. For example, one team built a hook that intercepted file writes and ran p4 edit automatically. Later, Claude Code added native Perforce mode, and that hook became unnecessary. If your VCS is unusual, start by using hooks or scripts to automate the needed commands, and keep an eye on future Claude Code updates for native support.
Q: Where should I start with configuration?
We recommend this order:
-
First: Create a lean CLAUDE.mdat the root with only the overall structure and the most important gotchas. -
Second: Create CLAUDE.mdfiles for major subdirectories, each describing local conventions, test commands and build commands. -
Third: Configure .ignorefiles andpermissions.denyrules to exclude generated files and third‑party code. -
Fourth: Install LSP plugins and language servers for the programming languages you use. -
Fifth: Add skills, hooks and MCP servers gradually as you identify real needs. Do not try to build everything at once.
If you have a dedicated Developer Productivity team, ask them to own the first three steps and standardise them across the organisation.
Summary
Using Claude Code successfully in a large codebase does not require magic – it requires a systematic approach to configuration. That approach has three core parts: making the codebase navigable for Claude (through layered CLAUDE.md, LSP and well‑scoped search), maintaining the configuration actively as models evolve (review every three to six months), and assigning ownership at the organisational level to manage and spread the patterns that work.
The harness matters as much as the model. Start with CLAUDE.md and LSP integration, then add skills, hooks, plugins and MCP servers as needed. Keep things lean, layered and on‑demand. And remember: making the first experience productive for developers is often what determines whether the whole team successfully adopts the tool.


