Creates, updates, or prunes an AGENTS.md for any repository by auditing the codebase, detecting non-discoverable gaps, and drafting minimal high-signal instructions. Triggers: AGENTS.md, agent setup, agent config, init agents, workspace setup, agent instructions, Claude setup. Uses: Read, Bash, Glob, Grep, AskUserQuestion. Outputs: AGENTS.md at repo root (or module-level for monorepos). Do NOT use for: writing README, generating docs, configuring CI, or editing code.
90
92%
Does it follow best practices?
Impact
78%
1.06xAverage score across 3 eval scenarios
Passed
No known issues
Generate or refine an AGENTS.md that contains only what agents cannot discover on their own — non-obvious commands, hidden constraints, workflow gotchas, and landmines.
AGENTS.md. But distinguish existence from intent: a file or directory existing is discoverable, but its status (deprecated, do-not-touch, under migration) and constraints (must not enable, requires special flags) are often NOT discoverable. Include those.AskUserQuestion for every developer-facing choice; always include an uncertainty / "I'm not sure" option.AGENTS.md, improve incrementally — never blind-replace. Show a diff summary before writing. "Incremental" means show a diff, NOT preserve everything. Stale content, redundant content, tech stack sections, directory overviews, and tooling-enforced rules MUST be actively pruned from existing files. The quality gate applies equally to existing and new content.AGENTS.md files near relevant modules instead of one monolithic root file.Every AGENTS.md you produce MUST follow this exact structure. Use these exact headings. Omit a section only if it has zero content — never rename or paraphrase the headings.
# Agent instructions — <project name>
<One-line scope statement: one sentence explaining what this file covers and why it exists. Required.>
## Non-discoverable commands
<Commands with non-obvious flags, multi-step procedures, or names that differ from convention.>
## Landmines
<Deprecated directories still imported, hidden dependencies, files that must not be touched, order-sensitive operations.>
## Conventions not enforced by tooling
<Commit message formats without commitlint, naming patterns without lint rules, review requirements not in CI.>
## Task-specific constraints
<Per-area guidance: "when working in X, always Y because Z.">
## Scope & routing
<For monorepos: which modules have their own rules, where to find them.>The one-line scope statement immediately after the # Agent instructions heading is required. It must be 1-2 sentences explaining what this file covers that agents cannot discover from reading the repo. Example: "Non-discoverable constraints for agents working in this repo."
Scan the repository automatically. Do not ask the user anything yet.
Read and catalogue findings from these sources (skip any that do not exist):
| Priority | Files |
|---|---|
| Agent configs | AGENTS.md, CLAUDE.md, .cursor/rules/, .cursorrules, .github/copilot-instructions.md, GEMINI.md |
| Project docs | README.md, PROJECT.md, CONTRIBUTING.md, CHANGELOG.md |
| Tooling | package.json, pyproject.toml, Cargo.toml, go.mod, Makefile, Justfile, Taskfile.yml |
| CI / workflows | .github/workflows/*.yml, .gitlab-ci.yml, Jenkinsfile, .circleci/config.yml |
| Linter / formatter | .eslintrc*, .prettierrc*, biome.json, .rustfmt.toml, ruff.toml, .editorconfig |
| Config | tsconfig*.json, next.config.*, vite.config.*, .env.example, docker-compose*.yml |
For each source, extract:
Produce an in-memory repo profile — do not output it to the user. It feeds Phase 2.
See audit-checklist for the detailed scan procedure.
Compare the repo profile against any existing AGENTS.md:
Classify each gap as:
| Category | Example |
|---|---|
command | npm test -- --no-cache required but package.json script is just vitest |
landmine | /legacy directory still imported in production via barrel file |
convention | Commit messages must follow Conventional Commits but no commitlint configured |
routing | Module packages/auth has its own deploy pipeline not documented anywhere |
env | DATABASE_URL required but .env.example is missing or incomplete |
If there are genuine ambiguities (conflicting signals, unclear intent), queue 2–3 targeted questions for Phase 3. If no ambiguities exist, skip Phase 3 entirely.
Ask 2–3 questions maximum via AskUserQuestion. Only ask about genuine ambiguities surfaced by the audit — never ask generic questions.
Good questions are specific and informed:
npm test -- --no-cache but the package.json script doesn't include that flag — is --no-cache always required?"/legacy directory is imported in src/index.ts but looks unmaintained — should agents avoid touching it?".env.example — are they required for local dev?"Bad questions (never ask these):
If no ambiguities exist, skip this phase and tell the user: "Audit was clean — no ambiguities found. Moving to draft."
Generate the AGENTS.md content using only material that passes the discoverability filter. See discoverability-filter for the filter specification. Use the exact structure defined in the Output format section above.
Quality gate: For every line in the draft, verify:
Delete any line that fails any check. Log every removal in audit-notes.md or changes-summary.md with the reason.
Present the final draft to the user via AskUserQuestion with options:
If updating an existing AGENTS.md, present a summary of changes: lines added, lines removed, lines modified.
Write the file only after explicit approval.
After writing AGENTS.md, remind the user:
AGENTS.mdis temporary guidance, not permanent configuration. When a recurring issue appears, prefer fixing the root cause in code or tooling (lint rule, test, script, config). Keep only the minimum instruction needed until the root cause is solved. Prune stale instructions aggressively.
Important: The tech stack details below (NestJS, npm, Jest, etc.) appear ONLY to explain the audit reasoning. They must NEVER appear in actual
AGENTS.mdoutput. The only output is the finalAGENTS.mdcontent shown in Phase 4.
Input: A NestJS API with npm workspaces, an existing but stale AGENTS.md.
Phase 1 finds CI uses --no-cache flag not in package.json scripts, an unmaintained src/legacy-auth/ module still imported, and REDIS_URL missing from .env.example.
Phase 2 classifies: command (hidden flag), landmine (legacy module), env (missing var), stale (existing "use yarn" instruction), redundant (existing directory overview).
Phase 3 asks one question about the legacy module; user confirms it's under migration and should not be touched.
Phase 4 produces (note: uses the exact prescribed headings, includes scope statement, and the ## Landmines section documents the deprecated directory's status — which is not discoverable even though the directory itself is visible):
# Agent instructions — acme-api
Non-discoverable constraints for agents working in this repo.
## Non-discoverable commands
- Always run tests with `npm test -- --no-cache`. The `--no-cache` flag is required because Jest module caching breaks fixture isolation. Running without it produces false greens.
- Run database migrations with `npx typeorm migration:run -d src/data-source.ts`. There is no npm script — invoke directly via npx.
## Landmines
- `src/legacy-auth/` is imported in `app.module.ts` but is under active migration. Do not modify files in this module. If a task requires auth changes, work in `src/auth-v2/` instead.
## Conventions not enforced by tooling
- `REDIS_URL` is required for local development but is not in `.env.example`. Set it to `redis://localhost:6379` for local work.What is NOT included (and must never be): tech stack, directory structure, package manager choice, testing framework, framework version — all discoverable from repo files.
Avoid these failure modes — most violate the non-negotiables above:
AGENTS.md without showing what changed.75611cd
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.