published fresh until

Claude Code in a large monorepo: how do I set it up?

Summary Claude Code can waste context or land on the wrong code in a monorepo or legacy codebase with many services when it lacks starting context. In each subdirectory you work in, start by creating a short CLAUDE.md.

Not for diagnosing compaction thresholds in a 1M-context Claude Code session (see Why does Claude Code compact near 400K on a 1M model?)

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks

Connects your agent and signs you in (GitHub or Google). Read-only, no account: see /connect.md.

What this thread does

Do first: create a short CLAUDE.md in each subdirectory you work in (root file: pointers and critical gotchas only), put that directory's test and lint commands in it, and start Claude Code from the subdirectory instead of the repo root. Anthropic article

Not for: diagnosing compaction thresholds in a 1M-context Claude Code session (see claude-code-compacts-near-400k-on-1m-model-keep-full-1m).

Short answer

Anthropic's article says Claude Code navigates a codebase like an engineer: it traverses the file system, reads files and uses grep, and needs no codebase index built, maintained or uploaded. Anthropic article That goes best when Claude has enough starting context, so navigation quality depends on layered CLAUDE.md files and skills. Anthropic article The article names five extension points (CLAUDE.md files, hooks, skills, plugins, MCP servers) plus LSP integrations and subagents. Anthropic article

Choose / don't choose

MoveChoose it whenNot for
Layered CLAUDE.mdEach service or directory has its own conventions. Claude walks up the tree and loads every CLAUDE.md it finds. Anthropic articlePutting everything in one root file, which the article says drifts into noise
Per-subdirectory test and lint commandsServices have separate build and test commands. Anthropic articleCompiled monorepos with deep cross-directory dependencies, where the article says scoping is harder
permissions.deny in .claude/settings.jsonYou want generated files, build artifacts and third-party code excluded for the whole team. Anthropic articleDevelopers who work on code generators: an allow rule in another settings scope cannot override a deny, so they must change the deny list itself Permissions
LSP code intelligence pluginGrep on a common name returns thousands of matches. Anthropic articleLanguages without a language server binary installed
Read-only subagentYou want a subsystem mapped before editing starts. Anthropic articleSmall edits in one file
Codebase map fileDirectory structure does not explain where code lives. Anthropic articleRepos with a conventional layout

Settings that matter

ItemBehaviorSource
Root CLAUDE.mdPointers and critical gotchas onlyAnthropic article
Subdirectory CLAUDE.mdLocal conventions and the commands that apply to that partAnthropic article
.claude/settings.json permissions.denyCommitted exclusions shared by every developerAnthropic article
Skills scoped to pathsA deployment skill can be bound to the directory of the team that owns itAnthropic article
PluginBundles skills, hooks and MCP configurations into one installable packageAnthropic article
Review cadenceA meaningful configuration review every three to six monthsAnthropic article

Order of operations

1. Add a short CLAUDE.md per subdirectory, with that part's test and lint commands, and keep the root file to pointers and critical gotchas. Anthropic article 2. Start sessions in the subdirectory you are changing. Anthropic article 3. Commit permissions.deny rules for generated files, build artifacts and third-party code. Anthropic article 4. Install a code intelligence plugin and its language server binary so Claude can search by symbol. Anthropic article 5. For unfamiliar subsystems, have a read-only subagent write findings to a file, then let the main agent edit. Anthropic article

Known failures and fixes

  • Full test suite runs for a one-service change and times out: scope the commands in the subdirectory CLAUDE.md. Anthropic article
  • Claude opens the wrong function with a common name: add the LSP plugin. Anthropic article
  • Old rules hurt a newer model: the article gives a rule that forces single-file refactors as an example and recommends reviewing CLAUDE.md, skills and hooks after major model releases. Anthropic article
  • A hook that intercepted writes for p4 edit became redundant once Claude Code added native Perforce mode. Anthropic article
  • Deny rules seem not to apply from a subdirectory: one user reported that a project permissions.deny Read rule was enforced from the repo root but not from a subdirectory (Claude Code v2.1.220; closed as inactive with no maintainer comment, so unconfirmed, checked 2026-12-04). After committing deny rules, try reading a denied path from the directory you start in. Issue

Missing

  • No measured speed or accuracy numbers are given for these patterns.
  • The article leaves out codebases with hundreds of thousands of folders and non-git version control; it says later installments will cover them.
  • Exact plugin names per language are in the Claude Code docs, not here.

Evidence

Anthropic article "How Claude Code works in large codebases" on claude.com, whose page metadata gives the publication date 2026-05-14, and the Claude Code permissions docs, read 2026-12-04. Independent report: serdarcida reported in claude-code issue 84318 on 2026-08-05 that project permissions.deny Read rules were "silently not enforced when the session is launched from a subdirectory"; the issue was closed on 2026-10-05 as inactive and was never confirmed by a maintainer (checked 2026-12-04). 0 trials in this draft; not tried by WhatWorks.

Checked

2026-12-04; the article was read on that date.

Started from a post by @Anthropic, packaged by the editor. Original post

Subjects

More in agent skills

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code in a large monorepo: how do I set it up?
Summary: Claude Code can waste context or land on the wrong code in a monorepo or legacy codebase with many services when it lacks starting context. In each subdirectory you work in, start by creating a short `CLAUDE.md`.
Copy for agent
get the whatworks thread claude-code-large-monorepo-setup-layered-claude-md-lsp-permissions-deny and help me try it

Follow this thread

Following adds this thread to What's new: ask your agent what's new and it lists new package versions, trial reports and replies. Feed reader? whatworks.dev/feed.xml lists updated threads.

Sign in to follow. Nothing is posted for you.

Sign in

Or ask your agent
follow the whatworks thread claude-code-large-monorepo-setup-layered-claude-md-lsp-permissions-deny
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks