Skip to main content
NOV 2026 Latest guide updates. Latest: AI Design Patterns Local vs cloud AI Grill me Changelog →
T07 Intermediate Technical

CLAUDE.md Best Practices

Writing effective instructions that Claude reads every session

PDF editions Β· Guide v3.44.1 Β· Updated

What to include

An effective CLAUDE.md contains three essential blocks: the tech stack, build/test commands, and critical conventions. Anything Claude can infer from the code itself (folder structure, detected framework, package manager) does not need to be documented.

## Stack
Next.js 14, TypeScript, PostgreSQL/Prisma, pnpm
## Commands
- `pnpm dev` β€” start the server
- `pnpm test` β€” run tests
- `pnpm build` β€” production build
## Critical conventions
- Always pnpm, never npm or yarn
- Functional components only
- kebab-case files (my-component.tsx)

What NOT to include

AvoidReason
Long narrative documentationDilutes critical rules
Historical context (β€œIn 2023 we decided…”)Does not help Claude act
References to entire filesUse @path/file instead
Rules Claude already followsUnnecessary noise, token cost

Keep instructions concise and review their effect on real tasks. About 200 lines is a practical starting point, not a demonstrated boundary for model consistency.

Practical rule: if Claude makes the same mistake twice, add the rule. Do not document everything preemptively.

Hierarchical structure

~/.claude/CLAUDE.md (global, all projects)
/project/CLAUDE.md (project, committed)
/project/CLAUDE.local.md (personal, add to .gitignore)

In a monorepo, Claude loads the root CLAUDE.md then merges the CLAUDE.md from the active subfolder. Child rules complement parent rules without overriding them.

Explicit imports with @

# In CLAUDE.md
@docs/conventions/coding-standards.md
@docs/conventions/architecture.md

Imports in CLAUDE.md load with that instruction file. Unscoped rules load generally; rules with paths frontmatter load when matching files are relevant. Use a skill when the complete workflow should load only on invocation.

.claude/
β”œβ”€β”€ CLAUDE.md (index, < 100 lines)
└── rules/
β”œβ”€β”€ testing.md (coverage thresholds)
β”œβ”€β”€ security.md (security invariants)
└── api.md (REST conventions)

CLAUDE.md stays readable at a glance. Detailed rules live in .claude/rules/; scope file-specific instructions with paths.

Enter your email to read the full card and get the complete PDF bundle.

All content is free and open-source. We just ask for your email.

PDF: