You’ve heard that CLAUDE.md saves you from repeating yourself every Claude Code session. Now you want to actually make one. Good — this is the article that gets it done.
By the end of this guide, you’ll have a working CLAUDE.md file in your project, you’ll have tested that Claude Code is reading it, and you’ll know exactly what to add next.
📋 TL;DR
– CLAUDE.md is a plain text file you create manually in your project folder
– You can create it with any text editor — no special tools needed
– The file must be named exactlyCLAUDE.md(all caps,.mdextension)
– You’ll test it by asking Claude a question that requires the file’s context to answer correctly
– Takes under 10 minutes to set up from scratch
This is part of our complete CLAUDE.md — The Complete Beginner’s Guide (2026). If you’re not sure what CLAUDE.md is yet, start with What is CLAUDE.md? (And Why You Need One) first.
What You’ll Need Before You Start
You don’t need much. Here’s the short list:
- Claude Code installed** on your machine — if you haven’t done this yet, follow How to Install Claude Code on Mac or How to Install Claude Code on Windows
- A project folder** — an existing codebase, or even just an empty folder you’re about to start building in
- A text editor** — VS Code, Sublime Text, Notepad, TextEdit, Nano in the terminal — literally anything that saves plain text files
That’s it. No special software. No configuration. You’re already set up.
Step 1: Navigate to Your Project Folder
Open your terminal and navigate to your project’s root folder. The root folder is the top-level directory of your project — the one that contains all your other files and folders.
# Navigate to your project folder (replace with your actual path)
cd /Users/yourname/projects/my-project
If you’re not sure where your project lives, you can find it in your file manager (Finder on Mac, File Explorer on Windows), right-click the folder, and look for “Open in Terminal” or “Copy path.”
Confirm you’re in the right place by listing the files in the folder:
# List the files in your current directory
ls -la
You should see your project’s existing files — things like package.json, index.js, src/, or whatever your project contains. If you see those files, you’re in the right place.
Step 2: Create the CLAUDE.md File
Now create the file. You can do this directly in the terminal or in your text editor. Both work fine.
Option A: Create it in the terminal (fastest)
# Create a new CLAUDE.md file in your current directory
touch CLAUDE.md
The touch command creates an empty file with the name you specify. This works on Mac and Linux. On Windows, use:
# Windows alternative to create an empty file
echo. > CLAUDE.md
Option B: Create it in VS Code
Open your project folder in VS Code (File > Open Folder), then right-click in the file explorer panel on the left and choose New File. Type CLAUDE.md as the filename and press Enter.
⚠️ Warning: The filename must be exactly
CLAUDE.md— all capital letters, with.mdas the extension.claude.md,Claude.md, andCLAUDE.txtwill not be read by Claude Code. Capitalization matters.
Step 3: Write Your First CLAUDE.md Content
Open the file in your text editor and add content. This is where most people freeze up — they’re not sure what to write. Don’t overthink it.
Start with just three sections: what your project is, what tech stack you’re using, and your most important rule. Here’s a real template to copy:
# Project Instructions for Claude Code
## What This Project Is
This is a [description of your project — one or two sentences].
The intended users are [who uses this app/tool].
## Tech Stack
- Language: [e.g. TypeScript, Python, PHP]
- Framework: [e.g. Next.js, Django, Laravel]
- Database: [e.g. PostgreSQL, MySQL, MongoDB]
- Styling: [e.g. Tailwind CSS, SCSS, Bootstrap]
## Key Coding Rules
- [Your most important rule, e.g. "Always use TypeScript — never use plain JavaScript"]
- [Second rule, e.g. "No semicolons — we follow the StandardJS style"]
- [Third rule, e.g. "Write a comment above every function explaining what it does"]
## Project Structure
- `/src` — main source code
- `/src/components` — reusable UI components
- `/src/utils` — helper functions
- [Add your actual folder structure here]
## Commands
- Start dev server: `[your command, e.g. npm run dev]`
- Run tests: `[your command, e.g. npm test]`
- Build for production: `[your command, e.g. npm run build]`
Replace everything in brackets with your actual project details. Here’s what that looks like when filled in for a real project:
# Project Instructions for Claude Code
## What This Project Is
This is a task management web app for small business owners.
Users can create projects, assign tasks to team members, and track deadlines.
## Tech Stack
- Language: TypeScript (strict mode enabled)
- Framework: Next.js 14 with App Router
- Database: PostgreSQL, accessed via Prisma ORM
- Styling: Tailwind CSS
- Authentication: NextAuth.js
## Key Coding Rules
- Always use TypeScript — never write plain JavaScript files
- No semicolons — we follow the Prettier default config
- Use named exports, not default exports, for components
- Every database query must include error handling
## Project Structure
- `/src/app` — Next.js App Router pages and layouts
- `/src/components` — reusable UI components
- `/src/lib` — database client, auth config, utilities
- `/src/types` — shared TypeScript interfaces and types
## Commands
- Start dev server: `npm run dev`
- Run tests: `npm run test`
- Type check: `npm run typecheck`
- Build: `npm run build`
💡 Pro Tip: Don’t try to write a perfect CLAUDE.md on day one. Write what you know right now — even just 5-10 lines. You can always add more later. A simple CLAUDE.md you actually create today is worth more than a perfect one you plan forever.
Step 4: Save the File
Save the file. In VS Code that’s Cmd+S (Mac) or Ctrl+S (Windows). In the terminal with a text editor like Nano, press Ctrl+X, then Y, then Enter.
Confirm the file exists and has content:
# Check that CLAUDE.md exists and preview its contents
cat CLAUDE.md
You should see your file’s content printed in the terminal. If you see it, the file is saved and ready.
Step 5: Start a Claude Code Session
Now open Claude Code in your project folder. If you’re not already there, navigate to your project in the terminal first.
# Start Claude Code in your current project directory
claude
Claude Code — if you’re new to it, it’s Anthropic’s AI coding assistant that runs in your terminal and can read, write, and edit files in your project — will start a new session. One of the first things it does is scan for a CLAUDE.md file in your current directory and read it.
You won’t see a confirmation message that says “CLAUDE.md loaded.” It happens silently in the background.
Step 6: Test That Claude Is Reading Your CLAUDE.md
This is the most important step, and most guides skip it. You need to verify Claude is actually using your file.
Ask Claude a question that it can only answer correctly if it read your CLAUDE.md. Here are some good test prompts depending on what you put in your file:
If you specified your language/framework:
What language and framework is this project using?
If you specified a coding rule:
Should I use semicolons in this project?
If you specified your folder structure:
Where should I put a new utility function in this project?
Claude should answer with information that came directly from your CLAUDE.md — not generic answers. If you told it “no semicolons” and it answers “no, this project follows a no-semicolons style,” your CLAUDE.md is working.
💡 Pro Tip: If Claude gives a generic answer that doesn’t match your CLAUDE.md, check two things: (1) is the file named exactly
CLAUDE.mdin all caps? (2) are you runningclaudefrom inside the project folder, not from a parent directory?
Step 7: Create a Global CLAUDE.md (Optional but Recommended)
Your project CLAUDE.md only applies to that one project. But some preferences apply everywhere — your preferred explanation style, your general rules, personal habits you want Claude to respect in every project.
For those, create a global CLAUDE.md in your home directory:
# Navigate to your home directory
cd ~
# Create a global CLAUDE.md file
touch CLAUDE.md
Then open it and add preferences that should apply across all your Claude Code sessions:
# Global Claude Code Instructions
## My General Preferences
- Always explain what you're about to do before writing any code
- If you're unsure about something, ask me — don't guess
- Keep code comments concise but clear
- When suggesting multiple approaches, list the tradeoffs
## My Coding Defaults
- I prefer readable code over clever code
- Always include error handling — never write bare try/catch blocks
- Prefer explicit over implicit — I'd rather read more code than debug magic
Claude reads the global CLAUDE.md first, then your project-level CLAUDE.md on top of it. They stack together.
For the full breakdown of how these two levels work together, see CLAUDE.md Global vs Project-Level — What’s the Difference?.
What to Add Next
Your CLAUDE.md is working. Now make it more useful over time.
The most impactful things to add after your initial setup:
Architecture notes. A brief description of how your system is structured — what talks to what, where the important logic lives, what patterns you follow. This prevents Claude from suggesting architecturally wrong solutions. Learn more in How to Add Architecture Notes to CLAUDE.md.
More coding standards. Naming conventions, file organization rules, import ordering — the things that make code reviews predictable. See How to Structure Coding Standards in CLAUDE.md.
Off-limits files and folders. Any legacy code, auto-generated files, or vendor code that Claude should never touch. This protects you from accidental changes.
Business context. What the product does, who the users are, what matters most. This shapes Claude’s suggestions at a higher level than just syntax rules.
Common Mistakes When Creating Your First CLAUDE.md
Wrong filename capitalization. claude.md and Claude.md don’t work. It must be CLAUDE.md exactly.
Wrong location. The file needs to be in your project’s root folder — the same level as your package.json, requirements.txt, or main entry file. If it’s buried in a subfolder, Claude may not find it depending on where you run the claude command.
Running claude from the wrong directory. Claude Code reads the CLAUDE.md in whatever directory you’re in when you run claude. If you’re in /Users/yourname instead of /Users/yourname/projects/my-project, it won’t find your project’s CLAUDE.md.
Too vague to be useful. Writing “write good code” or “follow best practices” doesn’t help Claude. Be specific: “use 2-space indentation,” “name boolean variables with an is or has prefix,” “always handle the null case.”
Putting in too much at once and never finishing. It’s better to create a short, accurate CLAUDE.md today than to spend a week drafting the perfect one. Start small.
Key Takeaways
- Creating CLAUDE.md takes minutes** — it’s a plain text file you create with
touch CLAUDE.mdand open in any editor - The filename must be exact** —
CLAUDE.mdin all caps with a.mdextension, sitting in your project’s root folder - Test it immediately** — ask Claude a question only answerable from your file to confirm it’s being read
- You can have two** — a project-level CLAUDE.md for project-specific rules and a global one in
~/for personal preferences - Start simple and build up** — even 10 lines of real content is more useful than a detailed template you never fill in
Next Steps
- What to Put in Your CLAUDE.md (With Real Examples)** — the complete list of everything worth including, with real examples for each section
- CLAUDE.md Templates for Beginners — Copy and Use These** — grab a ready-made template matched to your project type
- CLAUDE.md Best Practices — Do’s and Don’ts** — avoid the mistakes that make CLAUDE.md less effective
Return to CLAUDE.md — The Complete Beginner’s Guide (2026) for the full picture.