CLAUDE.md is Claude Code's persistent memory. Every project that ships fast has a great CLAUDE.md. The difference between a junior using Claude Code and a senior using Claude Code is mostly the quality of their CLAUDE.md files.
Learning Objectives
After this lesson, you will be able to:
Write a CLAUDE.md that captures your project's tech stack, conventions, and 'house rules', so every Claude Code session starts already knowing the rules
Use nested CLAUDE.md files in monorepos so each subproject loads its own context without bloating the top-level file
Distinguish CLAUDE.md (always loaded) from .claude/rules/ (path-scoped) from settings.json (config), and pick the right place for each rule
Avoid the three CLAUDE.md anti-patterns that bloat context, encourage hallucination, or get ignored entirely
A markdown file at your project root (or any directory). When Claude Code starts a session, it auto-reads CLAUDE.md and includes its contents in the system prompt. Result: every conversation starts knowing the rules of YOUR project.
Your Reflection
Saves automatically
What’s one thing you learned? What’s still confusing?
## Always
- Run `npm run lint` before committing
- Add tests for any new business logic
- Use Pydantic for API request/response validation
## Never
- Commit .env files or secrets
- Use `any` in TypeScript
- Skip the eval pipeline before deploying ML models
## Adding a New Feature
1. Create vertical slice: backend + frontend + tests
2. Run `npm run build` and `pytest` to verify
3. Open PR with conventional commit message
## Gotchas
- The Postgres connection requires SSL on staging — set DATABASE_URL accordingly
- Stripe webhooks need raw body parsing (don't use bodyParser middleware)
Tests · Save the template as CLAUDE.md, customize the tech stack section to match your real project. Verify Claude Code references the file by asking a project-specific question.
Your team's CLAUDE.md is 1500 lines and covers every detail of your codebase. Symptoms: Claude is slower to respond and frequently misses small rules. What's the fix?
Quick check
You have a monorepo with a Next.js frontend and a FastAPI backend. The frontend uses Tailwind kebab-case files; the backend uses snake_case Python files. Where should each convention live?
CLAUDE.md is the brain. Next: the .claude/ ecosystem, where the rest of your project's Claude Code config lives.