Writing AGENTS.md
When to use this skill
Use this skill when the user explicitly requests:
- •Generation of a new AGENTS.md file for a repository.
- •Review or improvement of an existing AGENTS.md.
- •Conversion of project conventions into agent-actionable guidance.
Base the output on best practices for agent guidance, project conventions, explicit rules, and examples.
Objective
Produce an AGENTS.md that:
- •Is clear and unambiguous about agent behavior expectations.
- •Includes explicit rules, boundaries, and escalation points.
- •Is actionable and machine-readable (do not rely on narrative prose alone).
- •Provides commands, conventions, and examples the agent can follow.
- •Contains sections relevant to the user’s project context.
Structure to output
- •Title and purpose
- •One sentence summarizing the role of the AGENTS.md file for this project.
- •Scope
- •Which agents the file governs (AI assistants, bots, CI tools).
- •Which parts of the project are in scope vs restricted.
- •Non-negotiable rules
- •Explicit statements of
MUST,MUST NOT,SHOULD, orSHOULD NOT. - •Example:
code
MUST NOT modify database schema migrations. MUST run tests before proposing a patch.
- •Project architecture summary
- •A short, bullet list description of the main code boundaries (e.g., frontend/backend layers, APIs, core modules).
- •Coding and workflow conventions
- •Toolchain commands (e.g. build/test/lint) with exact flags the agent should use.
- •Formatting, error handling, commit conventions.
- •Testing and validation requirements
- •Explicit instructions on when tests must be added or updated.
- •Expected test commands to run and criteria to meet.
- •Change and escalation policies
- •When the agent must stop and ask for human approval. Example: “If a breaking API change is required, prompt for approval.”
- •Examples
- •Minimal examples showing correct application of key rules.
- •Safety, security, and sensitive areas
- •List areas where modifications are high-risk and require explicit verification.
- •Final checklist
- •A bullet list of items the agent should ensure before submitting changes.
Output guidelines
- •Use clear, short commands (no narrative prose) in rules and conventions.
- •Avoid generalities; prefer specific examples or exact commands.
- •Do not assume project context; ask clarifying questions if needed.
- •Do not generate hypothetical rules; ensure each rule is relevant to the target repository.
Example prompt
When the user asks:
“Write an AGENTS.md for my TypeScript web app using React and Vitest” You should prompt:
- •“What are the test, lint, and build commands?”
- •“Which parts of the project should not be modified by an agent?”
Use their answers to tailor the output.
Edge cases to include
- •If the project has multiple services (monorepo), clarify scope by directory.
- •If there are security-relevant config files, include explicit error-prevention rules.
- •If no explicit test suite exists, generate fallback instructions for test scaffolding.
Important notes
- •The agent should treat AGENTS.md not as optional commentary, but as a normative contract for autonomous behaviors.
- •Output must be usable by other agent products that understand AGENTS.md semantics (avoid product-specific jargon).