4.2GuidePart of Build a website with AI coding agents: the practical guide
AGENTS.md vs CLAUDE.md: what each does and how to use both
AGENTS.md works in many coding agents. CLAUDE.md is Claude Code's own file. Here is which tool reads which, and the one-line setup for using both.

On this page8 sections
Coding agents need instructions that your code cannot provide: which commands to run, which folders to avoid and how to check their work. AGENTS.md is the shared Markdown file used by many coding agents; CLAUDE.md is Claude Code’s own instruction file. Start with AGENTS.md. If you need Claude-specific rules, add CLAUDE.md and import the shared file with @AGENTS.md.
What are AGENTS.md and CLAUDE.md?
Both are plain text files, written in Markdown, the same format as a README. You keep them in your project, usually in the top folder. There is nothing to install. A coding agent is a tool that reads and edits your code, and it reads this file when it starts work, so you don’t have to repeat yourself in every chat.
AGENTS.mdis an open format that many tools share. It has no required fields. The agents.md site says over 60,000 projects use it.CLAUDE.mdis the file Claude Code looks for. It does the same job, for one tool.
So what goes in one? The things a new teammate would have to ask you: the commands that build and test the project, the few paths an agent would get wrong, the rules that are easy to break, and how to check that the work is done. Our rule: if the agent can learn it from the code, it does not go in the file.
The file is a note, not a lock. The Claude Code docs call these files context, not enforced configuration. The more specific your instructions are, the more reliably they get followed.
Do you need both?
A project ends up with two files for two reasons. Different tools look for different file names, and one project may use more than one tool. And Claude Code has features of its own, such as .claude/rules/ files that apply only to certain paths, so you may have instructions that only make sense for Claude.
So do you need both? Usually not. One AGENTS.md is enough until you have a rule only Claude Code should see. When you do, add a CLAUDE.md that imports the shared file, so your rules still live in one place.
AGENTS.md
Your shared rules: commands, folders, how to check the work
Read it directly
No CLAUDE.md: reads it directly
CLAUDE.md exists: reads it through the import
CLAUDE.md exists.Which tools read which file
We checked each tool’s docs on November 3, 2026. Tools change this often, so each name links to the page we read.
| Tool | Reads by default |
|---|---|
| Claude Code | CLAUDE.md, or AGENTS.md if there is no CLAUDE.md |
| OpenAI Codex | AGENTS.md |
| Cursor | AGENTS.md, plus its own rules folder |
| Copilot on GitHub | AGENTS.md, plus its own instruction files |
| Copilot in VS Code | AGENTS.md, plus its own instruction files |
A few notes:
- Gemini tools. Gemini CLI reads
GEMINI.md, and reads AGENTS.md only if you add it to itscontext.fileNamesetting. Antigravity reads AGENTS.md or GEMINI.md. - CLAUDE.md in other tools. Codex reads it only if you add it to
project_doc_fallback_filenames. Copilot on GitHub accepts one root CLAUDE.md as an alternative to AGENTS.md. VS Code has achat.useClaudeMdFilesetting. - Subfolders. Codex and Cursor also read AGENTS.md files in subfolders. VS Code ignores them unless you turn on
chat.useNestedAgentsMdFiles.
Does Claude Code read AGENTS.md?
Yes, from v2.1.277, published September 18, 2026. Many guides still say Claude Code ignores AGENTS.md. Those guides are out of date, so check the date on any page you follow, ours included.
There is one condition. Claude Code makes this check when it starts:
Does the project have a CLAUDE.md or CLAUDE.local.md in this folder or above?
Yes
Reads the CLAUDE.md files only
AGENTS.md loads only if one of them imports it
No
Reads AGENTS.md
No extra file or setting needed
A .claude/CLAUDE.md counts as well. Your personal ~/.claude/CLAUDE.md and your .claude/rules/ files don’t count, and they load alongside AGENTS.md.
To load both files every time, run /config and set Project instructions to claude-md-and-agents-md.
How to set up both files
- Create
AGENTS.mdin the project root and add your shared rules. - Create
CLAUDE.mdnext to it. Make@AGENTS.mdits first line. - Add your Claude-only rules below that line.
- Start Claude Code and run
/context all. Check thatCLAUDE.mdappears under Memory files.
AGENTS.mdEvery agent
## Commands pnpm test # run before every commit ## Rules Do not edit files in dist/.
CLAUDE.mdClaude Code only
@AGENTS.md
## Claude Code Use plan mode for changes in packages/.
AGENTS.md first, then the rest of CLAUDE.md. Codex, by default, sees only AGENTS.md.The @ line is an import: it loads that file into the session, as if you had pasted it there. If you later switch to claude-md-and-agents-md, you can keep the import. Claude Code skips an AGENTS.md it has already loaded, so it never reads the file twice.
A real AGENTS.md example
Vesper is our free personal blog and portfolio theme, and it ships with an AGENTS.md. The commands come first. Here are five of the 13:
pnpm install
pnpm dev # dev server at http://localhost:4321 (Markdown source)
pnpm build # Markdown: a static site in dist/ (then Pagefind indexes it)
pnpm preview # serve the build (site search works here, not in dev)
pnpm test:units # the theme's unit tests
The comments matter as much as the commands. An agent can’t learn “site search works here, not in dev” from the code. Without that comment, it could test search in the dev server and report a bug that isn’t there.
Next come notes on the few paths an agent would get wrong, and then the rules. Here are two of the rules:
- Style with the design tokens (`--ui-*` and the theme's `--v-*` variables) and token-based classes. Do not hard-code colors, and do not use Tailwind's `dark:` variant: dark mode swaps the token values.
- Pages read content only through `src/content/`. Never import EmDash in pages or components, so the Markdown build keeps working.
Each is a rule an agent would break without being told. An agent that has seen dark: used across the web will reach for it here too.
The file ends by telling the agent how to prove it’s done:
## Check your work
1. `pnpm check`, `pnpm test:units` and `pnpm build` pass.
2. After content or model changes: `pnpm test:adapter` and `pnpm test:parity`.
3. After look or color changes: `pnpm test:skins`.
4. Open the changed pages in `pnpm dev` in light and dark mode, at phone width, and with reduced motion on.
The full file comes with the free Vesper download.
Common mistakes
A stray CLAUDE.local.md turns AGENTS.md off. You make it for a few personal notes, and Claude Code counts it as a CLAUDE.md. Your shared rules drop out of the session. Add a real CLAUDE.md that holds @AGENTS.md, or set Project instructions to claude-md-and-agents-md.
Pasting the same rules into both files. Two copies drift apart. Someone fixes the build command in one file, and an agent reading the other keeps running the old command. Keep one copy and import it.
Pointing to AGENTS.md in words. A CLAUDE.md that says “Read AGENTS.md before you start” works only if Claude decides to open the file. @AGENTS.md loads it every session.
Using a symlink when teammates are on Windows. ln -s AGENTS.md CLAUDE.md works if you have no Claude-only rules. But on Windows, Git checks a committed symlink out as a plain text file unless core.symlinks is on, and that clone gets a one-line CLAUDE.md instead of your rules. Use the import.
Letting the file grow too long. The Claude Code docs suggest keeping each CLAUDE.md short, and Codex stops adding files at 32 KiB. Imports don’t save space: an imported file loads in full.
Which file should you use?
Pick AGENTS.md as your main file if more than one agent touches the project, or if you publish code that other people open in their own tools. That is why our themes ship one.
Add a CLAUDE.md with @AGENTS.md if you use Claude Code and want Claude-only rules, or if you keep a CLAUDE.local.md.
Use CLAUDE.md alone only if Claude Code is the only agent anyone will run on the project.


