You’ve learned that CLAUDE.md gives Claude Code persistent instructions. But then you discover there are actually two kinds — a global one and a project-level one. Now you’re not sure which to use, where to put it, or whether you need both.
This article clears that up completely.
📋 TL;DR
– A project-level CLAUDE.md lives in your project folder and applies only to that project
– A global CLAUDE.md lives in your home directory and applies to every Claude Code session
– Both files are read together — global rules load first, project rules layer on top
– Use global for personal habits and preferences; use project-level for project-specific rules
– When they conflict, project-level instructions take priority
This is part of our complete CLAUDE.md — The Complete Beginner’s Guide (2026). If you haven’t created either file yet, start with How to Create Your First CLAUDE.md File.
The Simple Analogy
Imagine you’re a developer who always works with a certain style — you like your code commented a certain way, you always want explanations before changes, you have personal rules you follow on every project. Those are your habits. They go with you everywhere.
But then you join a client’s project. That project has its own rules — its own tech stack, its own folder structure, its own naming conventions. Those rules apply to that project, not to you personally.
Your personal habits = global CLAUDE.md
The client’s project rules = project-level CLAUDE.md
Both exist at the same time, and both matter.
What is the Project-Level CLAUDE.md?
The project-level CLAUDE.md is a file you place in the root folder of a specific codebase. It contains everything Claude needs to know about that particular project.
Where it lives:
/Users/yourname/projects/my-ecommerce-site/
├── CLAUDE.md ← This is the project-level CLAUDE.md
├── package.json
├── src/
└── ...
What belongs here:
- The tech stack this project uses (language, framework, database)
- This project’s folder structure
- This project’s coding standards and style rules
- Commands to run tests, start the dev server, build the project
- Architecture decisions specific to this codebase
- Files or folders Claude should never touch in this project
Every project you work on should have its own project-level CLAUDE.md. They’re independent of each other — your Next.js project’s CLAUDE.md has nothing to do with your Python project’s CLAUDE.md.
What is the Global CLAUDE.md?
The global CLAUDE.md is a single file that lives in your home directory — the folder that represents your user account on your computer. Whatever you put in here applies to every Claude Code session you run, across all projects.
Where it lives:
On Mac and Linux:
# Your global CLAUDE.md lives here
~/.CLAUDE.md
# Which is the same as
/Users/yourname/CLAUDE.md
On Windows:
C:\Users\yourname\CLAUDE.md
What belongs here:
- How you like Claude to communicate (explain before acting, ask when unsure)
- General coding preferences that apply in any language or project
- Personal rules that override defaults everywhere
- Your preferred comment style and documentation habits
The global CLAUDE.md is optional — you don’t have to have one. But if you find yourself wishing Claude behaved the same way across all your projects, that’s the signal to create one.
How They Work Together
When you start a Claude Code session inside a project folder, here’s what happens behind the scenes:
- Claude looks for a global CLAUDE.md in your home directory and reads it
- Claude looks for a project-level CLAUDE.md in your current directory and reads it
- Both sets of instructions are combined and held in context for the session
Think of it as layering. The global rules form the base layer, and the project rules sit on top. Where they don’t overlap, both sets apply. Where they conflict, the project-level file wins.
Example of layering in action:
Global CLAUDE.md says:
- Always explain what you're going to do before writing code
- Use 2-space indentation
Project-level CLAUDE.md says:
- Use 4-space indentation (this project's style guide requires it)
- We're using TypeScript with strict mode
Result: Claude will explain before acting (from global), will use 4-space indentation (project overrides global), and will write TypeScript in strict mode (from project).
💡 Pro Tip: Use this layering intentionally. Keep your global CLAUDE.md focused on communication style and meta-preferences (how Claude should behave), and use project-level files for technical specifics (what Claude should build and how). They’re designed for different kinds of information.
Creating Your Global CLAUDE.md
If you don’t have one yet, here’s how to create it:
# Navigate to your home directory
cd ~
# Confirm you're in the right place (should show your home path)
pwd
# Create the global CLAUDE.md
touch CLAUDE.md
# Open it in VS Code to edit
code CLAUDE.md
Here’s a solid starting template for a global CLAUDE.md:
# My Global Claude Code Instructions
## How I Like Claude to Work
- Always tell me what you plan to do before writing or editing code
- If a task is ambiguous, ask a clarifying question — don't assume
- When there are multiple valid approaches, briefly describe the options and recommend one
- Don't make changes outside the scope of what I asked
## My General Coding Preferences
- I value readable code over clever code
- Always include error handling — never silently swallow errors
- Write descriptive variable names — avoid single-letter names except in loops
- Comments should explain *why*, not *what* — the code already shows what
## Communication Style
- Keep responses concise — I don't need long preambles
- Use bullet points for lists of steps or options
- If you're uncertain about something, say so rather than guessing
Creating Your Project-Level CLAUDE.md
For each project, navigate into that project’s root folder and create the file there:
# Navigate to your specific project
cd /Users/yourname/projects/my-project
# Create the project-level CLAUDE.md
touch CLAUDE.md
# Open it to edit
code CLAUDE.md
Here’s a real project-level example for a Python project:
# Project Instructions — Data Pipeline Tool
## What This Project Does
This is an internal ETL pipeline that pulls data from our Shopify store,
transforms it, and loads it into a PostgreSQL data warehouse for reporting.
## Tech Stack
- Language: Python 3.11
- Task scheduler: Apache Airflow
- Database: PostgreSQL (via psycopg2 and SQLAlchemy)
- Testing: pytest
- Linting: ruff + black
## Coding Standards
- All functions must have type hints
- Use dataclasses or Pydantic models for structured data — no plain dicts
- Every DAG must have a docstring explaining its purpose and schedule
- No hardcoded credentials — everything via environment variables
## Folder Structure
- `/dags` — Airflow DAG definitions
- `/transforms` — data transformation logic
- `/loaders` — database write functions
- `/tests` — pytest test files (mirror the main structure)
- `/config` — configuration files (non-sensitive)
## Commands
- Run tests: `pytest tests/`
- Lint: `ruff check . && black --check .`
- Start Airflow locally: `airflow standalone`
## Important Constraints
- Never modify files in `/archive` — these are historical reference only
- Always ask before adding new Python packages — update `requirements.txt` manually
Which One Should You Set Up First?
If you’re just getting started, set up the project-level CLAUDE.md first.
Here’s why: the project-level file gives Claude the technical context it needs to actually help you right now. What language are you using? Where do files go? What are the rules? That’s the highest-value information for getting better results immediately.
The global CLAUDE.md is more of a refinement — it shapes how Claude behaves generally, which you can dial in over time as you notice preferences you want to apply everywhere.
⚠️ Warning: Don’t copy your project-level CLAUDE.md into your global file. The global file is for preferences that genuinely apply everywhere. Putting project-specific paths or tech stack details in your global CLAUDE.md will confuse Claude in unrelated projects — it might try to find
/src/componentsin a Python project that has no such folder.
Quick Reference: What Goes Where
| Content Type | Global | Project-Level |
|---|---|---|
| Communication preferences | ✅ | ❌ |
| General coding philosophy | ✅ | ❌ |
| Tech stack details | ❌ | ✅ |
| Folder structure | ❌ | ✅ |
| Project-specific rules | ❌ | ✅ |
| Terminal commands | ❌ | ✅ |
| Architecture decisions | ❌ | ✅ |
| Off-limits files | ❌ | ✅ |
| Language-agnostic style preferences | ✅ | ❌ |
Common Mistakes
Putting project details in the global file. Your Python project’s import conventions don’t belong in a file that also applies to your JavaScript projects. Keep project-specific content in project files.
Creating a global CLAUDE.md in the wrong location. It must be in your actual home directory, not your Desktop or Documents folder. Run cd ~ and pwd to confirm where your home directory is.
Thinking they conflict when they stack. The most common misconception is that having both files causes a conflict. They don’t conflict — they layer. Both apply, with project rules taking priority when the same topic appears in both.
Neglecting the global file entirely. If you use Claude Code across multiple projects, a well-crafted global CLAUDE.md pays dividends across everything you do. It’s worth the 15 minutes it takes to write.
Key Takeaways
- Project-level CLAUDE.md** lives in your project folder and contains everything specific to that codebase — tech stack, folder structure, commands, and coding rules
- Global CLAUDE.md** lives in your home directory and applies to every Claude Code session — use it for communication preferences and general coding philosophy
- They stack, not conflict** — global rules form the base, project rules layer on top, and project rules win when both cover the same topic
- Start with project-level** for immediate value, then add a global file as you identify cross-project preferences
- Don’t mix content types** — project-specific details in the global file will cause confusion in unrelated projects
Next Steps
- What to Put in Your CLAUDE.md (With Real Examples)** — now that you know where to put things, learn exactly what to include
- How Claude Code Uses CLAUDE.md During a Session** — understand exactly when and how Claude reads your files
- CLAUDE.md Best Practices — Do’s and Don’ts** — avoid the most common setup mistakes
Return to CLAUDE.md — The Complete Beginner’s Guide (2026) for the full picture.