← BLOG
Tips

CLAUDE.md Best Practices for Any Project

CLAUDE.md is a markdown file Claude Code reads at the start of every session. Here's how to write one that actually works.

CLAUDE.md is a markdown file you place at the root of your project. Claude Code reads it at the start of every session — before you type anything. Think of it as a briefing document: it tells Claude what your project is, how it's structured, what conventions you follow, and what to avoid.

A minimal CLAUDE.md

markdown
# Project Context

This is a Next.js 14 app with TypeScript, Tailwind CSS, and Prisma.
Database: PostgreSQL. Auth: NextAuth.js.

## Commands
- `npm run dev` — start dev server
- `npm run test` — run Jest tests
- `npm run db:migrate` — run Prisma migrations

## Conventions
- Use server components by default
- Client components go in /components/client/
- All API routes use Zod for validation
- Never use `any` in TypeScript

## Do not
- Modify the /legacy folder
- Change the auth configuration

What to include

The most useful sections are:

+Tech stack — framework, language, database, auth+Commands — how to run, test, and deploy+Conventions — naming, file structure, code style+Restrictions — what Claude should never touch

What to avoid

Don't write a novel. Claude Code reads this file in full at every session — keep it under 200 lines. Prioritize the things that would trip up a smart developer who's new to your codebase.

ALL POSTSSTART FREE COURSE →