1. cheat-sheets
  2. /agents md

AGENTS.md Template

Minimal sections every repo-level AGENTS.md should include. Adapt stack lines to your project.

Last reviewed: June 2026

Full guide: Project Rules · Comparison: Rules vs AGENTS.md vs Skills

Full template

Copy to repo root as AGENTS.md:

# Project instructions for AI agents

## Stack
- Next.js 15 App Router, React 19, TypeScript 5.7 strict
- Tailwind CSS 4
- Package manager: npm

## Commands
- Install: npm install
- Dev: npm run dev
- Lint: npm run lint
- Test: npm test
- Build: npm run build

## Conventions
- Match existing file structure and naming
- Minimal diffs — do not refactor unrelated code
- Named exports unless framework requires default

## Do not modify
- package-lock.json unless adding a dependency I requested
- CI workflow files unless the task requires it
- .env and secret files
- Generated migration files

## Verification
After code changes, run npm run lint and npm test.
Report failures with exact command output.

Section reference

SectionPurpose
StackFramework versions — stops App Router vs Pages mistakes
CommandsExact lint/test/build — agent runs correct verification
ConventionsStyle and scope — reduces drive-by refactors
Do not modifyProtected paths — migrations, lockfiles, CI
VerificationRequired gates before task is "done"

Optional sections

SectionWhen to add
ArchitectureMonorepo layout, service boundaries
AuthHow session checks work on API routes
TestingWhere tests live; coverage expectations
PR processBranch naming, commit format
LinksCONTRIBUTING.md, internal runbooks

Size limits

TargetReason
500–2,000 tokensLoaded every session
Procedural checklistsMove to Agent Skills
Path-specific rulesUse .cursor/rules/*.mdc with globs

Tool-specific mirrors

FileTool
AGENTS.mdCursor, Claude Code, generic agents
.github/copilot-instructions.mdGitHub Copilot
.cursor/rules/*.mdcCursor path-scoped rules

Keep stack/commands in sync across files — one source of truth in AGENTS.md; others reference or duplicate minimally.