Anthropic · Terminal CLI · VS Code & JetBrains extensions · Desktop app · Web
Claude Code rules files explained
Which instruction files Claude Code reads (CLAUDE.md, .claude/rules/*.md), where to put them, and how to convert from other agents.
Files Claude reads
CLAUDE.md.claude/rules/*.md
AGENTS.md: Only when no CLAUDE.md / CLAUDE.local.md exists (default, v2.1.277+); or import it with @AGENTS.md.
Skills folders: .claude/skills/, ~/.claude/skills/
Who reads what
| Agent | Rules files | AGENTS.md |
|---|---|---|
| Claude | CLAUDE.md, .claude/rules/*.md | Only when no CLAUDE.md / CLAUDE.local.md exists (default, v2.1.277+); or import it with @AGENTS.md |
| Codex | AGENTS.md, AGENTS.override.md | Yes: global ~/.codex/AGENTS.md plus one AGENTS.md (or AGENTS.override.md) per directory from the repo root down |
| Cursor | .cursor/rules/*.mdc, AGENTS.md, .cursorrules (legacy) | Yes, in the project root and in subdirectories (nested files combine) |
| Copilot | .github/copilot-instructions.md, .github/instructions/*.instructions.md, AGENTS.md | Yes on most surfaces (cloud agent, CLI, VS Code chat, code review); not Copilot Chat on GitHub.com |
| Antigravity | AGENTS.md, GEMINI.md, .agents/rules/*.md | Yes: AGENTS.md or GEMINI.md at any directory level, always on |
How Claude Code loads CLAUDE.md
Claude Code loads CLAUDE.md and CLAUDE.local.md from your working directory and every directory above it at launch. Files are concatenated, not overridden, ordered from the filesystem root down, so a repo-root file appears before a subfolder file. CLAUDE.md files in subdirectories below where you started load on demand, the first time Claude reads, writes or edits a file in that subdirectory.
Anthropic recommends keeping each CLAUDE.md under 200 lines, because longer files use more context and reduce adherence. Instructions that matter only for part of the codebase can go in .claude/rules/ as path-scoped rules, which load only when Claude works with matching files. Contradicting instructions are a known failure: the docs warn Claude may pick one arbitrarily.
Personal, uncommitted preferences go in CLAUDE.local.md at the project root; add it to .gitignore. A CLAUDE.md can pull in other files with @path/to/file imports, and the first time a project imports a file outside the working directory, Claude Code shows an approval dialog. Run /init to generate a starting CLAUDE.md from your codebase, or to get suggested improvements if one exists. In monorepos, claudeMdExcludes skips other teams' files.
Source: code.claude.com · Checked Oct 24, 2026
Guides, pricing & comparisons
Portable agent skills: one SKILL.md for every coding agent
Safe “always allow” rules for Claude Code and Codex CLI
How to install Claude Code on macOS, Linux and Windows
Claude Code auto mode: what runs, what gets blocked, how to turn it off
Agent Skills moves to the Agentic AI Foundation: what changes
MCP security: the risks in MCP servers and how to lock them down
Claude Code in VS Code: install, shortcuts and CLI differences
Claude Code on Windows: native, WSL and common errors
MCP OAuth: connect a remote MCP server in Claude Code, Codex and Cursor
Claude Code tips from Anthropic’s best practices
Claude Code with OpenRouter: setup, models and troubleshooting
Claude Code in JetBrains IDEs: install, connect and fix issues
Claude Code subagents: create, configure and run them
Fix spawn npx ENOENT when starting an MCP server
CLAUDE.md examples: instructions your team can actually use
MCP connection closed: find why a server will not connect
Claude Fable 5.2: model choice, CursorBench and Pro week
MCP token usage: output limits and context cost
MCP Apps: add interactive UI to an MCP server for Claude and Cursor
Claude Code vs OpenAI Codex: documented features compared
Cursor vs Claude Code: documented features compared
Claude Code vs GitHub Copilot: documented features compared
Google Antigravity vs Claude Code: documented features compared
Claude Code pricing and usage limits
AGENTS.md vs CLAUDE.md vs Cursor rules
AGENTS.md templates for Laravel and Next.js
MCP servers that work in every coding agent