What belongs in the file
Facts an agent cannot infer by reading the repository: which package manager, the exact test command, which folders are generated, which API cannot change shape. Everything else it can see for itself.
The file a coding agent reads when it opens your repository. Answer what it cannot work out on its own - the package manager, the test command, what it must not touch - and take the file in whichever format your tool expects.
Everything here ends up in the file. Leave a field empty to leave the line out.
The exact line you would type, not a description of it.
A rule worth writing is one that has already gone wrong.
Save as AGENTS.md (repository root). Read by most coding agents, including Claude Code and Cursor. Write this one first.
Facts an agent cannot infer by reading the repository: which package manager, the exact test command, which folders are generated, which API cannot change shape. Everything else it can see for itself.
“Write clean code”, “follow best practices”, “use meaningful names”. They cost context and change nothing - no agent was about to write deliberately bad code. A rule worth writing is one that has already gone wrong.
This file is read on every session, so every line is paid for repeatedly - the token count under the file is the recurring cost. Two hundred useful lines beat a thousand hedged ones, and a rule that stops being true should be deleted rather than left to mislead.