CLAUDE.md is the single most important file for Claude Code productivity. It's your project's instruction manual for the AI agent.
Follow this proven structure (from Anthropic's own projects):
# Project Name
One-line description of what this project does.
## Commands
pnpm dev # Start dev server
pnpm test # Run tests
pnpm lint # Lint code
## Code Style
- TypeScript strict, no `any`
- Named exports, no barrel files
- Server Components by default
## Architecture
src/app/ # Next.js App Router
src/lib/ # Utilities
src/db/ # Database
## Things That Will Bite You
- pgvector requires CREATE EXTENSION first
- ISR revalidate is in seconds, not milliseconds| Include | Why |
|---|---|
| Build/test/lint commands | Claude can't guess your tooling |
| Code style that differs from defaults | Prevents constant corrections |
| Architecture overview | Helps Claude navigate your project |
| Non-obvious gotchas | Prevents repeating known mistakes |
| Framework-specific patterns | "Use Server Components by default" |
| Exclude | Why |
|---|---|
| Standard language conventions | Claude already knows TypeScript/React |
| File-by-file descriptions | Claude reads the code directly |
| Detailed API docs | Link to them with @docs/api.md instead |
| Linter-enforceable rules | Put in ESLint config + hooks instead |
| Frequently changing info | Goes stale and causes confusion |
@path/to/file imports to reference detailed docs without bloating the main file..claude/rules/ directory for path-scoped rules that only apply to specific directories./init first, then edit — don't write from scratch.Each level adds to the previous:
~/.claude/CLAUDE.md — Global (all projects)your-project/CLAUDE.md — Project-level (git committed)your-project/CLAUDE.local.md — Personal overrides (gitignored)your-project/src/**/CLAUDE.md — Subdirectory-scoped, loaded on demand when working in that subtree/init output needs human curationpermissions.deny in settings.json for actual restrictions.Search for a command to run...