Blog

AGENTS.md vs CLAUDE.md: what belongs in your context file?

AGENTS.md vs CLAUDE.md: what belongs in your context file?

Keep one short set of repository instructions. Use AGENTS.md for shared rules when your team works across coding agents. If your Claude Code setup needs a CLAUDE.md, have it import the shared file. Include build and test commands, hard constraints, and project details an agent cannot infer by reading the code.

Which file does each agent read?

Codex reads AGENTS.md and can find instructions deeper in the directory tree when a change touches that area. Claude Code’s current instructions guide describes when Claude reads AGENTS.md directly and when a CLAUDE.md takes precedence. For teams with both files, a root CLAUDE.md can load the shared file with @AGENTS.md. Check the instructions loaded by a fresh session before standardizing on a setup.

What should the file say?

Write down the exact command that runs the relevant checks, especially when the project has multiple packages or test runners. Call out generated files and the command that updates them. Document boundaries a reviewer would enforce, such as which migration paths need approval or which fixtures can be edited.

Move instructions that apply only to one directory into that directory. Put repeatable procedures in a skill and formatting rules in the linter. Keep the file focused on facts that change what an agent does.

How can you tell if it helps?

Try a representative task in two fresh sessions and compare the evidence. Did the agent run the right checks? Did it edit the correct source files? How much work did the reviewer need to do? In Alex’s video and accompanying newsletter issue, he walks through research on context files and tries the comparison on a real project.

For a team rollout, try the 30-day coding-agent pilot or see team training.

Watch the videos

Stop using AGENTS.md and CLAUDE.md (do this instead)

Alexander Galea reviews research on repository instructions and compares Claude Code runs with and without a CLAUDE.md file.

Watch on YouTube

Common questions

Should we keep both files?
Keep one source for the shared instructions. If your team's Claude Code setup requires CLAUDE.md, make it import AGENTS.md, then open a fresh session and verify Claude loaded it.
How long should the file be?
Use as few lines as it takes to give the agent commands and constraints it cannot infer. Each new line should address a problem you can point to in a real task.

ZazenCodes

Agentic Coding Club

Now live onSkool
  • Weekly LIVE build sessions — 30 min building, 30 min Q&A
  • Free to join, full course library with Premium
Join Free

Comments (0)

No comments yet.