.claude/at the project root (per-repo, team config)~/.claude/in your home directory (global, personal config)
There is also a separate file ~/.claude.json (not a directory) that Claude Code writes to for app state and OAuth tokens. Think of it like .git/ vs .gitconfig: one is a per-project directory, one is global.
Note: There is no .claude-code directory, Claude Code uses .claude/.
This is the folder you commit to git so your team gets the same rules, commands, and permissions. A full-featured layout looks like this:
my-project/
├── CLAUDE.md # Instructions loaded every session (project root, not inside .claude/)
├── CLAUDE.local.md # Your private notes for this project (add to .gitignore)
├── .mcp.json # Team-shared MCP server definitions (repo root)
├── .worktreeinclude # Gitignored files to copy into new git worktrees
├── .claudeignore # Paths Claude should never read
└── .claude/
├── settings.json # Permissions, hooks, env vars, model defaults
├── settings.local.json # Personal overrides, auto-gitignored
├── rules/
│ ├── testing.md # Topic-scoped instructions (can be path-gated)
│ └── security.md
├── skills/
│ └── code-review/
│ ├── SKILL.md # Reusable workflow, auto-invoked when relevant
│ └── reference.md # Supporting docs the skill reads on demand
├── commands/
│ └── deploy.md # Single-file slash command (/deploy)
├── agents/
│ └── security-auditor.md # Subagent with its own prompt and tool allowlist
├── agent-memory/
│ └── security-auditor/ # Persistent memory for that subagent
├── output-styles/
│ └── terse.md # Custom system-prompt sections
└── docs/ # Unofficial but common: reference docs skills read on demand
└── architecture.md
A few things worth knowing about loading behavior, because this trips people up:
CLAUDE.mdsits at the repo root, not inside.claude/. It loads every session. Claude walks from your current working directory up to the root, so nestedCLAUDE.mdfiles in subdirectories also apply, with deeper files taking priority.rules/*.mdloads automatically too, so keep them short and topical. Heavy reference material belongs inskills/ordocs/where it only loads when needed. The analogy here is eager vs lazy imports: rules are eager, skills are lazy.settings.local.jsongets added to.gitignoreautomatically when Claude writes to it. Safe place to put personal permission overrides.commands/andskills/are converging. A file at.claude/commands/deploy.mdand.claude/skills/deploy/SKILL.mdboth create/deploy. Skills are the newer form and support a folder with extra files plus frontmatter.
This is your personal setup, shared across every project on this machine. You do not commit this anywhere.
~/.claude/
├── CLAUDE.md # Your global instructions (loaded every session, everywhere)
├── settings.json # Your global permissions, hooks, model defaults
├── settings.local.json # Machine-local overrides
├── rules/ # Global topic-scoped rules
├── skills/ # Skills available across all projects
│ └── my-personal-skill/
│ └── SKILL.md
├── commands/ # Personal slash commands
├── agents/ # Personal subagents
├── agent-memory/ # Persistent memory for personal subagents
├── output-styles/
├── keybindings.json # Custom keyboard shortcuts
│
│ # Data Claude writes during sessions (not config you author):
├── projects/
│ └── <project-hash>/
│ ├── <session>.jsonl # Full session transcripts (plaintext, not encrypted)
│ └── memory/ # Auto-memory: Claude's notes to itself across sessions
├── history.jsonl # Your prompt history across all sessions
├── todos/ # Task lists per session
├── plans/ # Plan-mode markdown documents
├── file-history/ # File checkpoints for undo/rollback
├── shell-snapshots/ # Shell environment snapshots (cleared on clean exit)
├── session-env/ # Per-session environment variables
├── stats-cache.json # Aggregated usage statistics
└── debug/ # Debug logs per session
The config files mirror the project layout so muscle memory transfers. The session data directories (projects/, history.jsonl, todos/, file-history/, etc.) are machine-written, not hand-edited. Files in most of them get cleaned up automatically once older than cleanupPeriodDays (default 30).
Security note: Transcripts in
projects/<project>/<session>.jsonlare plaintext. If a tool reads a.envor a command prints a credential, that value lands on disk. LowercleanupPeriodDaysinsettings.jsonor setCLAUDE_CODE_SKIP_PROMPT_HISTORY=1to reduce exposure.
You can also redirect everything with the CLAUDE_CONFIG_DIR environment variable. Every ~/.claude/ path above will live under that directory instead. Useful if you want XDG-style placement under ~/.config/claude/.
# Project Name
Short description of what this project does and who uses it.
## Stack
- Language: Python 3.12
- Framework: Flask
- Database: SQLite (dev), PostgreSQL (prod)
## Conventions
- Prefer standard library over third-party deps
- Use pytest for tests, files in tests/ mirror src/
- No heavy frameworks; keep it simple
## Commands
- `make dev` - start dev server on :5000
- `make test` - run pytest
- `make lint` - ruff checkWith the $schema line for editor autocomplete:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(make *)",
"Bash(pytest *)",
"Bash(git status)",
"Bash(git diff *)",
"Bash(git log *)",
"Read(**)",
"Edit(src/**)",
"Edit(tests/**)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(sudo *)",
"Bash(curl * | sh)",
"Read(.env)",
"Read(**/*secret*)"
]
},
"model": "claude-opus-4-7"
}Anything not in allow or deny will prompt you for confirmation, which is the intentional middle ground.
At .claude/commands/review.md:
---
description: Review the current branch diff before merging
---
## Changes
!`git diff --name-only main...HEAD`
## Full diff
!`git diff main...HEAD`
Review for code quality, security issues, missing tests, and performance.
Give specific feedback per file.That becomes /review in your session, with the actual git diff injected via the !`backtick` shell-execution syntax.
Once you are in a session, you can see what actually loaded:
| Command | Description |
|---|---|
/context |
Token usage across system prompt, memory, skills, MCP tools |
/memory |
Which CLAUDE.md and rules files are loaded |
/skills |
Available skills from project, user, and plugin sources |
/permissions |
Current allow/deny rules |
/mcp |
Connected MCP servers |
/hooks |
Active hook configurations |
/agents |
Configured subagents |
/doctor |
Installation and configuration diagnostics |
Start with /context when something feels off, then drill into the specific subsystem.
Add these to .gitignore at the project level:
.claude/settings.local.json
CLAUDE.local.md
Commit everything else in .claude/. That way your team gets consistent rules, permissions, skills, and commands, while personal overrides stay on your machine.
Official reference: https://code.claude.com/docs/en/claude-directory