What is CLAUDE.md?
The complete guide to configuring Claude Code with CLAUDE.md files. Learn best practices, see real examples, and master AI-assisted development.
Understanding CLAUDE.md Files
CLAUDE.md is a markdown configuration file that provides persistent instructions to Claude Code, Anthropic's CLI-based AI coding assistant. It defines project context, coding standards, and preferences that Claude references in every conversation. This file is essential for consistent AI-assisted development across your codebase.
Think of CLAUDE.md as Claude Code's memory system. Without it, Claude starts each session with no knowledge of your project's conventions, preferred patterns, or unique requirements. With a well-crafted CLAUDE.md, Claude understands your project from the first prompt.
Where Does CLAUDE.md Go in Your Project?
CLAUDE.md files can be placed in multiple locations, each with different scope:
- Project root (most common) — Create
CLAUDE.mdand commit it to git for team sharing - Personal settings — Use
CLAUDE.local.mdand add to .gitignore for personal preferences - Global settings — Place at
~/.claude/CLAUDE.mdto apply to all sessions - Subdirectories — Additional CLAUDE.md files in child directories for component-specific rules
How Claude Code Reads Your CLAUDE.md
Claude Code automatically loads CLAUDE.md contents and prepends them to every prompt. The file is read when you start a session, and changes are picked up on subsequent messages. You can also use the /init command to generate a starter CLAUDE.md for your project.
CLAUDE.md File Structure
There's no required format for CLAUDE.md files, but a clear structure helps Claude understand your project better. Here's a recommended template:
Best Practices for Writing CLAUDE.md
Keep Instructions Concise
The contents of CLAUDE.md are prepended to your prompts, consuming part of your token budget. A bloated file costs more and can introduce noise. Use short, declarative bullet points instead of long paragraphs.
Focus on the Three W's
- WHAT — Your tech stack, project structure, dependencies
- WHY — The purpose of the project and its components
- HOW — How Claude should work on your project (e.g., use bun instead of npm)
Include Specific Commands
Document common bash commands, test commands, and build processes. This helps Claude execute the right commands without asking.
Iterate and Refine
Your CLAUDE.md becomes part of Claude's prompts, so treat it like any frequently used prompt. Experiment with different instructions to see what produces the best results. Use the # key to add instructions on the fly.
CLAUDE.md Examples by Project Type
React/Next.js Project
Python Backend Project
AGENTS.md — Multi-Agent Configuration
AGENTS.md is a companion file for more advanced Claude Code setups. While CLAUDE.md provides general project context, AGENTS.md defines specific agent behaviors for complex workflows. You can use both files together.
Use AGENTS.md when you need to define multiple specialized agents or when your project requires different behaviors in different contexts.
Common CLAUDE.md Mistakes to Avoid
- Being too vague — "Write good code" doesn't help. Be specific: "Use TypeScript strict mode, no any types"
- Overloading with information — Don't dump your entire codebase documentation. Focus on what's unique and actionable
- Stating the obvious — If a folder is named "components", you don't need to explain it contains components
- Forgetting to update — Your CLAUDE.md should evolve with your project. Outdated instructions cause confusion
- Conflicting instructions — Review your file periodically to ensure consistency
Managing CLAUDE.md Files Across Projects
If you work on multiple projects, managing CLAUDE.md files across all of them can become tedious. You might want to share common patterns, keep track of what's in each file, or quickly update configurations across repositories.
Tools like ClaudeMDEditor provide a visual interface for managing all your AI coding assistant config files — including CLAUDE.md, .cursorrules, copilot-instructions.md, and more — from one place.
Related Guides
Frequently Asked Questions
Manage Your CLAUDE.md Files Visually
ClaudeMDEditor lets you browse, edit, and organize CLAUDE.md files across all your projects. Plus it handles .cursorrules, copilot-instructions.md, and more.
One-time purchase for macOS Tahoe (26+)