A comprehensive best-practices reference
AGENTS.md is the primary instruction document that OpenAI Codex and
similar AI coding agents automatically read when interacting with your
repository.
It acts as a system prompt at the repo level, defining:
- How agents should behave\
- What rules & constraints they must follow\
- How they should interpret project structure\
- What internal architecture conventions exist\
- Which commands and tools are canonical\
- Which files/folders are off-limits\
- What requires human confirmation
A well-crafted AGENTS.md drastically improves reliability, reduces
hallucination, enforces consistency, and ensures that AI agents navigate
your repo safely.
This guide provides a complete checklist of best practices and recommended content structure.
AGENTS.md should be:
- Authoritative
- Operational
- Machine-friendly
- Human-readable
- This file is for AI coding agents.
- Global rules may be overridden by:
AGENTS.override.md- Directory-specific
AGENTS.md
- Closest file wins for instruction precedence.
A strong AGENTS.md typically includes:
- Purpose & Scope\
- Project Overview\
- Repository Layout\
- Development Commands\
- Testing & Definition of Done\
- Code Style & Architecture Conventions\
- Localization & i18n Rules\
- Security, Privacy & Safety Constraints\
- Restricted / Dangerous Areas\
- Pull Request & Collaboration Guidelines\
- When to Ask for Human Confirmation\
- Instruction Style Best Practices\
- Maintenance Strategy\
- Template for a Root-Level
AGENTS.md
Include:
- Project mission, domain, audience\
- Real tech stack\
- High-level architecture (components, routing, state mgmt., services, testing)\
- Non-goals
Provide a short directory map and rules for where code goes.
Canonical examples:
npm install
npm run watch
npm run build
npm run preview
npm run lint
npm run test
npm run test:e2e
Avoid alternatives.
- Unit tests updated\
- All tests green\
- ESLint & Prettier clean\
- No missing i18n keys
- TypeScript clean (if applicable)\
- No console errors
- PascalCase SFCs\
- Kebab-case directories\
- Prefix patterns: Base*, The*\
- No hardcoded strings (use i18n)\
- Descriptive variable names\
- Vuetify tooltip standards\
- Commit messages use Conventional Commits
Summaries from _DOC/standards/i18n-key-naming-standard.md:
- Semantic, stable IDs\
feature.section.purpose_optional\- Dot-separated, snake_case\
- Depth ≤ 3\
- ICU for variables & plurals\
- Both locales must be updated\
- Reuse keys only if meaning identical\
- Keys are stable IDs; rename only if meaning changes
- No logging PII\
- No committing secrets\
.env.examplefor guidance\- Avoid unsafe command generation
- Auto-generated folders\
- Critical domain logic\
- CI/CD configuration\
- Shared architecture components\
- Schema or migration code\
- High-risk areas require human approval
- Branch naming\
- Conventional commits\
- Required checks (tests, lint, type)\
- Update documentation when needed\
- Ask for review for architecture changes
- Use bullet lists\
- Use headings\
- Avoid contradictions\
- Include examples\
- Keep text concise\
- Prefer imperative voice
- Keep AGENTS.md updated with architecture changes\
- Review periodically\
- Treat it as high-value documentation\
- Use overrides for temporary rules
Example skeleton:
# AGENTS.md
## Purpose & Scope
...
## Project Overview
...
## Repository Layout
...
## Development Commands
...
## Testing & Definition of Done
...
## Code Style & Architecture Conventions
...
## Localization & i18n Rules
...
## Security & Privacy Constraints
...
## Restricted / Dangerous Areas
...
## Collaboration & PR Guidelines
...
## When to Ask for Human Review
...
A strong AGENTS.md is:
- Clear\
- Structured\
- Aligned with the repo\
- Safe\
- Concise\
- Actionable
Use this guide as your primary reference for creating and maintaining AGENTS.md files.