Agent Guide Bootstrap
Generate the full agent-guide system for a repo so AI coding assistants (Claude Code, Cursor, Copilot, Codex) get the right context at the right time.
The system uses progressive disclosure: a terse always-on AGENTS.md (~80 lines) + on-demand domain guides + canonical reference files. One source of truth — tool-specific files like CLAUDE.md are thin redirects.
Additional triggers
Beyond the description's "Use when…" phrases, also invoke when:
- User joined a new repo and wants AI agents productive.
- User notices an agent making the same mistake twice and wants to encode the rule.
Critical rules
- Never embed code examples that will go stale. Point to canonical reference files (
Canonical example: src/routes/users-routes.ts). The codebase is always up to date — embedded examples are not.
- Lead domain guides with "Do Not" lists. Agents discover positive patterns from existing code. They cannot discover which valid-looking patterns are prohibited.
- AGENTS.md ≤ 80 lines. It loads on every turn. Anything domain-specific moves to
.agents/{domain}.md.
- Exact commands, not descriptions.
pnpm biome check --write path/to/file.ts, not "run the linter".
Workflow
1. Explore the repo
Read these:
- Manifest files:
package.json / pyproject.toml / Gemfile / Cargo.toml / go.mod
- Top-level directories + monorepo config (
pnpm-workspace.yaml, turbo.json, nx.json)
- Build/CI configs:
Makefile, .github/workflows/, Dockerfile, docker-compose.yml
- Existing docs:
README.md, CONTRIBUTING.md, docs/
- Recent commit history (commit message format)
- Any existing
AGENTS.md, CLAUDE.md, .cursorrules, .github/copilot-instructions.md — do not duplicate, merge
2. Identify
- Tech stack: languages, frameworks, package manager, linter, formatter, test runner, ORM, CI.
- Architecture per app/package: routes/controllers/services/models, or components/views/state, etc.
- Domains: each top-level area that an agent would touch separately (frontend, backend, infra, db, mobile).
- Exact commands: read
package.json scripts, Makefiles, CI configs, READMEs. Capture lint, typecheck, test, dev, full-check.
- Conventions: commit format (look at commit history),
.env.example keys, conditional commands (e.g. "if Prisma schema changed: pnpm db:generate").
- Prohibited patterns: multiple ways to do the same thing → pick canonical, prohibit rest. Singletons that get duplicated. Legacy vs. preferred patterns.
- Canonical reference files: best-written example per pattern (routes, components, data fetching, tests).
3. Clarification gate
If anything is ambiguous — which pattern is canonical, what the commit format is, whether a domain needs its own guide — STOP and ask the user with AskUserQuestion before generating files. Guessing here cascades into bad rules.
4. Generate files
Use the structure spec in references/agent-guide-spec.md for exact section-by-section guidance. Generate:
AGENTS.md (~80 lines): project header, repo map, commands, domain pointers, workflow checklist, conventions.
.agents/<domain>.md (one per major area): "Do Not" list first, then architecture diagram, then key patterns with canonical references.
CLAUDE.md: one-line redirect to AGENTS.md.
.agents/design-decisions.md: rationale for the progressive disclosure system + maintenance protocol.
5. Verify before committing
AGENTS.md is ≤ 80 lines.
- Every "Do Not" rule has a concrete "do this instead".
- Every canonical reference path exists (
ls it). Broken links destroy trust.
- Every command is exact and runnable (no placeholders).
- No embedded code examples that could go stale.
Anti-patterns
- Do not generate
AGENTS.md over 100 lines. It costs tokens on every turn.
- Do not duplicate content between
AGENTS.md and tool-specific files. Tool files are redirects.
- Do not write "prefer" or "consider" rules. Use "Do NOT" and "NEVER" — agents follow prohibitions reliably; suggestions get ignored.
- Do not invent reference paths. Verify they exist.
- Do not add a domain guide for an area the repo doesn't actually have. One guide per real domain.
Reference
Full structural spec with section-by-section templates: references/agent-guide-spec.md.
1---2name: agent-guide-bootstrap3description: Bootstrap a complete agent guide system for a repo — generates AGENTS.md (always-on), .agents/{domain}.md (loaded on demand), CLAUDE.md (redirect), and .agents/design-decisions.md using progressive disclosure and canonical references instead of stale embedded code. Use when the user mentions setting up AGENTS.md, bootstrapping an agent guide, configuring CLAUDE.md for a repo, "set up agent context", or onboarding a new repo for AI coding agents.4---56# Agent Guide Bootstrap78Generate the full agent-guide system for a repo so AI coding assistants (Claude Code, Cursor, Copilot, Codex) get the right context at the right time.910**The system uses progressive disclosure**: a terse always-on `AGENTS.md` (~80 lines) + on-demand domain guides + canonical reference files. One source of truth — tool-specific files like `CLAUDE.md` are thin redirects.1112## Additional triggers1314Beyond the description's "Use when…" phrases, also invoke when:1516- User joined a new repo and wants AI agents productive.17- User notices an agent making the same mistake twice and wants to encode the rule.1819## Critical rules20211. **Never embed code examples that will go stale.** Point to canonical reference files (`Canonical example: src/routes/users-routes.ts`). The codebase is always up to date — embedded examples are not.222. **Lead domain guides with "Do Not" lists.** Agents discover positive patterns from existing code. They cannot discover which valid-looking patterns are prohibited.233. **AGENTS.md ≤ 80 lines.** It loads on every turn. Anything domain-specific moves to `.agents/{domain}.md`.244. **Exact commands, not descriptions.** `pnpm biome check --write path/to/file.ts`, not "run the linter".2526## Workflow2728### 1. Explore the repo2930Read these:31- Manifest files: `package.json` / `pyproject.toml` / `Gemfile` / `Cargo.toml` / `go.mod`32- Top-level directories + monorepo config (`pnpm-workspace.yaml`, `turbo.json`, `nx.json`)33- Build/CI configs: `Makefile`, `.github/workflows/`, `Dockerfile`, `docker-compose.yml`34- Existing docs: `README.md`, `CONTRIBUTING.md`, `docs/`35- Recent commit history (commit message format)36- Any existing `AGENTS.md`, `CLAUDE.md`, `.cursorrules`, `.github/copilot-instructions.md` — do not duplicate, merge3738### 2. Identify3940- **Tech stack**: languages, frameworks, package manager, linter, formatter, test runner, ORM, CI.41- **Architecture per app/package**: routes/controllers/services/models, or components/views/state, etc.42- **Domains**: each top-level area that an agent would touch separately (frontend, backend, infra, db, mobile).43- **Exact commands**: read `package.json` scripts, Makefiles, CI configs, READMEs. Capture lint, typecheck, test, dev, full-check.44- **Conventions**: commit format (look at commit history), `.env.example` keys, conditional commands (e.g. "if Prisma schema changed: `pnpm db:generate`").45- **Prohibited patterns**: multiple ways to do the same thing → pick canonical, prohibit rest. Singletons that get duplicated. Legacy vs. preferred patterns.46- **Canonical reference files**: best-written example per pattern (routes, components, data fetching, tests).4748### 3. Clarification gate4950If anything is ambiguous — which pattern is canonical, what the commit format is, whether a domain needs its own guide — **STOP and ask the user** with `AskUserQuestion` before generating files. Guessing here cascades into bad rules.5152### 4. Generate files5354Use the structure spec in [references/agent-guide-spec.md](references/agent-guide-spec.md) for exact section-by-section guidance. Generate:5556- `AGENTS.md` (~80 lines): project header, repo map, commands, domain pointers, workflow checklist, conventions.57- `.agents/<domain>.md` (one per major area): "Do Not" list first, then architecture diagram, then key patterns with canonical references.58- `CLAUDE.md`: one-line redirect to `AGENTS.md`.59- `.agents/design-decisions.md`: rationale for the progressive disclosure system + maintenance protocol.6061### 5. Verify before committing6263- `AGENTS.md` is ≤ 80 lines.64- Every "Do Not" rule has a concrete "do this instead".65- Every canonical reference path exists (`ls` it). Broken links destroy trust.66- Every command is exact and runnable (no placeholders).67- No embedded code examples that could go stale.6869## Anti-patterns7071- **Do not** generate `AGENTS.md` over 100 lines. It costs tokens on every turn.72- **Do not** duplicate content between `AGENTS.md` and tool-specific files. Tool files are redirects.73- **Do not** write "prefer" or "consider" rules. Use "Do NOT" and "NEVER" — agents follow prohibitions reliably; suggestions get ignored.74- **Do not** invent reference paths. Verify they exist.75- **Do not** add a domain guide for an area the repo doesn't actually have. One guide per real domain.7677## Reference7879Full structural spec with section-by-section templates: [references/agent-guide-spec.md](references/agent-guide-spec.md).