AGENTS Guidance Skill
This skill provides a rigorous methodology for creating, auditing, and maintaining AGENTS.md and repository instruction files.
The primary objective of AGENTS.md is to serve as a compact, durable instruction file that helps AI coding sessions avoid mistakes and ramp up immediately without wasting context.
Core Guiding Principle
The Litmus Test:
Every line must answer: "Would an agent likely miss or guess this wrong without help?"
If the answer is no, leave it out.
Good AGENTS.md content is hard-earned context that typically requires reading multiple files to infer.
1. Investigation Protocol
Do not make assumptions or write speculative guidance. Follow this prioritized order of investigation:
Step 1: Executable Sources of Truth (Highest Value)
- Root manifests & configs:
package.json, Cargo.toml, pyproject.toml, go.mod, build.gradle, etc.
- Workspace & lockfiles:
pnpm-workspace.yaml, lerna.json, uv.lock, pnpm-lock.yaml, etc.
- Build, test, lint, format, typecheck, & codegen configs:
tsconfig.json, eslint.config.*, .prettierrc, ruff.toml, Makefile, Justfile, CMakeLists.txt
- CI workflows & Task Runners:
.github/workflows/, .gitlab-ci.yml, pre-commit configs (.pre-commit-config.yaml).
- Existing instructions & agent configs:
AGENTS.md, CLAUDE.md, .cursor/rules/, .cursorrules, .github/copilot-instructions.md, opencode.json.
Step 2: Architecture & Entrypoint Inspection
If architecture remains unclear after reading configs:
- Inspect a small set of representative entrypoints (e.g.
main.*, index.*, server bootstrap, router definitions).
- Trace real package boundaries and execution flow.
- Prefer files that explain system wiring over leaf implementation files.
Step 3: Subagent Delegation (When Available)
If subagent capabilities (e.g., invoke_subagent, research subagents, or parallel task delegates) are available in the agent runtime:
- Delegate Broad Exploration: Use subagents to concurrently investigate separate packages, services, or documentation directories without cluttering the primary context window.
- Targeted Research Prompts: Task subagents with extracting specific, high-signal facts (e.g., "Find the exact command to run a single unit test and list any local services required").
- Consolidate & Verify: Use subagent outputs as candidate findings, verify them against root manifests, and synthesize the final compact instruction set.
Step 4: Executable vs. Prose Conflicts
- Always trust executable configs and scripts over prose documentation.
- If
README.md claims npm test works, but package.json specifies pnpm test:unit with specific flags, record the executable command. Only keep facts you can verify.
2. What to Extract (High-Signal Facts)
Focus strictly on facts that change how an agent operates:
Exact Developer Commands:
- Non-obvious build, run, and dev commands.
- Exact command to run a single test, a single package, or a focused verification step.
- Required sequence if order matters (e.g.,
codegen -> typecheck -> test:unit).
Monorepo & Package Boundaries:
- Workspace package ownership, internal dependency relationships, and boundary rules.
- Core app vs. shared library entrypoints.
Toolchain & Framework Quirks:
- Required codegen steps (
prisma generate, proto-gen, graphql-codegen).
- Database migrations or local seed flows.
- Generated files that should never be edited directly.
- Special environment loading requirements or mandatory runtime flags.
Testing Quirks:
- Required local services (Docker, emulator, Redis).
- Snapshot update commands and fixture conventions.
- Suites that are flaky, slow, or require external credentials.
Repo-Specific Conventions:
- Conventions that intentionally deviate from standard language or framework defaults.
- Git branch/commit constraints (e.g., conventional commits, linear history).
3. What to Exclude (Strict Filtering)
To prevent prompt bloat and context contamination, exclude:
- ❌ Generic software advice: e.g., "Write clean code", "Handle errors gracefully", "Use descriptive names".
- ❌ Long tutorials & file listings: Avoid exhaustive file tree listings (agents have search tools).
- ❌ Obvious language/framework defaults: Standard Python PEP8 or standard Go idioms that tools already format.
- ❌ Speculative or unverified claims: Anything not substantiated by config, scripts, or user confirmation.
- ❌ Redundant documentation: Content that belongs in docs, unless an agent would actively fail without it.
When in doubt, omit.
4. Asking Questions
Only ask the user questions if the repository cannot answer something critical.
Keep questions to a single, concise batch.
Legitimate questions:
- Undocumented team conventions (e.g., "Do you require changeset files for PRs?").
- Deployment or release expectations not captured in CI.
- Missing environment setup or external service dependencies known only to the team.
Do NOT ask about anything verifiable from the codebase or config files.
5. Structuring & Updating AGENTS.md
Updating an Existing File
- Improve in-place: Never blow away an existing
AGENTS.md blindly.
- Preserve verified, useful context.
- Delete stale, inaccurate, or fluffy claims.
- Reconcile contradictory guidance with executable config.
Standard Layout Recommendation
Keep it concise (< 150 lines for typical repos, < 250 lines for complex monorepos):
# AGENTS.md
## Overview & Architecture
[2-4 bullets on core system boundaries, entrypoints, and mental models not obvious from file names]
## Essential Commands
[Exact, verified commands: dev, build, lint, typecheck]
## Testing & Verification
[How to run single test, test suites, integration prerequisites, snapshot commands]
## Toolchain Quirks & Codegen
[Generated files, build artifacts, required command ordering, migration workflows]
## Non-Standard Conventions
[Specific deviations from framework norms, commit patterns, or strict restrictions]
See references/agents-md-template.md for tailored templates across minimal, standard, and monorepo codebases.
See references/agent-rules-checklist.md for the pre-commit review checklist.
1---2name: agents-guidance3description: Expert guidelines for auditing, creating, and updating high-signal AGENTS.md files, repository instructions, and agent rules. Use when asked to generate or update AGENTS.md, audit repo instructions, establish durable project guidelines for AI coding agents, or configure repository guidance for OpenCode, Claude Code, Cursor, and Codex.4---56# AGENTS Guidance Skill78This skill provides a rigorous methodology for creating, auditing, and maintaining `AGENTS.md` and repository instruction files.910The primary objective of `AGENTS.md` is to serve as a **compact, durable instruction file** that helps AI coding sessions avoid mistakes and ramp up immediately without wasting context.1112---1314## Core Guiding Principle1516> **The Litmus Test:**17> Every line must answer: *"Would an agent likely miss or guess this wrong without help?"*18> If the answer is no, **leave it out**.1920Good `AGENTS.md` content is hard-earned context that typically requires reading multiple files to infer.2122---2324## 1. Investigation Protocol2526Do not make assumptions or write speculative guidance. Follow this prioritized order of investigation:2728### Step 1: Executable Sources of Truth (Highest Value)291. **Root manifests & configs**: `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, `build.gradle`, etc.302. **Workspace & lockfiles**: `pnpm-workspace.yaml`, `lerna.json`, `uv.lock`, `pnpm-lock.yaml`, etc.313. **Build, test, lint, format, typecheck, & codegen configs**:32 - `tsconfig.json`, `eslint.config.*`, `.prettierrc`, `ruff.toml`, `Makefile`, `Justfile`, `CMakeLists.txt`334. **CI workflows & Task Runners**:34 - `.github/workflows/`, `.gitlab-ci.yml`, pre-commit configs (`.pre-commit-config.yaml`).355. **Existing instructions & agent configs**:36 - `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, `.cursorrules`, `.github/copilot-instructions.md`, `opencode.json`.3738### Step 2: Architecture & Entrypoint Inspection39If architecture remains unclear after reading configs:40- Inspect a small set of representative entrypoints (e.g. `main.*`, `index.*`, server bootstrap, router definitions).41- Trace real package boundaries and execution flow.42- Prefer files that explain system wiring over leaf implementation files.4344### Step 3: Subagent Delegation (When Available)45If subagent capabilities (e.g., `invoke_subagent`, `research` subagents, or parallel task delegates) are available in the agent runtime:46- **Delegate Broad Exploration**: Use subagents to concurrently investigate separate packages, services, or documentation directories without cluttering the primary context window.47- **Targeted Research Prompts**: Task subagents with extracting specific, high-signal facts (e.g., *"Find the exact command to run a single unit test and list any local services required"*).48- **Consolidate & Verify**: Use subagent outputs as candidate findings, verify them against root manifests, and synthesize the final compact instruction set.4950### Step 4: Executable vs. Prose Conflicts51- **Always trust executable configs and scripts over prose documentation.**52- If `README.md` claims `npm test` works, but `package.json` specifies `pnpm test:unit` with specific flags, record the executable command. Only keep facts you can verify.5354---5556## 2. What to Extract (High-Signal Facts)5758Focus strictly on facts that change how an agent operates:59601. **Exact Developer Commands**:61 - Non-obvious build, run, and dev commands.62 - Exact command to run a **single test**, a single package, or a focused verification step.63 - Required sequence if order matters (e.g., `codegen -> typecheck -> test:unit`).64652. **Monorepo & Package Boundaries**:66 - Workspace package ownership, internal dependency relationships, and boundary rules.67 - Core app vs. shared library entrypoints.68693. **Toolchain & Framework Quirks**:70 - Required codegen steps (`prisma generate`, `proto-gen`, `graphql-codegen`).71 - Database migrations or local seed flows.72 - Generated files that should never be edited directly.73 - Special environment loading requirements or mandatory runtime flags.74754. **Testing Quirks**:76 - Required local services (Docker, emulator, Redis).77 - Snapshot update commands and fixture conventions.78 - Suites that are flaky, slow, or require external credentials.79805. **Repo-Specific Conventions**:81 - Conventions that intentionally deviate from standard language or framework defaults.82 - Git branch/commit constraints (e.g., conventional commits, linear history).8384---8586## 3. What to Exclude (Strict Filtering)8788To prevent prompt bloat and context contamination, **exclude**:8990- ❌ **Generic software advice**: e.g., "Write clean code", "Handle errors gracefully", "Use descriptive names".91- ❌ **Long tutorials & file listings**: Avoid exhaustive file tree listings (agents have search tools).92- ❌ **Obvious language/framework defaults**: Standard Python PEP8 or standard Go idioms that tools already format.93- ❌ **Speculative or unverified claims**: Anything not substantiated by config, scripts, or user confirmation.94- ❌ **Redundant documentation**: Content that belongs in docs, unless an agent would actively fail without it.9596*When in doubt, omit.*9798---99100## 4. Asking Questions101102Only ask the user questions if the repository cannot answer something critical.103Keep questions to a single, concise batch.104105**Legitimate questions:**106- Undocumented team conventions (e.g., "Do you require changeset files for PRs?").107- Deployment or release expectations not captured in CI.108- Missing environment setup or external service dependencies known only to the team.109110**Do NOT ask** about anything verifiable from the codebase or config files.111112---113114## 5. Structuring & Updating `AGENTS.md`115116### Updating an Existing File117- **Improve in-place**: Never blow away an existing `AGENTS.md` blindly.118- Preserve verified, useful context.119- Delete stale, inaccurate, or fluffy claims.120- Reconcile contradictory guidance with executable config.121122### Standard Layout Recommendation123Keep it concise (< 150 lines for typical repos, < 250 lines for complex monorepos):124125```markdown126# AGENTS.md127128## Overview & Architecture129[2-4 bullets on core system boundaries, entrypoints, and mental models not obvious from file names]130131## Essential Commands132[Exact, verified commands: dev, build, lint, typecheck]133134## Testing & Verification135[How to run single test, test suites, integration prerequisites, snapshot commands]136137## Toolchain Quirks & Codegen138[Generated files, build artifacts, required command ordering, migration workflows]139140## Non-Standard Conventions141[Specific deviations from framework norms, commit patterns, or strict restrictions]142```143144See [references/agents-md-template.md](references/agents-md-template.md) for tailored templates across minimal, standard, and monorepo codebases.145See [references/agent-rules-checklist.md](references/agent-rules-checklist.md) for the pre-commit review checklist.