AGENTS.md vs CLAUDE.md vs Cursor Rules: Which Do You Need?
If you use an AI coding agent, you have probably been told to "write a rules file". Then you looked and found four or five different file names. This guide explains what each one is, which tools read it, and the smallest setup that works for most people. Everything here was checked against each tool's own documentation on 2026-10-16, but these tools change fast, so use the links at the end to confirm.
The one idea behind all of them
A coding agent starts every session knowing nothing about your project. An instruction file is the short note you would give a new teammate: how to run things, how the code is organized, what to avoid. The files differ only in which tool reads them and how precisely you can scope them.
The files
| File | What it is | Who reads it |
|---|---|---|
AGENTS.md |
Plain Markdown, no required fields. Can also live in subfolders; the closest file to the one being edited wins. | Cursor, GitHub Copilot, OpenAI Codex, Zed, Warp, Windsurf and many others. Gemini CLI and Aider need a one-line setting. |
CLAUDE.md |
Markdown instructions for Claude Code. Project, personal (~/.claude/CLAUDE.md) and private (CLAUDE.local.md) versions. |
Claude Code |
.claude/rules/*.md |
Topic files. With a paths: list in the frontmatter they load only when matching files are in play. |
Claude Code |
.cursor/rules/*.mdc |
Cursor project rules with description, globs and alwaysApply frontmatter. A plain .md file there is ignored. |
Cursor |
.github/copilot-instructions.md |
Repository-wide Copilot instructions. Path-specific files go in .github/instructions/ and use an applyTo glob. |
GitHub Copilot |
The old single-file .cursorrules is not described on Cursor's current rules page, so new projects should skip it (see Cursor rules not working? and how to migrate .cursorrules to .mdc).
A setup that works for most people
- Write one
AGENTS.mdat the repository root. Put commands, layout, conventions and boundaries in it. - If you use Claude Code, add a
CLAUDE.mdwhose first line is@AGENTS.md. That is Claude Code's import syntax, and it means you maintain the shared rules in one place. Anthropic's docs currently say Claude Code readsAGENTS.mdby itself only when there is noCLAUDE.mdin the working directory or above, which is why the bridge file is the safe choice. - Move area-specific rules into scoped files instead of growing the root file: a Cursor
.mdcrule withglobs, a Claude.claude/rules/file withpaths, or a Copilot.instructions.mdfile withapplyTo. (Moving Cursor rules to Claude? .claude/rules examples has a free script that converts.mdcfiles.)
@AGENTS.md
## Claude Code
- Use plan mode before changing anything under `src/billing/`.
Keep AGENTS.md as one source of truth
Once you have more than one tool reading project rules, duplication gets expensive. A practical pattern:
- Put the real rules in root
AGENTS.md(commands, layout, boundaries, PR discipline). - Generate or hand-write thin wrappers for tools that want their own filename: a
CLAUDE.mdwhose first line is@AGENTS.md, a short Copilotcopilot-instructions.mdthat points reviewers at the same norms, or scoped Cursor.mdcfiles for path-specific extras only. - When a rule changes, edit
AGENTS.mdonce. Re-copy or re-generate wrappers if they hold more than a pointer.
If you want help keeping those wrappers in sync in CI, one free MIT option is agentscribe on PyPI (syncs AGENTS.md toward Claude/Cursor/Copilot/Gemini/Windsurf/Cline-oriented files and can lint in CI). We are not affiliated with it; treat it as an example of the pattern, not a requirement. Our free AGENTS.md generator still helps you draft the root file in the browser.
How long should the file be?
Shorter is better. Anthropic suggests keeping each CLAUDE.md under 200 lines, and Cursor suggests rules under 500 lines. A good target for the root file is 60 to 120 lines. Longer files use up context and make it more likely that a rule gets ignored.
Instruction files are guidance, not enforcement
An agent can still ignore a line. Claude Code's docs say plainly that it treats these files as context rather than enforced configuration. If something must never happen, such as touching production data, back the instruction with a permission setting, a hook or a git check.
Next steps
- Build a first file in a minute with the free AGENTS.md generator. It runs in your browser and sends nothing anywhere.
- Read how to write an AGENTS.md that agents follow for what to put in each section.
- For ready-made files for twelve stacks, scoped rules for Claude, Cursor and Copilot, and prompts that audit your setup, see the AI Coding Agent Config Kit below.
Want ready-made files? See our copy-paste AGENTS.md examples, CLAUDE.md examples and Cursor rules examples.
Sources: agents.md, Claude Code memory docs, Cursor rules docs, GitHub Copilot repository instructions. AgentKit Co is not affiliated with these companies. This guide was written with AI assistance and checked against those pages.
AI Coding Agent Config Kit · $14
Instruction-file templates for 12 stacks and 12 prompts that write and audit them.
34-page PDF, $14.
Not ready to buy? Get our free Agent Skills pack on Gumroad (pay what you want, $0 is fine; Gumroad asks for your email to deliver it). Get the free skills