Cole Medin breaks down Anthropic's blog post on using Claude Code in large codebases. The key thesis: the harness (AI layer) matters as much as the model. He covers 7 strategies for building an effective AI layer, demonstrates each with a concrete demo codebase, and shares a Claude plugin that bundles the most useful strategies for immediate use.
Coding agent tutorials rarely address large codebases (tens to hundreds of thousands of lines). Strategies that work for simple projects fail as complexity grows. Anthropic published an article covering how Claude Code is used in enterprise environments: multi-million line monorepos, legacy systems, distributed architectures spanning dozens of repos.
Key insight: Claude Code uses agentic search — no RAG, no indexing, no semantic search. It navigates codebases like an engineer would, using CLI tools (grep, directory structure). Trade-off: works best when it has enough starting context to know where to look.
The harness matters as much as the model. The "AI layer" is a third component of every codebase alongside code and tests. It includes: global rules, skills, MCP servers, sub-agents, hooks, LSP, and plugins. Each of the 7 components maps to a strategy.
Diagram concept: Code + Tests + AI Layer = Modern Codebase
Include only: what the codebase is about, tech stack overview, general conventions/gotchas, commands for testing/dev server
Layer rules with subdirectory CLAUDE.md files — progressive disclosure
Each subdirectory loads its own rules when Claude starts editing there
Claude walks UP the directory tree, loading every CLAUDE.md it finds
Pro tip: Initialize Claude Code in a subdirectory when you know exactly where to work (from a Jira ticket/GitHub issue). This scopes the working directory and loads only relevant rules.
When the directory structure doesn't tell the whole story, build a codebase map in your global rules: outline subdirectories with brief descriptions. This helps Claude discover which slice of the codebase to focus on based on the current task.
Hooks are usually used defensively (blocking edits to certain directories). But their more valuable use is continuous improvement.
Two hook types demonstrated:
Stop hook: Runs when Claude finishes a turn. Launches a separate headless Claude session to compare changes against CLAUDE.md rules, proposes updates in a markdown review document. Ensures rules evolve with the codebase.
Start hook: Loads dynamic context at session start — git status, unstaged changes, recent commits. Can be extended to pull from Confluence, Jira, etc.
"It's really bad when your CLAUDE.md goes stale." The stop hook creates a self-reflection process that constantly proposes updates.
Skills = reusable workflows loaded on demand (progressive disclosure). In large codebases, you may have dozens or hundreds of task types.
Critical feature most people miss: skills can be scoped to specific paths using the path parameter. Example: an "add API routes" skill only activates when editing files in the API services directory.
Distinction: Global rules (CLAUDE.md) = conventions and rules. Skills = workflows and processes.
For massive codebases (100K+ lines), grep alone is slow and token-inefficient. Solution: expose a Language Server Protocol through a local MCP server.
This gives Claude the same navigation developers have in their IDE:
Symbol-level search (not just string matching)
Find definitions and references
Type-aware navigation
Demo ▶ 19:44: "Find every place monthlyTotalSense is referenced" — using where_is and find_references tools instead of grep. Result: 1 definition, 2 references with precise locations.
Use sub-agents to split exploration from editing. Exploration tasks (web research, codebase discovery) can consume hundreds of thousands of tokens. If the primary session does this, the context window is bloated before editing even begins.
Pattern: dispatch exploration to sub-agents → they return summaries → primary session reasons and acts on the summaries.
Example prompt: "Spin up three sub-agents: one for the database, one for the backend, one for the frontend. Help me figure out how to add authentication."