CLAUDE.md

CLAUDE.md for a monorepo

Root CLAUDE.md for a monorepo with several packages. The root file covers only what is shared; each package keeps its own CLAUDE.md, which Claude reads only when it works there, so context stays small.

Tested with Claude Code 2.1.329

Spots to fill

  • {{repo_name}}Monorepo namee.g. acme-platform
  • {{workspace_tool}}Workspace tool (pnpm, turbo, nx…)e.g. pnpm
  • {{package}}Name of one package (repeat the second file for each package)e.g. ui-kit
CLAUDE.md
# {{repo_name}}

Monorepo managed with {{workspace_tool}} workspaces.

## Layout
- `apps/`: deployable apps. `packages/`: shared libraries.
- Each app or package has its own `CLAUDE.md` with its commands; read it before working there.

## Commands (from the repo root)
- Install everything: `{{workspace_tool}} install`
- Run one package's tests: `{{workspace_tool}} --filter <package> test`
- Affected packages only: `{{workspace_tool}} --filter "...[origin/main]" test`

Test only what you changed and what depends on it; the full suite is for CI.

## Rules that apply everywhere
- A package may import another only through its public entry point, never a deep path.
- Changing a shared package means checking every app that uses it.
- One concern per pull request; do not mix a refactor with a feature.

## Do not
- Edit lockfiles by hand.
- Change CI files under `.github/` unless asked.
packages/{{package}}/CLAUDE.md
# {{package}}

What this package does in one sentence.

## Commands
- Test: `{{workspace_tool}} --filter {{package}} test`

## Notes
- Public entry point: `src/index.ts`. Everything else is internal.

Related lessons

Type to search the reference, templates and lessons.