Generator / Guides / AGENTS.md best practices
AGENTS.md best practices
A good AGENTS.md is short, concrete and kept up to date. These nine rules come from the documentation of the tools that read the file.
1. Lead with commands
List how to install, run, build, test and lint the project exactly as you would type them.
2. Write verifiable instructions
"Run npm test before committing" can be checked. "Test your changes" cannot.
3. Stay under 200 lines
Longer files use more context and reduce adherence. Move area specific rules into nested files.
4. Remove contradictions
When two instructions conflict, an agent may pick either. Review the file whenever the project changes.
5. Do not repeat the code
Skip anything the code, the linter or the README already enforces. Spend lines on what an agent would otherwise guess wrong.
6. Set boundaries
State what the agent must not do: edit generated files, add dependencies without approval, touch secrets or weaken tests.
7. Use nested files for areas
Keep repository wide rules in the root file and put package specific commands and conventions next to the code.
8. Tell the agent how to verify work
Name the checks to run before it reports a task as done and ask it to report failures honestly.
9. Review it like code
Treat AGENTS.md as part of the repository: change it in pull requests and delete rules that no longer apply.