An AI coding agent can only work safely with the context it receives. A good AGENTS.md gives that context once, close to the code, so every task starts with the same commands, boundaries, and definition of done.
This guide shows a practical structure you can use with Codex, Claude Code, Cursor, GitHub Copilot, and other repository-aware coding agents.
What an AGENTS.md file should do
An AGENTS.md is not a long prompt or generic advice. It should answer the questions an experienced contributor would ask before editing:
What does this repository contain?






