AGENTS.md Creation Guide
This guide explains how to write a high-signal AGENTS.md file that reliably steers AI agents and automated contributors.
Required placement
AGENTS.mdmust live at the repository root.
Required structure
AGENTS.md should follow this structure:
- What this repo is
- How the repo is organized (top-level folder map + notes)
- Where the main docs live (must be
docs/at repo root) - Hard rules for agents
- How to work in this repo (workflow + verification)
- Escalation policy
- What “done” looks like
Hard rules section (minimum set)
Include the rules you care about most. Common examples:
- Migrations: who owns migrations; when agents must not create/modify revisions.
- Security: sanitization, authz boundaries, rate limiting, input validation rules.
- Scope: what directories are allowed to change without explicit approval.
- No secrets: never add secrets or private URLs to docs, code, or trackers.
Workflow guidance (keep it short and enforceable)
Use clear imperatives:
- Read the relevant standards doc first.
- Verify claims against source code before documenting them.
- If behavior is ambiguous, ask the project lead.
- Prefer safe-by-default changes; avoid bypasses.
Keep it maintainable
- Use bullet lists and short sections.
- Prefer links to internal docs over duplicating long explanations.
- Prefer linking to shared workflow playbooks instead of restating them. For Git/GitHub workflow, link to:
docs/playbooks/git/workflow.md. - Update it when new modules, workflows, or constraints are introduced.
Required docs reference (must-have line)
Every AGENTS.md must explicitly state:
- The main documentation lives in the root
docs/folder, and - The recommended starting point (for example
docs/readme.mdordocs/index.md, whichever the repo uses).
Required folder map (must-have list)
Every AGENTS.md must include a short “module map” of the repo root, for example:
docs/— main documentation entrypoint + deeper guidessrc/orapp/— primary application codetests/— automated tests mirroring module boundariestrackers/— tracking docs (trackers/files/), only when explicitly requested
Keep it concise: 6–12 bullets is usually enough.