Nest CLAUDE.md Files for Monorepo Context
If your project has multiple distinct areas — a frontend, a backend, and a shared library — a single top-level CLAUDE.md can only do so much. Claude Code reads CLAUDE.md files from the current directory upward, so you can layer them.
my-monorepo/
├── CLAUDE.md # General project rules and conventions
├── frontend/
│ └── CLAUDE.md # React + Tailwind specifics
└── api/
└── CLAUDE.md # Laravel API conventions
When Claude Code is running inside the api/ directory, it picks up both the root CLAUDE.md and the api/ one automatically, merging the context. The subdirectory file wins for any conflicts.
Use this to encode module-specific rules that would be noise everywhere else — things like "always use the Repository pattern here", "this service uses snake_case for routes", or "never import directly from the database layer."
my-monorepo/api/CLAUDE.md
---
- Use the Repository pattern for all database access
- Routes follow snake_case naming (e.g. /user_accounts, not /userAccounts)
- All controllers extend BaseApiController
Stack your CLAUDE.md files like config files — general at the root, specific where it counts.
Log in to leave a comment.
When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.
Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.
Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.