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
- 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).
1---2name: writing-agents-md3description: Teach an agent how to create a high-quality AGENTS.md file for a code project, including structure, rules, conventions, and examples. Use when the user requests guidance or generation of an AGENTS.md file.4license: MIT5---6
7# Writing AGENTS.md
8
9## When to use this skill
10Use this skill when the user explicitly requests:
111. Generation of a new AGENTS.md file for a repository.
122. Review or improvement of an existing AGENTS.md.
133. Conversion of project conventions into agent-actionable guidance.
14
15Base the output on best practices for agent guidance, project conventions,
16explicit rules, and examples.
17
18## Objective
19Produce an AGENTS.md that:
201. Is **clear and unambiguous** about agent behavior expectations.
212. Includes **explicit rules, boundaries, and escalation points**.
223. Is **actionable and machine-readable** (do not rely on narrative prose alone).
234. Provides **commands, conventions, and examples** the agent can follow.
245. Contains **sections relevant to the user’s project context**.
25
26## Structure to output
271. Title and purpose
28 - One sentence summarizing the role of the AGENTS.md file for this project.
292. Scope
30 - Which agents the file governs (AI assistants, bots, CI tools).
31 - Which parts of the project are *in scope* vs *restricted*.
323. Non-negotiable rules
33 - Explicit statements of `MUST`, `MUST NOT`, `SHOULD`, or `SHOULD NOT`.
34 - Example:
35 ```
36 MUST NOT modify database schema migrations.
37 MUST run tests before proposing a patch.
38 ```
394. Project architecture summary
40 - A short, bullet list description of the main code boundaries (e.g., frontend/backend layers, APIs, core modules).
415. Coding and workflow conventions
42 - Toolchain commands (e.g. build/test/lint) with exact flags the agent should use.
43 - Formatting, error handling, commit conventions.
446. Testing and validation requirements
45 - Explicit instructions on when tests must be added or updated.
46 - Expected test commands to run and criteria to meet.
477. Change and escalation policies
48 - When the agent **must stop and ask for human approval**.
49 Example: “If a breaking API change is required, prompt for approval.”
508. Examples
51 - Minimal examples showing correct application of key rules.
529. Safety, security, and sensitive areas
53 - List areas where modifications are high-risk and require explicit verification.
5410. Final checklist
55 - A bullet list of items the agent should ensure before submitting changes.
56
57## Output guidelines
58- Use **clear, short commands** (no narrative prose) in rules and conventions.
59- Avoid generalities; prefer **specific examples or exact commands**.
60- Do not assume project context; **ask clarifying questions** if needed.
61- Do not generate hypothetical rules; ensure each rule is **relevant to the target repository**.
62
63## Example prompt
64When the user asks:
65> “Write an AGENTS.md for my TypeScript web app using React and Vitest”
66You should prompt:
671. “What are the test, lint, and build commands?”
682. “Which parts of the project should not be modified by an agent?”
69
70Use their answers to tailor the output.
71
72## Edge cases to include
73- If the project has *multiple services* (monorepo), clarify **scope by directory**.
74- If there are *security-relevant config files*, include explicit error-prevention rules.
75- If no explicit test suite exists, generate fallback instructions for test scaffolding.
76
77## Important notes
78- The agent should treat **AGENTS.md not as optional commentary, but as a normative contract** for autonomous behaviors.
79- Output must be usable by other agent products that understand AGENTS.md semantics (avoid product-specific jargon).