Skill: agents-generator
Generates a tailored AGENTS.md + .agents/rules/*.md for the target project — not a template with placeholders, but a living document that matches the project's real toolchain.
What you get
From a project that uses Bun + Next.js 16 + Tailwind + Vitest + Server Actions, the skill produces:
AGENTS.md
├── Setup commands: bun install, bun dev, bun run test:run, bun doctor
├── Verification Cycle: bunx tsc --noEmit → bun run lint → bun run test:run → bun doctor
├── Conventions: "Bun always. Plain TypeScript types + guards."
└── Architecture → .agents/rules/architecture.md
.agents/rules/
├── architecture.md ← ASCII diagram with real directories, exact versions
├── frontend-patterns.md ← Component rules, state locations, trust boundaries
├── server-actions.md ← downloadVideo() flow, DownloadResult type, rate limiter
├── testing.md ← "74 tests in 5 files", vitest commands, mock patterns
├── git-workflow.md ← Conventional commits, pre-commit checks
└── sdd-workflow.md ← Preflight defaults, post-apply verification
Rules NOT generated: backend.md (no NestJS), database.md (no ORM), i18n.md (hardcoded Spanish), forms.md (manual inputs), styling.md (Tailwind in frontend rules).
Activation Contract
Generate AGENTS.md + .agents/rules/*.md for the target project. Never guess — read the project's actual files first.
Mode selection
| User says |
Mode |
Output |
| "simple AGENTS.md", "just the basics", "minimal" |
Minimal |
Single AGENTS.md (~30 lines, no rule files) |
| "full AGENTS.md", "with rules", "complete", or default |
Full |
AGENTS.md + .agents/rules/*.md |
| "update AGENTS.md", "refresh", "my stack changed" |
Update |
Diff existing, regenerate only what changed |
Dry-run mode
If the user asks to "preview", "show what would change", "dry-run": run all detection but do NOT write files. Show detection summary, files that would be created, skipped rules, and sample output.
Hard Rules
- Read before writing. Read
package.json, all config files, and directory structure before generating anything.
- Detect package manager FIRST. Check lockfiles:
bun.lock→bun, pnpm-lock.yaml→pnpm, package-lock.json→npm, yarn.lock→yarn. NEVER default to npm. Every command uses the detected PM.
- Generate only what applies. No backend rules for frontend-only. No database rules without ORM.
- Auto-format and lint generated files. Run
[format cmd] and [lint cmd] on generated files only — never the whole project. These are fast, safe operations.
- Validate commands. Every command in output must exist as a script key in
package.json.
- No placeholders. Scan output for
{{, TODO, add here, .... Reject if any remain.
- Backup first. If files exist, copy to
.agents/backups/ with timestamp.
Execution Steps
Common
git rev-parse --show-toplevel → project root.
- Detect package manager FIRST: check lockfiles.
bun.lock→bun, pnpm-lock.yaml→pnpm, package-lock.json→npm, yarn.lock→yarn. Never default to npm.
- Read
package.json (scripts, deps, workspaces). Save scripts for validation.
- Read config files and explore directory structure.
- Select mode (ask if ambiguous).
Full mode
- Read
assets/agents-full.md — this is the AGENTS.md structure with all sections and filling rules.
- Read project files and fill every placeholder with real data. Never use generic text.
- Generate
AGENTS.md at project root. Wrap content in <!-- AGENTS-GENERATED-START --> / <!-- AGENTS-GENERATED-END -->.
- For each applicable rule category, read the corresponding template from
assets/ and generate the rule file in .agents/rules/.
- If Claude detected (
.claude/ or CLAUDE.md): generate thin CLAUDE.md from assets/claude.md.
- If platform files detected: generate from
assets/platform.md.
Minimal mode
- Read
assets/agents-minimal.md — 30-line agents.md standard format.
- Generate single
AGENTS.md.
Update mode
- Backup existing files.
- Re-detect project state.
- Diff old vs new. Regenerate only changed categories.
Post-generation
- Run
[format cmd] on the generated files only.
- Run
[lint cmd] on the generated files only.
- Scan for
{{, TODO, .... Fix any found.
- Verify all commands exist in package.json scripts.
- If AGENTS.md > 300 lines, warn. If > 500, move content to rule files.
- Summarize all changes using conventional commit format before declaring done.
- Report: what was detected, generated, skipped, and confidence score.
Output Contract
Return:
- Mode used and why
- Files created/modified
- Detection summary (all categories)
- Rules generated and skipped (with reason)
- Confidence score
References
| Priority |
File |
Purpose |
| Required |
assets/agents-full.md |
Full AGENTS.md template with all 25+ sections and filling rules |
| Required |
assets/agents-minimal.md |
30-line agents.md standard template |
| Full mode |
assets/architecture.md |
Architecture rules template |
| Full mode |
assets/frontend-patterns.md |
Frontend patterns template |
| Full mode |
assets/server-actions.md |
Server actions / backend template |
| Full mode |
assets/testing.md |
Testing strategy template |
| Full mode |
assets/git-workflow.md |
Git workflow template |
| Full mode |
assets/sdd-workflow.md |
SDD workflow template |
| Full mode |
assets/styling.md |
Styling rules template |
| Full mode |
assets/forms.md |
Form patterns template |
| Full mode |
assets/database.md |
Database rules template |
| Full mode |
assets/i18n.md |
i18n rules template |
| Full mode |
assets/backend.md |
Backend/NestJS template |
| Conditional |
assets/claude.md |
CLAUDE.md — only if Claude detected |
| Conditional |
assets/platform.md |
Multi-platform files |
| Conditional |
assets/agents-nested.md |
Monorepo nested AGENTS.md |
| Reference |
references/decision-matrix.md |
Full detection logic and edge cases |
| Reference |
references/example-output/README.md |
Quality benchmark |
| Reference |
references/template-filling-guide.md |
Placeholder filling rules |
1---2name: agents-generator-23description: Generate a complete, project-specific AGENTS.md compatible with the agents.md standard (60k+ open-source projects). Also generates platform-specific files (.cursorrules, Copilot instructions, GEMINI.md) for detected platforms. Use when setting up AI agent rules, creating project conventions for Claude Code, Cursor, Copilot, OpenCode, or any agent that reads AGENTS.md. Supports three modes: full (rich AGENTS.md + companion rule files + multi-platform output), minimal (single 30-line AGENTS.md following the agents.md standard), and update (diff existing, regenerate only changed). Detects monorepos for nested files. Extracts design tokens from config files. Includes confidence scoring, managed blocks, audit logging, and state memory. Every command and convention is derived from the project's real package.json, config files, and directory structure — never generic templates.4license: MIT5---67# Skill: agents-generator89Generates a tailored AGENTS.md + `.agents/rules/*.md` for the target project — not a template with placeholders, but a living document that matches the project's real toolchain.1011## What you get1213From a project that uses **Bun + Next.js 16 + Tailwind + Vitest + Server Actions**, the skill produces:1415```16AGENTS.md17├── Setup commands: bun install, bun dev, bun run test:run, bun doctor18├── Verification Cycle: bunx tsc --noEmit → bun run lint → bun run test:run → bun doctor19├── Conventions: "Bun always. Plain TypeScript types + guards."20└── Architecture → .agents/rules/architecture.md2122.agents/rules/23├── architecture.md ← ASCII diagram with real directories, exact versions24├── frontend-patterns.md ← Component rules, state locations, trust boundaries25├── server-actions.md ← downloadVideo() flow, DownloadResult type, rate limiter26├── testing.md ← "74 tests in 5 files", vitest commands, mock patterns27├── git-workflow.md ← Conventional commits, pre-commit checks28└── sdd-workflow.md ← Preflight defaults, post-apply verification29```3031Rules NOT generated: `backend.md` (no NestJS), `database.md` (no ORM), `i18n.md` (hardcoded Spanish), `forms.md` (manual inputs), `styling.md` (Tailwind in frontend rules).3233## Activation Contract3435Generate AGENTS.md + `.agents/rules/*.md` for the target project. Never guess — read the project's actual files first.3637### Mode selection3839| User says | Mode | Output |40|-----------|------|--------|41| "simple AGENTS.md", "just the basics", "minimal" | **Minimal** | Single `AGENTS.md` (~30 lines, no rule files) |42| "full AGENTS.md", "with rules", "complete", or default | **Full** | `AGENTS.md` + `.agents/rules/*.md` |43| "update AGENTS.md", "refresh", "my stack changed" | **Update** | Diff existing, regenerate only what changed |4445### Dry-run mode4647If the user asks to "preview", "show what would change", "dry-run": run all detection but do NOT write files. Show detection summary, files that would be created, skipped rules, and sample output.4849## Hard Rules5051- **Read before writing.** Read `package.json`, all config files, and directory structure before generating anything.52- **Detect package manager FIRST.** Check lockfiles: `bun.lock`→bun, `pnpm-lock.yaml`→pnpm, `package-lock.json`→npm, `yarn.lock`→yarn. NEVER default to npm. Every command uses the detected PM.53- **Generate only what applies.** No backend rules for frontend-only. No database rules without ORM.54- **Auto-format and lint generated files.** Run `[format cmd]` and `[lint cmd]` on generated files only — never the whole project. These are fast, safe operations.55- **Validate commands.** Every command in output must exist as a script key in `package.json`.56- **No placeholders.** Scan output for `{{`, `TODO`, `add here`, `...`. Reject if any remain.57- **Backup first.** If files exist, copy to `.agents/backups/` with timestamp.5859## Execution Steps6061### Common62631. `git rev-parse --show-toplevel` → project root.642. **Detect package manager FIRST**: check lockfiles. `bun.lock`→bun, `pnpm-lock.yaml`→pnpm, `package-lock.json`→npm, `yarn.lock`→yarn. Never default to npm.653. Read `package.json` (scripts, deps, workspaces). Save scripts for validation.664. Read config files and explore directory structure.675. Select mode (ask if ambiguous).6869### Full mode70711. Read `assets/agents-full.md` — this is the AGENTS.md structure with all sections and filling rules.722. Read project files and fill every placeholder with real data. Never use generic text.733. Generate `AGENTS.md` at project root. Wrap content in `<!-- AGENTS-GENERATED-START -->` / `<!-- AGENTS-GENERATED-END -->`.744. For each applicable rule category, read the corresponding template from `assets/` and generate the rule file in `.agents/rules/`.755. If Claude detected (`.claude/` or `CLAUDE.md`): generate thin `CLAUDE.md` from `assets/claude.md`.766. If platform files detected: generate from `assets/platform.md`.7778### Minimal mode79801. Read `assets/agents-minimal.md` — 30-line agents.md standard format.812. Generate single `AGENTS.md`.8283### Update mode84851. Backup existing files.862. Re-detect project state.873. Diff old vs new. Regenerate only changed categories.8889### Post-generation9091- Run `[format cmd]` on the generated files only.92- Run `[lint cmd]` on the generated files only.93- Scan for `{{`, `TODO`, `...`. Fix any found.94- Verify all commands exist in package.json scripts.95- If AGENTS.md > 300 lines, warn. If > 500, move content to rule files.96- Summarize all changes using conventional commit format before declaring done.97- Report: what was detected, generated, skipped, and confidence score.9899## Output Contract100101Return:102- Mode used and why103- Files created/modified104- Detection summary (all categories)105- Rules generated and skipped (with reason)106- Confidence score107108## References109110| Priority | File | Purpose |111|----------|------|---------|112| **Required** | `assets/agents-full.md` | Full AGENTS.md template with all 25+ sections and filling rules |113| **Required** | `assets/agents-minimal.md` | 30-line agents.md standard template |114| Full mode | `assets/architecture.md` | Architecture rules template |115| Full mode | `assets/frontend-patterns.md` | Frontend patterns template |116| Full mode | `assets/server-actions.md` | Server actions / backend template |117| Full mode | `assets/testing.md` | Testing strategy template |118| Full mode | `assets/git-workflow.md` | Git workflow template |119| Full mode | `assets/sdd-workflow.md` | SDD workflow template |120| Full mode | `assets/styling.md` | Styling rules template |121| Full mode | `assets/forms.md` | Form patterns template |122| Full mode | `assets/database.md` | Database rules template |123| Full mode | `assets/i18n.md` | i18n rules template |124| Full mode | `assets/backend.md` | Backend/NestJS template |125| Conditional | `assets/claude.md` | CLAUDE.md — only if Claude detected |126| Conditional | `assets/platform.md` | Multi-platform files |127| Conditional | `assets/agents-nested.md` | Monorepo nested AGENTS.md |128| Reference | `references/decision-matrix.md` | Full detection logic and edge cases |129| Reference | `references/example-output/README.md` | Quality benchmark |130| Reference | `references/template-filling-guide.md` | Placeholder filling rules |