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 described in Cursor's docs as legacy, so new projects should skip it.
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.
@AGENTS.md
## Claude Code
- Use plan mode before changing anything under `src/billing/`.
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.
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
Instruction-file templates for 12 stacks and 12 prompts that write and audit them. 34-page PDF, $14.
Not ready to buy? Start with the free PDF.
Get 10 of our most-used prompts as a free PDF from Gumroad. You will be asked for your email so Gumroad can deliver it.