← All guides
claude-md example

Claude-md example: CLAUDE.md Example: Solo, Team and Monorepo

8 min read

Copy a working CLAUDE.md example, see why each section earns its place, and learn what changes for a team repo or monorepo.

Claude-md example: CLAUDE.md Example: Solo, Team and Monorepo
On this page

A good claude-md example is short: a one-line stack, a commands list, a directory map and a handful of explicit rules. The full React example in one public repo is 101 lines, about 4 KB (github.com). Solo developers keep one root file. Teams add REVIEW.md for review-only rules. Monorepos nest files per directory and import the rest.

SetupFiles usedWhat Claude loadsWatch out for
SoloRoot CLAUDE.md, optional CLAUDE.local.mdCLAUDE.md at launch; the local file is appended right after it (claudecodeguide.dev)Local file stays out of git, so nothing in it reaches teammates
Team repoRoot CLAUDE.md plus REVIEW.mdReviews read root and parent-directory CLAUDE.md files (code.claude.com)REVIEW.md is read from the base or default branch, so merge it first
MonorepoRoot plus nested CLAUDE.md, rules, @ importsA subdirectory file loads only when a PR changes a file under it (code.claude.com)Imports nest up to four hops (claudecodeguide.dev)
VerdictSolo: one file. Team: add REVIEW.md. Monorepo: nest and import.

What does a working CLAUDE.md example look like?

Here is a skeleton modeled on the public React example. Replace each line with your own.

# Project
This is a Next.js 16 app using App Router, Tailwind CSS, and TypeScript.

## Commands
- `npm run test -- --run src/components/Button.test.tsx` — run a single test file
Always run `npm run typecheck && npm run lint` before committing.

## Architecture
- `src/features/` — feature modules, each with its own components, hooks, and API calls

## Rules
- Server state: TanStack Query — never store API data in local state
- Mock API calls with MSW, not jest.mock
- Strict mode enabled — do not use `any` unless absolutely necessary with a comment explaining why

The stack line borrows the guide's phrasing: framework, styling, language (claudecodeguide.dev). If your file grows far past the 101-line example, start cutting before you add more.

How do you write the stack, commands and architecture sections?

  1. Generate a first draft. Run claude /init; Claude scans your project files, detects your framework and language, and writes the CLAUDE.md (claudecodeguide.dev).
  2. Keep the stack to one line. Framework, styling, language. Add database, auth and deploy target only if they apply.
  3. List the single-test-file command. Syntax varies across runners, so Claude guesses wrong without it (github.com).
  4. State the pre-commit check. The example says to run typecheck and lint before committing (github.com).
  5. Map directories to purposes. One line per directory lets Claude navigate directly instead of searching (github.com).

Which coding rules are worth stating explicitly?

Write rules Claude can follow without interpretation. The React example shows three kinds (github.com):

  • State ownership: assign each kind of state to a tool, such as server state to TanStack Query, and say what never goes in local state.
  • Mocking policy: use MSW for API mocks, not jest.mock.
  • Type escape hatches: any is allowed only with a comment explaining why.

"Write clean code" fails because it assigns nothing. Each rule above names a tool or a condition.

How do you define session start and end and register your tools?

Add a short lifecycle section: what to read at session start, and what to write at the end. One example ending rule reads "Write a handoff if work is in-progress. Save any corrections to memory." (claudecodeguide.dev) The guide's author says it takes about a week to pay off, then saves 15-20 minutes per session. That is one author's claim, not a measured study.

For tools, do less than you think. Claude Code auto-discovers .claude/rules/, .claude/agents/ and .claude/skills/ with no registration (claudecodeguide.dev). A custom folder layout is invisible unless CLAUDE.md points to it. List only those custom paths. For when a skill beats a subagent, see Claude Code Skills vs Subagents.

Which setup are you: solo, team or monorepo, and what changes?

Solo. Keep one root file. Put personal preferences in CLAUDE.local.md, which sits beside CLAUDE.md, stays out of git and is appended right after it (claudecodeguide.dev).

Team repo. Keep project conventions in the root CLAUDE.md. Put review-only instructions in REVIEW.md, which holds instructions for reviews alone, while CLAUDE.md is read for every task. Two traps:

  • REVIEW.md is read from the base or default branch, never from the PR's own changes (code.claude.com). Merge it before expecting it to apply.
  • The local /code-review command reads CLAUDE.md, not REVIEW.md, so guidance you want in both places belongs in CLAUDE.md (code.claude.com).

Monorepo. A review reads the root CLAUDE.md and the CLAUDE.md files in the parent directories of each changed file (code.claude.com). A subdirectory file is read only when the PR changes something under that path. So put package-specific rules next to the package. Use @path/to/file imports, resolved relative to the importing file and nested up to four hops (claudecodeguide.dev). Rules with paths: frontmatter load only when Claude opens a matching file; rules without it load at launch.

REVIEW.md has hard limits: at most eight included files, under 150,000 bytes combined (code.claude.com). Go past the limit on Markdown links and the review skips the whole root REVIEW.md, not only the included files, so keep links to a minimum. An @ line in an included file or a subdirectory REVIEW.md stays plain text.

Our pick: solo developers stay root-only. Teams add REVIEW.md once reviews produce noise. Monorepos nest early. More examples by setup are in 12 CLAUDE.md Examples Worth Copying.

What should you leave out of CLAUDE.md?

  • Anything that changes constantly. It goes stale within days, and an outdated instruction misleads more than blank space (claudecodeguide.dev).
  • Bulk. CLAUDE.md is an index, not a dump; point to files instead of inlining (claudecodeguide.dev).
  • Vague advice. If a rule assigns no tool or condition, cut it.

Move bulky material into imports, path-scoped rules or skills. Auto memory works the same way: its MEMORY.md index loads only its first 200 lines or 25KB at session start (claudecodeguide.dev).

How do you check which rules Claude actually loaded?

  1. Run /context to see which files loaded into the current session (claudecodeguide.dev).
  2. Run /memory to list every CLAUDE.md and memory location, or turn auto memory off (claudecodeguide.dev).
  3. For path-scoped rules, open a matching file first; they do not load until then (claudecodeguide.dev).
  4. Break a rule on purpose in a test task. If Claude ignores it, reword it or move it to a hook; see A Real, Annotated CLAUDE.md Example.

When is copying someone else's CLAUDE.md the wrong move?

Copying fails when the stack differs. A React file's TanStack Query and MSW rules mean nothing in your Go service. Run claude /init instead and edit what it detects (claudecodeguide.dev). Copying also fails when the file references a custom layout you do not have, or the reverse: your layout is invisible unless you point to it. Strip anything time-sensitive from a borrowed file, since stale lines mislead. Copy the structure, not the content.

ClockedCode: Upgrade your Claude Code setup in one paste A curated Claude Code setup: vetted tools, subagents, and a tuned CLAUDE.md, compiled into one master prompt you paste once.

Frequently asked questions

How long should a CLAUDE.md be?

The public React example runs 101 lines, about 4 KB (github.com). Treat that as a ceiling to approach slowly. Past it, split content into imports or path-scoped rules.

Does the local /code-review command read REVIEW.md?

No. It reads your CLAUDE.md files and not REVIEW.md (code.claude.com). Anything you want applied in both local and PR reviews goes in CLAUDE.md.

Can a CLAUDE.md import other files?

Yes, with @path/to/file, resolved relative to the importing file and nested up to four hops (claudecodeguide.dev). Use it to keep the root file as an index.

Next step: run claude /init, trim the output to the skeleton above, then check it with /context.

Frequently asked questions

How long should a CLAUDE.md be?

The public React example runs 101 lines, about 4 KB (github.com). Treat that as a ceiling to approach slowly. Past it, split content into imports or path-scoped rules.

Does the local /code-review command read REVIEW.md?

No. It reads your CLAUDE.md files and not REVIEW.md (code.claude.com). Anything you want applied in both local and PR reviews goes in CLAUDE.md.

Can a CLAUDE.md import other files?

Yes, with @path/to/file, resolved relative to the importing file and nested up to four hops (claudecodeguide.dev). Use it to keep the root file as an index.

Next step: run claude /init, trim the output to the skeleton above, then check it with /context.