DEV Community

Ogasawara Kakeru
Ogasawara Kakeru

Posted on

Claude Code ~Claude.md~

What it is

CLAUDE.md is a Markdown file in your project root that gives Claude Code persistent memory about the project. Claude Code reads it automatically at the start of every session and adds its contents to your prompt.

Without it, Claude re-explores the codebase each session, which can lead to wrong assumptions.

Two levels

Level Location Scope
Project-level Project root, committed to version control Shared with the team
User-level Your settings folder Personal, applies to all projects

Example contents

A simple, short sample file includes:

  • A project description (e.g., a Next.js app using Tailwind and Drizzle ORM)
  • Commands for the dev server, tests, and linting
  • Code style rules (indentation, named exports, where API routes live)

Recommendations

  1. Save corrections to memory. If you keep correcting the same behavior, ask Claude to save the rule to CLAUDE.md (e.g., "prefer server actions over API routes").
  2. Reference documents. Use @ with a file path (e.g., @README.md) so Claude reads that document.
  3. Start small. Don't write the file up front. Note where Claude keeps needing correction, and keep the file compact. Run /init to have Claude generate one.

Try it

  1. Run /init in a project without a CLAUDE.md.
  2. Delete lines a new team member wouldn't need.
  3. Add one correction you often make.
  4. Start a new session and check that Claude follows it.

Recap

Much of the difference between frustrating and productive sessions comes down to context, and CLAUDE.md is how you provide it. Start with your tech stack, preferences, and commands, then build from there.

Navigation: Previous lesson: Code Review. Next lesson: Subagents.

Note: the page content was retrieved from a stored copy (2026-11-22).

Top comments (0)