Home / Compare / agents.md vs CLAUDE.md

agents.md vs CLAUDE.md — when to use each

Two file types that overlap. The honest answer: write agents.md as your default; let CLAUDE.md cover Claude-specific things only.

What each is for

The line: agents.md says "this repo wants X." CLAUDE.md says "and Claude Code in particular should also know Y."

Side-by-side

agents.mdCLAUDE.md
Read byCodex CLI, Cursor, Aider, Cline, Claude Code (fallback)Claude Code only
Loaded atTool startup / each promptSession start as project memory
Wins on conflictCLAUDE.md (Claude Code prefers it)
Typical length50–300 lines20–150 lines
Imports other files?NoYes (Claude Code 1.x supports imports)

The recommended pattern in 2026

repo-root/agents.md       # source of truth — every agent reads this
CLAUDE.md       # Claude-specific overrides + imports
.cursorrules    # one-line redirect to agents.md (or empty)

The CLAUDE.md is short — 10–30 lines — and starts with:

CLAUDE.mdSee [agents.md](./agents.md).

Claude Code-specific:
- Use the refactor-to-pure-functions skill when reworking imperative code.
- Don't create new docs (.md files) unless explicitly asked.
- Test command is npm test; long-running tests are gated behind RUN_LONG=1.

Everything Cursor and Codex CLI also need to know stays in agents.md.

What goes in CLAUDE.md only

Anti-patterns

Browse MDs

Last updated: 2026-04-25.