Repository instructions
AGENTS.md Template
Copy a practical AGENTS.md template with real command, architecture, scope, safety, testing, and definition-of-done fields for coding agents.
Use this at the repository root when Codex or another compatible coding agent needs durable project commands, boundaries, and verification rules.
Full version
Copy the AGENTS.md template
Replace every bracketed value and delete any rule you cannot verify in the repository.
# Repository Instructions
## Scope
These instructions apply to the entire repository unless a deeper AGENTS.md overrides them.
## Repository Map
- `src/`: application source
- `tests/`: automated tests
- `docs/`: maintained documentation
- `[generated path]`: generated output; do not edit manually
## Commands
- Install dependencies: `[exact command]`
- Start development: `[exact command]`
- Run focused tests: `[exact command with path/filter]`
- Run full tests: `[exact command]`
- Lint: `[exact command]`
- Type-check: `[exact command]`
- Build: `[exact command]`
## Code and Architecture
- Follow the nearest existing implementation for naming and file placement.
- Keep public interfaces backward compatible unless the task explicitly changes them.
- Prefer the existing standard library and dependencies before adding a package.
- Update documentation when behavior or public configuration changes.
## Safety Boundaries
- Never commit credentials, tokens, private keys, or local environment files.
- Do not run deployments, migrations, destructive commands, or external writes without explicit authorization.
- Preserve unrelated working-tree changes.
- Treat authentication, billing, permissions, and data deletion as high-risk areas requiring focused verification.
## Testing
- Add or update tests for changed behavior, including a failure case when relevant.
- Run the narrowest useful check during iteration, then the required full checks before handoff.
- Do not claim a check passed unless its command completed successfully.
## Definition of Done
- Requested behavior is implemented.
- Relevant tests, lint, type checks, and build pass.
- The final diff is scoped and reviewed.
- Documentation and examples match the implementation.
- Handoff lists changed files, commands run, results, and unresolved risks.Do not copy blindly: Do not use it as a task tracker, secret store, product specification, or substitute for enforceable CI and permissions.
Minimal version
Start smaller when the repository is simple
# Repository Instructions
## Commands
- Install: `[exact command]`
- Develop: `[exact command]`
- Test: `[exact command]`
- Lint: `[exact command]`
- Build: `[exact command]`
## Project Map
- `[path]`: [what belongs here]
- `[path]`: [what belongs here]
## Working Rules
- Keep changes within the requested scope.
- Follow existing patterns before introducing a new abstraction.
- Do not edit generated files or secrets.
## Definition of Done
- Relevant tests pass.
- Lint and type checks pass.
- The diff contains no unrelated changes.
- Report changed files, checks run, and remaining risks.Customize each field
Commands
Copy exact commands from package files, task runners, or CI. Remove rows the project does not use.
Repository Map
Name only directories whose purpose or editability is not obvious from their contents.
Safety Boundaries
Document project-specific hazards, then enforce critical restrictions with permissions, hooks, or CI.
Definition of Done
Use checks the agent can execute and evidence a reviewer can independently verify.
Validate the instructions
- Place the file at the repository root and start a new Codex run.
- Ask Codex to summarize the active repository instructions before editing.
- Give it a read-only orientation task and confirm it names the correct commands and boundaries.
- Run one small change and verify the handoff includes the required evidence.
- Add nested AGENTS.md files only where a subtree genuinely needs different rules.
Common mistakes
Generic rules such as ‘write clean code’
Replace them with a path, command, measurable constraint, or existing example.
Commands copied from another repository
Run every listed command in this repository before committing the file.
A giant architecture manual
Keep durable operating rules here and link focused source-of-truth documents.
Security expressed only as prose
Use sandboxing, approvals, hooks, branch protection, and CI for guarantees.
Interactive tool
Generate a repository-specific starting file.
Choose your framework, real commands, paths, and approval boundaries, then copy or download the result.
Open AGENTS.md GeneratorRelated templates
Choose the closest repository shape.
Official sources
Instruction discovery and scope behavior were checked on August 13, 2026. Recheck product documentation when standardizing these files across a team.