Context
Coding agents work faster and break less when the repo tells them how to build, test, and what not to touch. AGENTS.md is the open format for that, read by most coding agents; the AGENTS.md nearest to the edited file wins, and the user's chat instructions override it.
Repo: [REPO PATH OR URL] Stack: [MAIN LANGUAGES AND FRAMEWORKS] What agents keep getting wrong here: [KNOWN FAILURES, or "unknown"]
Steps
- Read before writing: package manifests, CI workflows, Makefile or scripts, README, CONTRIBUTING, lint and format configs. Run every build, test, and lint command you find from a clean clone and note which work, how long each takes, and which need env vars, network access, or a write flag.
- Write a root AGENTS.md under 150 lines with: Project overview (3-5 lines), Setup, Commands (exact and copy-pasteable, with expected runtime, including how to run one test), Code style (only rules tooling does not enforce), Testing rules, Security (secrets, generated files, paths never to edit), PR and commit conventions.
- In a monorepo, add a nested AGENTS.md per package whose commands or rules differ, containing only the differences.
- Prefer commands to prose: "run
pnpm test -- path/to/file" beats "make sure tests pass". - End with a "Before you say done" checklist of the exact checks an agent must run.
- If other agent-specific instruction files exist, make AGENTS.md the single source of truth and point the others to it instead of duplicating rules.
- Verify: start a fresh agent session, give it two small real tasks (fix a lint warning, add one test), and note where it guessed or asked. Fix the file there and repeat once. Done when the fresh agent finishes both tasks and the checklist without guessing a command or path.
Output
- The AGENTS.md file(s) as a diff.
- A table: command | works (yes/no) | runtime.
- Commands from existing docs that failed, and what you changed.
- Three follow-ups that would make the repo easier for agents (for example one
checkscript, a faster test subset).
Never put secrets, tokens, or internal URLs in AGENTS.md; it is committed and read by tools.