Generating AGENTS.md templates
AGENTS.md is a dedicated, predictable place to store agent-focused project context (project structure, commands, testing recipes, and conventions) that would clutter a human-oriented README. Prefer concrete, repo-derived facts over generic advice.
Inputs you MUST use
You have access to all files in the repository. Use them.
Prioritize these sources (if present):
AGENTS.md (existing), README.md, CONTRIBUTING.md, docs/
- Build/task runners:
Makefile, package.json scripts, justfile, tox.ini, noxfile.py
- Tooling configs:
pyproject.toml, setup.cfg, .pre-commit-config.yaml, .editorconfig
- CI:
.github/workflows/*, .gitlab-ci.yml, azure-pipelines.yml, etc.
- Release docs:
CHANGELOG.md, release scripts, tagging docs
Output contract
Produce one Markdown document: the full contents of AGENTS.md.
- If an
AGENTS.md already exists: preserve useful content, update stale parts, and keep the same intent/tone.
- If you cannot find evidence for a required detail, insert a single-line marker:
> TODO: <what’s missing and where to confirm it>
- Do not invent commands, versions, paths, or policies.
Authoring workflow (do this in order)
Inventory & evidence
- Identify the project’s language(s), key frameworks, and tooling by reading configs.
- Locate canonical commands (lint/format/test/type-check/build) from task files.
- Identify where tests live and how CI runs them.
Draft the outline
- Use the exact section order in “AGENTS.md template” below.
- Keep it “medium”: enough to execute common work correctly, but not a full handbook.
Fill from repo facts
- Prefer verbatim commands (copy exactly).
- Reference files by relative paths (e.g.,
pyproject.toml, mtrust/calls.py).
Plan-first compatibility (no interactive approvals)
- Do not write “ask first / require confirmation” directives.
- Instead, encode risk as plan-time requirements, e.g.:
- “When proposing a plan that changes public interfaces, call out breaking-change risk.”
- “When changing dependencies, include rationale and impact in the plan.”
Quality checks
- Ensure required sections are present (repo map, testing, conventions, dependency/tooling).
- Ensure Markdown only (no HTML), and keep lines ≤ 100 chars where practical.
- Ensure TODOs are minimal and actionable (point to where to look).
AGENTS.md template (keep exact order)
1) # AGENTS.md
- One paragraph: what the repo is, what it does, and who this file is for (agents + devs).
2) ## Repository Structure
- Show a top-level tree or bullet map of directories and key files.
- For each item: one sentence purpose.
- Only drill into subdirectories when they are critical entry points.
3) ## Build & Development Commands
- Group commands under short headings (e.g., Lint/Format/Test/Type-check/Build).
- Use fenced
bash blocks.
- Copy commands exactly as found (Makefile targets, scripts, etc.).
- If multiple equivalent ways exist, list the canonical one first and mention alternatives.
4) ## Dependency & Tooling Notes
Include only what you can prove from the repo:
- Language/runtime versions supported (e.g.,
python = ">=3.11").
- Framework versions/ranges when pinned or constrained.
- Key tooling (linters/formatters/test runners/type checkers) and where configured.
5) ## Code Style & Conventions
- Formatting/linting rules at a high level (line length, import order, formatter).
- Naming conventions (modules, tests, settings).
- Used changelog conventions (if present).
6) ## Testing Recipes
- Where tests live (paths), and how to run:
- Full suite
- A single file / a single test / keyword filtering (use the repo’s framework)
- Coverage (if present)
- Note any rules for external calls:
- If tests mock network/third-party APIs, state where fixtures/mocks live.
- If unclear, add a TODO.
7) ## Maintenance Notes
- A short list of what must be kept current as the repo changes:
- Update this file when structure/commands/tooling change.
- Update
CHANGELOG.md per the present changelog conventions.
Writing rules
- Be specific: prefer “pytest + pytest-django” over “run tests”.
- Avoid duplication with README; link/point to it when appropriate.
- No marketing language; focus on operational accuracy.
- Do not mention any tool-specific behavior (no references to Codex CLI, etc.).
1---2name: generating-agents-md3description: Generates or updates an AGENTS.md file by scanning a repository for structure, commands, tests, and conventions. Use when a user asks to create or improve `AGENTS.md` for a repository.4---5
6# Generating AGENTS.md templates
7
8AGENTS.md is a dedicated, predictable place to store agent-focused project context (project structure, commands, testing recipes, and conventions) that would clutter a human-oriented README. Prefer concrete, repo-derived facts over generic advice.
9
10## Inputs you MUST use
11You have access to all files in the repository. Use them.
12
13Prioritize these sources (if present):
14- `AGENTS.md` (existing), `README.md`, `CONTRIBUTING.md`, `docs/`
15- Build/task runners: `Makefile`, `package.json` scripts, `justfile`, `tox.ini`, `noxfile.py`
16- Tooling configs: `pyproject.toml`, `setup.cfg`, `.pre-commit-config.yaml`, `.editorconfig`
17- CI: `.github/workflows/*`, `.gitlab-ci.yml`, `azure-pipelines.yml`, etc.
18- Release docs: `CHANGELOG.md`, release scripts, tagging docs
19
20## Output contract
21Produce **one** Markdown document: the full contents of `AGENTS.md`.
22
23- If an `AGENTS.md` already exists: preserve useful content, update stale parts, and keep the same intent/tone.
24- If you cannot find evidence for a required detail, insert a single-line marker:
25 `> TODO: <what’s missing and where to confirm it>`
26- Do **not** invent commands, versions, paths, or policies.
27
28## Authoring workflow (do this in order)
291. **Inventory & evidence**
30 - Identify the project’s language(s), key frameworks, and tooling by reading configs.
31 - Locate canonical commands (lint/format/test/type-check/build) from task files.
32 - Identify where tests live and how CI runs them.
33
342. **Draft the outline**
35 - Use the exact section order in “AGENTS.md template” below.
36 - Keep it “medium”: enough to execute common work correctly, but not a full handbook.
37
383. **Fill from repo facts**
39 - Prefer verbatim commands (copy exactly).
40 - Reference files by relative paths (e.g., `pyproject.toml`, `mtrust/calls.py`).
41
424. **Plan-first compatibility (no interactive approvals)**
43 - Do not write “ask first / require confirmation” directives.
44 - Instead, encode risk as **plan-time requirements**, e.g.:
45 - “When proposing a plan that changes public interfaces, call out breaking-change risk.”
46 - “When changing dependencies, include rationale and impact in the plan.”
47
485. **Quality checks**
49 - Ensure required sections are present (repo map, testing, conventions, dependency/tooling).
50 - Ensure Markdown only (no HTML), and keep lines ≤ 100 chars where practical.
51 - Ensure TODOs are minimal and actionable (point to where to look).
52
53## AGENTS.md template (keep exact order)
54
55### 1) `# AGENTS.md`
56- One paragraph: what the repo is, what it does, and who this file is for (agents + devs).
57
58### 2) `## Repository Structure`
59- Show a top-level tree or bullet map of directories and key files.
60- For each item: **one sentence** purpose.
61- Only drill into subdirectories when they are critical entry points.
62
63### 3) `## Build & Development Commands`
64- Group commands under short headings (e.g., Lint/Format/Test/Type-check/Build).
65- Use fenced `bash` blocks.
66- Copy commands exactly as found (Makefile targets, scripts, etc.).
67- If multiple equivalent ways exist, list the canonical one first and mention alternatives.
68
69### 4) `## Dependency & Tooling Notes`
70Include only what you can prove from the repo:
71- Language/runtime versions supported (e.g., `python = ">=3.11"`).
72- Framework versions/ranges when pinned or constrained.
73- Key tooling (linters/formatters/test runners/type checkers) and where configured.
74
75### 5) `## Code Style & Conventions`
76- Formatting/linting rules at a high level (line length, import order, formatter).
77- Naming conventions (modules, tests, settings).
78- Used changelog conventions (if present).
79
80### 6) `## Testing Recipes`
81- Where tests live (paths), and how to run:
82 - Full suite
83 - A single file / a single test / keyword filtering (use the repo’s framework)
84 - Coverage (if present)
85- Note any rules for external calls:
86 - If tests mock network/third-party APIs, state where fixtures/mocks live.
87 - If unclear, add a TODO.
88
89### 7) `## Maintenance Notes`
90- A short list of what must be kept current as the repo changes:
91 - Update this file when structure/commands/tooling change.
92 - Update `CHANGELOG.md` per the present changelog conventions.
93
94## Writing rules
95- Be specific: prefer “pytest + pytest-django” over “run tests”.
96- Avoid duplication with README; link/point to it when appropriate.
97- No marketing language; focus on operational accuracy.
98- Do not mention any tool-specific behavior (no references to Codex CLI, etc.).