You’ve installed Claude Code, you’ve run a few commands, and it’s helping you write code. But something keeps bothering you: every new session, you have to re-explain your project. “We use TypeScript, not JavaScript.” “Don’t use semicolons.” “Our API lives at /src/api.” Claude forgets all of it the moment you close the terminal.
That’s exactly the problem CLAUDE.md solves.
📋 TL;DR
– CLAUDE.md is a plain text file that gives Claude Code persistent memory about your project
– It loads automatically every time Claude Code starts a session in your project folder
– It replaces the need to re-explain your setup, preferences, and rules in every session
– Any developer (or non-developer) can write one — no special syntax required
– You can have one global CLAUDE.md for all projects, plus separate ones per project
This is part of our complete CLAUDE.md — The Complete Beginner’s Guide (2026), which walks you through everything from creating your first file to advanced team configurations.
What is CLAUDE.md?
CLAUDE.md is a plain text file written in Markdown (a simple formatting language that uses # for headings, - for bullet points, and so on) that Claude Code reads automatically at the start of every session.
Think of it like a briefing document you’d hand a new contractor on their first day. Instead of spending 30 minutes explaining how your company works, what tools you use, and what rules to follow — you hand them a printed sheet. They read it once, and now they’re up to speed. CLAUDE.md does that for Claude Code, except Claude reads it in milliseconds and never loses it.
The file lives in your project folder (or in your home directory for global rules) and the name is always exactly CLAUDE.md — capital letters, no spaces.
Why Does Claude Code Need It?
Claude Code — Anthropic’s AI-powered coding tool that works in your terminal — is stateless by default. That’s a technical way of saying it doesn’t remember anything between sessions.
Every time you open a new Claude Code session, it starts fresh. It has no idea:
- What language or framework your project uses
- What your coding style preferences are
- Which folders are off-limits
- What commands to run when testing
- What architectural decisions you’ve already made
Without CLAUDE.md, you either paste a wall of context into every session, or you get generic answers that don’t match your project. Neither is great.
With CLAUDE.md, Claude Code walks into your project already knowing the rules.
What Does a CLAUDE.md File Actually Look Like?
Here’s a real, minimal example you could use right now:
# My Project — Claude Code Instructions
## Project Overview
This is a Next.js 14 e-commerce site built for a UK-based clothing brand.
The backend is a REST API built in Node.js. The database is PostgreSQL.
## Tech Stack
- Framework: Next.js 14 (App Router)
- Language: TypeScript (strict mode)
- Styling: Tailwind CSS
- Database: PostgreSQL via Prisma ORM
- Testing: Vitest
## Coding Standards
- No semicolons
- Use single quotes for strings
- Prefer `const` over `let` — never use `var`
- All functions must have explicit TypeScript return types
## File Structure
- `/src/app` — Next.js pages and layouts
- `/src/components` — Reusable UI components
- `/src/lib` — Utility functions and helpers
- `/src/api` — API route handlers
## Commands
- Run dev server: `npm run dev`
- Run tests: `npm run test`
- Build: `npm run build`
## Important Rules
- Never modify files in `/src/legacy` — this code is frozen
- Always write tests for new utility functions
- Ask before installing new npm packages
That’s it. Plain English, clear headings, real information about a real project. No magic syntax. No special commands. Just words that tell Claude what it needs to know.
Why You Need One (Even for Small Projects)
You might be thinking: “My project is simple. I don’t need this.”
Here’s why you probably do.
It saves you time. Even typing “remember, we use TypeScript with strict mode” once per session adds up. Multiply that by every preference, every rule, every quirk of your project — it becomes significant.
It makes Claude more accurate. When Claude knows your stack, it stops suggesting jQuery when you’re using React. It stops writing Python when your project is Go. Accuracy goes up immediately.
It protects your codebase. You can explicitly tell Claude not to touch certain files, not to use certain patterns, and not to install packages without asking. That’s a real safety net, especially when you’re new to AI-assisted coding.
It’s a living document. As your project evolves, your CLAUDE.md evolves with it. It becomes a record of decisions made, patterns established, and rules set. New team members (human or AI) can read it and get up to speed fast.
💡 Pro Tip: If you’re a non-technical founder using Claude Code to build your product, CLAUDE.md is especially powerful. Write it in plain English — no technical jargon required. Tell Claude your business goals, what the app should do, and what decisions you’ve already made. Claude will respect those decisions instead of second-guessing them.
Global vs Project-Level: Two Flavors of CLAUDE.md
There are actually two places you can put a CLAUDE.md file, and they serve different purposes.
Project-level CLAUDE.md lives in your project’s root folder (the main folder of your codebase). It only applies when Claude Code is running inside that project. This is where your project-specific rules live — your tech stack, your file structure, your coding standards.
Global CLAUDE.md lives in your home directory (the folder your operating system considers your personal space, usually /Users/yourname/ on Mac). It applies to every Claude Code session on your machine, regardless of which project you’re in. This is where you put personal preferences that apply everywhere — like “always explain what you’re doing before writing code” or “never use emoji in comments.”
You can have both at the same time. Claude reads the global one first, then the project-level one, and combines the rules.
We cover this in depth in CLAUDE.md Global vs Project-Level — What’s the Difference? if you want the full breakdown.
How Claude Code Actually Uses It
When you start a Claude Code session inside a project folder, one of the first things Claude does is look for a CLAUDE.md file. If it finds one, it reads the entire file and treats the contents as instructions for the session.
This happens automatically. You don’t run a command. You don’t paste anything. You just open Claude Code and it’s already in context.
Claude treats CLAUDE.md as high-priority instructions. If your CLAUDE.md says “always use Tailwind for styling,” Claude won’t suggest writing raw CSS. If it says “never use any in TypeScript,” Claude will avoid it even if any would technically work.
It’s not magic — it’s just Claude reading instructions you wrote. But the effect feels like working with an assistant who actually knows your project.
⚠️ Warning: CLAUDE.md instructions are not enforced like code rules. Claude will generally follow them, but if you give a conflicting instruction during a session (“just use inline styles this one time”), Claude will likely follow your in-session request. Think of CLAUDE.md as strong guidance, not locked constraints.
Who Should Write a CLAUDE.md?
Honestly? Anyone using Claude Code more than once.
Solo developers benefit because it means never re-explaining their preferences. Set it once, benefit every session.
Teams benefit because it creates a shared standard. Everyone’s Claude sessions follow the same project rules, which means more consistent code across contributors.
Non-technical founders benefit because it’s a way to express intent without writing code. “This app should always prioritize speed over feature richness” is a valid CLAUDE.md entry. Claude will factor that into its suggestions.
If you’ve used Claude Code even a handful of times and found yourself repeating context, you need a CLAUDE.md.
The Simplest Possible CLAUDE.md to Start With
If you want to start today with the absolute minimum viable CLAUDE.md, here it is:
# Project Instructions
## What This Is
[One sentence describing your project]
## Language and Framework
[What language and framework you're using]
## Key Rules
- [Your most important rule]
- [Your second most important rule]
Fill in those three brackets right now and you’ve already improved every future Claude Code session in this project.
For a deeper look at exactly what to include, check out What to Put in Your CLAUDE.md (With Real Examples).
Common Questions
Does CLAUDE.md work with other AI tools?
The name CLAUDE.md is specific to Claude Code — it’s what Anthropic’s tool looks for. Other AI coding tools have their own equivalents (Cursor uses .cursorrules, for example). The concept is the same, but the filename matters.
Does Claude read it every message, or just once at the start?
Claude reads CLAUDE.md at the start of the session and keeps it in context throughout. You don’t need to reference it manually — it’s always there in the background.
What if I make a mistake in my CLAUDE.md?
You can edit it any time in a regular text editor. Changes take effect the next time you start a Claude Code session. No reloading, no compiling — just save and restart.
Can CLAUDE.md include secrets or API keys?
No. Never put API keys, passwords, or sensitive credentials in CLAUDE.md. This file is plain text and may be committed to version control where others can see it. Keep secrets in environment variables where they belong.
Key Takeaways
- CLAUDE.md is a plain text file** that gives Claude Code persistent memory about your project — no special syntax, just clear instructions
- It loads automatically** every time Claude Code starts in your project folder, so you never have to paste context again
- You can have two levels** — one global file for personal preferences, one per-project file for project-specific rules
- It makes Claude more accurate** by ensuring every suggestion matches your actual tech stack, standards, and constraints
- Anyone can write one** — developers, non-technical founders, and solo builders all benefit from having one
Next Steps
You know what CLAUDE.md is. Now it’s time to actually create one.
- How to Create Your First CLAUDE.md File** — step-by-step instructions to create and test your first CLAUDE.md in under 10 minutes
- What to Put in Your CLAUDE.md (With Real Examples)** — the complete list of what to include, with real examples you can copy
- CLAUDE.md Templates for Beginners — Copy and Use These** — ready-made templates for common project types you can use immediately
Return to CLAUDE.md — The Complete Beginner’s Guide (2026) for the full picture.