Sync Agents
Overview
Generate or update AGENTS.md — a concise onboarding file that gives AI agents
the minimum context needed to work effectively. The agent has tools to
explore the codebase — AGENTS.md should only contain what those tools can't
easily discover: conventions, gotchas, architectural decisions, and process.
Announce at start: "Using sync-agents skill to update AGENTS.md."
Core Principle
AGENTS.md is not documentation. It's a cheat sheet for things that are
non-obvious, counter-intuitive, or expensive to discover by reading code.
If an agent can figure it out by reading a file, don't put it in AGENTS.md.
What NOT to include
- Module structure listings — agents can use
gather-context, glob, and
directory reads to discover files. Listing every file wastes context tokens.
- Full API route catalogs — agents can grep for route definitions.
- Database schema tables — agents can read the schema file.
- Things already in other docs — link to them, don't duplicate them.
- Obvious conventions — "use TypeScript" when every file is
.ts is noise.
- README content — AGENTS.md is not a README.
What TO include
- One-line project description + architecture
- Repo layout (top-level dirs only, one word each)
- Commands (dev, build, test, lint, typecheck)
- Pre-commit gate
- Tech stack table (only non-obvious choices or specific versions that matter)
- Key architectural patterns — things an agent would get wrong if it guessed
- Known gotchas — things that look wrong but are correct, or correct but break things
- Conventions and non-negotiables — rules that differ from standard practice
- Links to docs — one section pointing at SPEC.md, TODO.md, etc.
Template
# {ProjectName} — Agent Context
{One paragraph: what it does, what stack, what architecture.}
## Repo layout
{Top-level dirs only. No nested trees. No file-level descriptions.}
## Commands
{Only the commands an agent needs to run. Group by purpose.}
The pre-commit gate is: {commands}. All must pass before committing.
## Tech stack
| Layer | Choice |
|---|---|
{Only layers where the choice matters or is non-obvious.}
## Key architectural patterns
{2-4 patterns max. Only things that are non-obvious or easy to get wrong.
Each pattern: name + 2-3 sentences.}
## Known gotchas
{Only things an agent would break or "fix" incorrectly.}
## Further reading
- **`docs/{file}`** — {what it covers}
Writing Rules
- No hard line limit, but keep it tight. Known gotchas and architectural
patterns will grow naturally — that's fine. The enemy is filler: module
listings, duplicated content, obvious conventions. Cut those ruthlessly.
- No module structure listings. Agents have
gather-context, glob, and
directory reads for that.
- No duplication. If it's in another doc, link to it.
- Gotchas are specific and rare. "tldraw v4:
createTLStore() with no args"
not "be careful with libraries."
- Patterns explain why, not what. "readOnly arrives via stateless message
in the connected hook, not onAuthenticated" not "there's a readOnly system."
- Omit empty sections. If there are no gotchas, don't include the heading.
Process
- Read existing
AGENTS.md if present
- Scan codebase for what changed (commands, deps, patterns, gotchas)
- Update only sections that drifted — don't rewrite the whole file
- Present a diff summary to the user
- Wait for approval before saving
Updating an Existing AGENTS.md
- Read the existing file
- Compare against current codebase state
- Update only what drifted — add new patterns/gotchas, remove stale ones,
update commands if scripts changed
- Trim any sections that violate the rules above (module listings, duplication)
- Present diff summary: "Updating 3 sections: Commands (added
db:migrate),
Tech stack (added Stripe), Gotchas (added webhook ordering). Removed server
module listing (agent can discover it)."
- Wait for approval before saving
1---2name: sync-agents3description: Use when the user asks to create or update an AGENTS.md file, or when setting up agent context for a project. Generates a concise onboarding document for AI agents working in a codebase.4---56# Sync Agents78## Overview910Generate or update `AGENTS.md` — a concise onboarding file that gives AI agents11the **minimum** context needed to work effectively. The agent has tools to12explore the codebase — AGENTS.md should only contain what those tools can't13easily discover: conventions, gotchas, architectural decisions, and process.1415**Announce at start:** "Using sync-agents skill to update AGENTS.md."1617## Core Principle1819**AGENTS.md is not documentation.** It's a cheat sheet for things that are20non-obvious, counter-intuitive, or expensive to discover by reading code.21If an agent can figure it out by reading a file, don't put it in AGENTS.md.2223## What NOT to include2425- **Module structure listings** — agents can use `gather-context`, glob, and26 directory reads to discover files. Listing every file wastes context tokens.27- **Full API route catalogs** — agents can grep for route definitions.28- **Database schema tables** — agents can read the schema file.29- **Things already in other docs** — link to them, don't duplicate them.30- **Obvious conventions** — "use TypeScript" when every file is `.ts` is noise.31- **README content** — AGENTS.md is not a README.3233## What TO include3435- One-line project description + architecture36- Repo layout (top-level dirs only, one word each)37- Commands (dev, build, test, lint, typecheck)38- Pre-commit gate39- Tech stack table (only non-obvious choices or specific versions that matter)40- **Key architectural patterns** — things an agent would get wrong if it guessed41- **Known gotchas** — things that look wrong but are correct, or correct but break things42- **Conventions and non-negotiables** — rules that differ from standard practice43- **Links to docs** — one section pointing at SPEC.md, TODO.md, etc.4445## Template4647```markdown48# {ProjectName} — Agent Context4950{One paragraph: what it does, what stack, what architecture.}5152## Repo layout5354{Top-level dirs only. No nested trees. No file-level descriptions.}5556## Commands5758{Only the commands an agent needs to run. Group by purpose.}5960The pre-commit gate is: {commands}. All must pass before committing.6162## Tech stack6364| Layer | Choice |65|---|---|66{Only layers where the choice matters or is non-obvious.}6768## Key architectural patterns6970{2-4 patterns max. Only things that are non-obvious or easy to get wrong.71Each pattern: name + 2-3 sentences.}7273## Known gotchas7475{Only things an agent would break or "fix" incorrectly.}7677## Further reading7879- **`docs/{file}`** — {what it covers}80```8182## Writing Rules8384- **No hard line limit**, but keep it tight. Known gotchas and architectural85 patterns will grow naturally — that's fine. The enemy is filler: module86 listings, duplicated content, obvious conventions. Cut those ruthlessly.87- **No module structure listings.** Agents have `gather-context`, glob, and88 directory reads for that.89- **No duplication.** If it's in another doc, link to it.90- **Gotchas are specific and rare.** "tldraw v4: `createTLStore()` with no args"91 not "be careful with libraries."92- **Patterns explain why, not what.** "readOnly arrives via stateless message93 in the connected hook, not onAuthenticated" not "there's a readOnly system."94- **Omit empty sections.** If there are no gotchas, don't include the heading.9596## Process97981. Read existing `AGENTS.md` if present992. Scan codebase for what changed (commands, deps, patterns, gotchas)1003. Update only sections that drifted — don't rewrite the whole file1014. Present a diff summary to the user1025. Wait for approval before saving103104## Updating an Existing AGENTS.md1051061. Read the existing file1072. Compare against current codebase state1083. Update only what drifted — add new patterns/gotchas, remove stale ones,109 update commands if scripts changed1104. Trim any sections that violate the rules above (module listings, duplication)1115. Present diff summary: "Updating 3 sections: Commands (added `db:migrate`),112 Tech stack (added Stripe), Gotchas (added webhook ordering). Removed server113 module listing (agent can discover it)."1146. Wait for approval before saving