Generate AGENTS.md for AI agent navigation. Covers build/test commands, coding conventions, task routing, and codebase structure...
Standard operating procedure for generating AGENTS.md files optimized for AI agent consumption.
MUST complete before any other action:
ls -la at root, count top-level directoriespackages/, workspaces/, apps/, multiple package.jsonpackage.json, pyproject.toml, go.mod, Cargo.tomlComplexity thresholds:
| Indicator | Simple | Complex |
|---|---|---|
| Top-level dirs | ≤10 | >10 |
| Dependencies | ≤50 | >50 |
| Languages | 1 | 2+ |
| Monorepo patterns | None | Present |
Based on complexity:
Task tool with subagent_type: "explore"
Prompt: "Analyze repository structure, build systems, test commands, coding conventions.
Return structured summary for AI navigation AGENTS.md.
Thoroughness: [quick|medium|very thorough]"
MUST collect from repo:
npm run build, make, cargo build, etc.)convex codegen, prisma generate).cursor/rules/ directory.cursorrules file.github/copilot-instructions.mdStructure using XML tags:
## Repository Overview
[1-2 sentences: what this repo does]
<instructions>
## Build & Test
- Build: `exact command`
- Test: `exact command`
- Lint: `exact command`
- Typecheck: `exact command`
- Codegen: `exact command` (if applicable)
</instructions>
<rules>
## Process Constraints
- MUST NOT run long-running/blocking processes (dev servers, watch modes)
- Dev servers are USER's responsibility to run in background
- MUST use one-shot verification commands only
## Coding Conventions
- [Pattern observed in codebase]
- [Naming conventions]
- [File organization rules]
</rules>
<routing>
## Task Navigation
| Task | Entry Point | Key Files |
|------|-------------|-----------|
| Add feature | src/features/ | README in dir |
| Fix bug | src/ | Related test file |
</routing>
<context_hints>
## Context Allocation
- **Large/generated**: [files to skip or skim]
- **Legacy zones**: [directories with tech debt]
- **Critical configs**: [files that break everything]
</context_hints>
If running full workflow (not basic):
skill-creatorThe generated AGENTS.md MUST include a rule forbidding agents from running blocking processes.
This is not just about what commands to document - the AGENTS.md MUST explicitly instruct agents:
<rules>
## Process Constraints
- MUST NOT run long-running/blocking processes (dev servers, watch modes)
- Dev servers (`npm run dev`, `bun dev`, `convex dev`, etc.) are USER's responsibility
- User will run these in background and make them available to the agent
- MUST use one-shot commands for verification (build, lint, test, typecheck)
</rules>
Commands to document vs avoid:
| MUST NOT Document | Document Instead |
|---|---|
npm run dev |
npm run build |
bun run dev |
npm run lint |
npm start (if blocking) |
npm run typecheck |
convex dev |
convex codegen |
next dev |
next build |
vite / vite dev |
vite build |
tsc --watch |
tsc --noEmit |
jest --watch |
jest / npm test |
Good commands for AGENTS.md:
npm run build, make, cargo buildnpm run lint, eslint ., oxlinttsc --noEmit, pyrightnpm test, pytest, go test ./...convex codegen, prisma generate, graphql-codegenprettier --check ., cargo fmt --check