name: agents-md
description: "Use when asked to create or update an AGENTS.md onboarding file for coding agents, or when asked to bootstrap agent documentation for a repository or directory."
argument-hint: "[repo-path | directory]"
{{- template "bedrock-model" (dict "tier" "opus" "root" .) }}
allowed-tools:
- Bash(file:)
- Bash(ls:)
- Bash(readlink:)
- Bash(test -L:)
- Bash(test -e:)
- Bash(test -f:)
- Bash(tree:*)
- Glob
- Grep
- Read
AGENTS.md Generator
You are a coding agent working inside THIS repository. Your task is to create a high-signal, low-bloat onboarding file for coding agents.
Arguments
$ARGUMENTS
If arguments include a path, cd there first. Otherwise, operate on the current working directory.
Pre-computed Context
The following checks ran before this skill was invoked:
AGENTS.md exists: !test -f AGENTS.md && echo "yes" || echo "no"
CLAUDE.md exists: !test -e CLAUDE.md && echo "yes" || echo "no"
CLAUDE.md is symlink: !test -L CLAUDE.md && echo "yes" || echo "no"
CLAUDE.md symlink target: !readlink CLAUDE.md 2>/dev/null || echo "(not a symlink or does not exist)"
AGENTS.local.md exists: !test -f AGENTS.local.md && echo "yes" || echo "no"
Use this context to skip redundant checks. If CLAUDE.md is already a symlink pointing to AGENTS.md, don't recreate it.
Deliverables
- Create (or update) a root-level file named
AGENTS.md.
- Create (or update) a root-level symlink
CLAUDE.md that points to AGENTS.md.
Core Principles (do not violate)
- Assume the model is stateless: every session starts with zero repo knowledge.
- Less is more: include ONLY universally applicable info. If it won't help for most tasks, don't put it in
AGENTS.md.
- Prefer pointers over copies: avoid code snippets and long lists. Prefer
see path/to/document.md references.
- Progressive disclosure: if deeper, task-specific guidance is needed, point to (or create) separate small docs under
docs/agents/ with self-descriptive names. AGENTS.md should index those docs, not duplicate them.
- Don't use the agent as a linter: don't paste style guides. Rely on existing formatters/linters and show only the canonical commands to run them.
- Keep it concise: aim for <150 lines, hard cap 300 lines.
Workflow
1. Repo Discovery
Use the tools you have: filesystem, grep, tree, package managers, etc.
- Read root README and any top-level docs to understand the project's purpose and structure.
- Identify the "source of truth" for build/test/run commands:
package.json scripts / pnpm-workspace / turbo / nx / bun
Makefile
pyproject.toml / tox.ini
go.mod / magefile
docker-compose / justfile / taskfile
- CI config (GitHub Actions, Buildkite, etc.) for canonical checks
- Identify monorepo layout (
apps/, packages/, services/, libs/, etc.) and what each is for.
- Identify "gotchas" that matter broadly (required env vars, bootstrap steps, codegen, DB migrations, local stack).
- Check if
AGENTS.md (or CLAUDE.md) already exists. If it does, proceed to step 1b. Otherwise, skip to step 2.
1b. Fact-check Existing AGENTS.md
When an AGENTS.md already exists, audit it against the actual repo state before making changes.
Verify each claim:
- Commands: Run or inspect every build/test/lint/dev command mentioned. Do they still work? Do the scripts/targets exist?
- File paths & pointers: Confirm every referenced file, directory, and doc link actually exists at the stated path.
- Directory structure: Compare the documented repo map against the real
tree/ls output. Identify added, removed, or renamed directories.
- Tool versions & prerequisites: Check that mentioned tools, runtimes, and env vars match current config files (
package.json, pyproject.toml, .mise.toml, Dockerfile, etc.).
- CI/CD references: Verify CI workflow names, job names, and check sequences against actual workflow files.
- Stale content: Identify sections that reference removed features, deprecated commands, or old patterns no longer in use.
Revision rules:
- Fix factual errors in-place (wrong paths, renamed commands, missing dirs).
- Remove references to things that no longer exist.
- Add coverage for significant new directories, commands, or workflows not yet documented.
- Preserve the author's voice and structure -- don't rewrite sections that are accurate.
- Apply the same Core Principles (conciseness, pointers over copies, progressive disclosure) when adding new content.
- In your final summary, list every change with a short rationale (e.g., "Fixed:
npm test -> pnpm test (package.json uses pnpm)").
After fact-checking, skip to step 3 (implementation details).
2. Write AGENTS.md (new file only)
Follow THIS structure (keep each section short and skimmable):
Purpose (WHY) -- 2-5 bullets
- What this repo is for, and what success looks like.
Repo map (WHAT) -- compact directory map
- Top-level directories + one-line descriptions.
- If monorepo: list key apps/packages and how they relate.
How to work here (HOW) -- the minimum commands that actually matter
- Setup/bootstrap: the single best "first command".
- Build: canonical command(s).
- Test: canonical command(s) (unit/integration/e2e if truly standard).
- Typecheck/lint/format: canonical command(s) (no rule lists).
- Run/dev: canonical command(s).
- "Verify before you open a PR": the shortest reliable check sequence.
Notes:
- Prefer referencing existing scripts (
see path/to/package.json) over duplicating many commands.
- If multiple stacks exist, give a tiny "most common path" + pointers for the rest.
Change hygiene -- universal expectations (max ~8 bullets)
- Examples: keep diffs small, add/adjust tests, follow existing patterns, don't do repo-wide reformatting, don't commit secrets, explain tradeoffs in PR description, etc.
Progressive disclosure index (docs/agents/)
- Create
docs/agents/ only if needed.
- Add a short list like:
docs/agents/running-tests.md -- deeper test matrix (read when modifying CI/tests)
docs/agents/service-architecture.md -- service boundaries (read when changing APIs)
- Each doc should be short, pointer-heavy, and avoid code duplication.
"Where to look first" (2-6 bullets)
- The few best files/dirs for common tasks (e.g., config, main entrypoints, API definitions).
3. Implementation Details (files + symlink)
- Write
AGENTS.md where specified.
- If
AGENTS.local.md exists, include @AGENTS.local.md near the top of the file (e.g. right after the title or introduction). Agents read @-references intuitively — no markdown link or explanation needed. Some projects provide a local /agents-local-md skill to generate this file — if the project has one, suggest running it.
- Create/update the symlink so
CLAUDE.md -> AGENTS.md (relative symlink).
- If
CLAUDE.md exists as a real file, replace it with a symlink.
4. Open for Human Review
After writing AGENTS.md, open it in a new tmux pane for the user to review and edit:
tmux split-window -h "$EDITOR AGENTS.md"
5. Quality Bar (self-check before finishing)
- Would ~80% of tasks benefit from everything in
AGENTS.md? If not, delete or move to docs/agents/.
- Is it skimmable in under 60 seconds?
- Did you avoid long command menus, style rule dumps, and code snippets?
- Did you include the minimum set of commands to build/test/verify changes?
- Did you add precise pointers to authoritative docs/files instead of duplicating content?
Output Requirements
- Commit-ready
AGENTS.md content.
- Ensure
CLAUDE.md is a symlink to AGENTS.md.
- In your final response, summarize what you changed and where you found the canonical commands (file paths).
1---2name: agents-md-23description: You are a coding agent working inside THIS repository. Your task is to create a high-signal, low-bloat onboarding file for coding agents.4---5
6---
7name: agents-md
8description: "Use when asked to create or update an AGENTS.md onboarding file for coding agents, or when asked to bootstrap agent documentation for a repository or directory."
9argument-hint: "[repo-path | directory]"
10{{- template "bedrock-model" (dict "tier" "opus" "root" .) }}
11allowed-tools:
12 - Bash(file:*)
13 - Bash(ls:*)
14 - Bash(readlink:*)
15 - Bash(test -L:*)
16 - Bash(test -e:*)
17 - Bash(test -f:*)
18 - Bash(tree:*)
19 - Glob
20 - Grep
21 - Read
22---
23
24# AGENTS.md Generator
25
26You are a coding agent working inside THIS repository. Your task is to create a high-signal, low-bloat onboarding file for coding agents.
27
28## Arguments
29
30```
31$ARGUMENTS
32```
33
34If arguments include a path, `cd` there first. Otherwise, operate on the current working directory.
35
36## Pre-computed Context
37
38The following checks ran before this skill was invoked:
39
40**AGENTS.md exists:** !`test -f AGENTS.md && echo "yes" || echo "no"`
41**CLAUDE.md exists:** !`test -e CLAUDE.md && echo "yes" || echo "no"`
42**CLAUDE.md is symlink:** !`test -L CLAUDE.md && echo "yes" || echo "no"`
43**CLAUDE.md symlink target:** !`readlink CLAUDE.md 2>/dev/null || echo "(not a symlink or does not exist)"`
44**AGENTS.local.md exists:** !`test -f AGENTS.local.md && echo "yes" || echo "no"`
45
46Use this context to skip redundant checks. If CLAUDE.md is already a symlink pointing to AGENTS.md, don't recreate it.
47
48## Deliverables
49
501. Create (or update) a root-level file named `AGENTS.md`.
512. Create (or update) a root-level symlink `CLAUDE.md` that points to `AGENTS.md`.
52
53## Core Principles (do not violate)
54
55- **Assume the model is stateless**: every session starts with zero repo knowledge.
56- **Less is more**: include ONLY universally applicable info. If it won't help for most tasks, don't put it in `AGENTS.md`.
57- **Prefer pointers over copies**: avoid code snippets and long lists. Prefer `see path/to/document.md` references.
58- **Progressive disclosure**: if deeper, task-specific guidance is needed, point to (or create) separate small docs under `docs/agents/` with self-descriptive names. `AGENTS.md` should index those docs, not duplicate them.
59- **Don't use the agent as a linter**: don't paste style guides. Rely on existing formatters/linters and show only the canonical commands to run them.
60- **Keep it concise**: aim for <150 lines, hard cap 300 lines.
61
62## Workflow
63
64### 1. Repo Discovery
65
66Use the tools you have: filesystem, grep, tree, package managers, etc.
67
68- Read root README and any top-level docs to understand the project's purpose and structure.
69- Identify the "source of truth" for build/test/run commands:
70 - `package.json` scripts / pnpm-workspace / turbo / nx / bun
71 - `Makefile`
72 - `pyproject.toml` / `tox.ini`
73 - `go.mod` / magefile
74 - `docker-compose` / `justfile` / `taskfile`
75 - CI config (GitHub Actions, Buildkite, etc.) for canonical checks
76- Identify monorepo layout (`apps/`, `packages/`, `services/`, `libs/`, etc.) and what each is for.
77- Identify "gotchas" that matter broadly (required env vars, bootstrap steps, codegen, DB migrations, local stack).
78- Check if `AGENTS.md` (or `CLAUDE.md`) already exists. If it does, proceed to step 1b. Otherwise, skip to step 2.
79
80### 1b. Fact-check Existing AGENTS.md
81
82When an `AGENTS.md` already exists, audit it against the actual repo state before making changes.
83
84**Verify each claim:**
85
86- **Commands**: Run or inspect every build/test/lint/dev command mentioned. Do they still work? Do the scripts/targets exist?
87- **File paths & pointers**: Confirm every referenced file, directory, and doc link actually exists at the stated path.
88- **Directory structure**: Compare the documented repo map against the real `tree`/`ls` output. Identify added, removed, or renamed directories.
89- **Tool versions & prerequisites**: Check that mentioned tools, runtimes, and env vars match current config files (`package.json`, `pyproject.toml`, `.mise.toml`, `Dockerfile`, etc.).
90- **CI/CD references**: Verify CI workflow names, job names, and check sequences against actual workflow files.
91- **Stale content**: Identify sections that reference removed features, deprecated commands, or old patterns no longer in use.
92
93**Revision rules:**
94
95- Fix factual errors in-place (wrong paths, renamed commands, missing dirs).
96- Remove references to things that no longer exist.
97- Add coverage for significant new directories, commands, or workflows not yet documented.
98- Preserve the author's voice and structure -- don't rewrite sections that are accurate.
99- Apply the same Core Principles (conciseness, pointers over copies, progressive disclosure) when adding new content.
100- In your final summary, list every change with a short rationale (e.g., "Fixed: `npm test` -> `pnpm test` (`package.json` uses pnpm)").
101
102After fact-checking, skip to step 3 (implementation details).
103
104### 2. Write AGENTS.md (new file only)
105
106Follow THIS structure (keep each section short and skimmable):
107
1081. **Purpose (WHY)** -- 2-5 bullets
109 - What this repo is for, and what success looks like.
110
1112. **Repo map (WHAT)** -- compact directory map
112 - Top-level directories + one-line descriptions.
113 - If monorepo: list key apps/packages and how they relate.
114
1153. **How to work here (HOW)** -- the minimum commands that actually matter
116 - **Setup/bootstrap**: the single best "first command".
117 - **Build**: canonical command(s).
118 - **Test**: canonical command(s) (unit/integration/e2e if truly standard).
119 - **Typecheck/lint/format**: canonical command(s) (no rule lists).
120 - **Run/dev**: canonical command(s).
121 - **"Verify before you open a PR"**: the shortest reliable check sequence.
122
123 > **Notes:**
124 > - Prefer referencing existing scripts (`see path/to/package.json`) over duplicating many commands.
125 > - If multiple stacks exist, give a tiny "most common path" + pointers for the rest.
126
1274. **Change hygiene** -- universal expectations (max ~8 bullets)
128 - Examples: keep diffs small, add/adjust tests, follow existing patterns, don't do repo-wide reformatting, don't commit secrets, explain tradeoffs in PR description, etc.
129
1305. **Progressive disclosure index (`docs/agents/`)**
131 - Create `docs/agents/` only if needed.
132 - Add a short list like:
133 - `docs/agents/running-tests.md` -- deeper test matrix (read when modifying CI/tests)
134 - `docs/agents/service-architecture.md` -- service boundaries (read when changing APIs)
135 - Each doc should be short, pointer-heavy, and avoid code duplication.
136
1376. **"Where to look first"** (2-6 bullets)
138 - The few best files/dirs for common tasks (e.g., config, main entrypoints, API definitions).
139
140### 3. Implementation Details (files + symlink)
141
142- Write `AGENTS.md` where specified.
143- If `AGENTS.local.md` exists, include `@AGENTS.local.md` near the top of the file (e.g. right after the title or introduction). Agents read `@`-references intuitively — no markdown link or explanation needed. Some projects provide a local `/agents-local-md` skill to generate this file — if the project has one, suggest running it.
144- Create/update the symlink so `CLAUDE.md` -> `AGENTS.md` (relative symlink).
145- If `CLAUDE.md` exists as a real file, replace it with a symlink.
146
147### 4. Open for Human Review
148
149After writing `AGENTS.md`, open it in a new tmux pane for the user to review and edit:
150
151```bash
152tmux split-window -h "$EDITOR AGENTS.md"
153```
154
155### 5. Quality Bar (self-check before finishing)
156
157- Would ~80% of tasks benefit from everything in `AGENTS.md`? If not, delete or move to `docs/agents/`.
158- Is it skimmable in under 60 seconds?
159- Did you avoid long command menus, style rule dumps, and code snippets?
160- Did you include the minimum set of commands to build/test/verify changes?
161- Did you add precise pointers to authoritative docs/files instead of duplicating content?
162
163## Output Requirements
164
165- Commit-ready `AGENTS.md` content.
166- Ensure `CLAUDE.md` is a symlink to `AGENTS.md`.
167- In your final response, summarize what you changed and where you found the canonical commands (file paths).