What to put in an AGENTS.md for Next.js
Agents learned Next.js from older versions, so the most useful lines say which version and router you use and what changed. Since 16.3, next dev writes a block into AGENTS.md that points agents at the docs bundled in node_modules/next/dist/docs/; keep it, and add your own rules around it.
Which commands should it list?
next devdev server; Turbopack by default since 16next buildproduction build; no longer runs the linternext typegen && tsc --noEmittype check without a full buildeslint .lint with ESLint:next lintwas removed in 16biome check .or Biome; name the one you run
Write them as your repo runs them, with its package manager and flags, plus how to run one test.
What layout should it explain?
- App Router (
app/) or Pages Router (pages/), and which one new routes go in. - Which files are Client Components: everything a
"use client"file imports ships to the browser. - In a monorepo, which package holds the Next.js app, and where its own AGENTS.md is.
What do agents get wrong?
params,searchParams,cookies()andheaders()are async in 16; synchronous access is gone.middleware.tsis nowproxy.ts, andproxydoesn't support the edge runtime.- Only
NEXT_PUBLIC_variables reach the browser, inlined at build time;.env*.localstays out of git. revalidateTagneeds a second argument, acacheLifeprofile.
From the official docs: nextjs.org/ai-agents · nextjs.org/next · nextjs.org/version-16 · nextjs.org/environment-variables . The rest of the file is the same for any project: what goes in an AGENTS.md.
Next.js repos with an AGENTS.md or CLAUDE.md (8)
Built on Next.js; 8 pass the AGENTS.md check in full. vercel/next.js has one too, for contributors to Next.js itself.
| Repo | File | Length | Language |
|---|---|---|---|
| supabase/supabase | AGENTS.md | 6,972 chars | |
| cline/cline | AGENTS.md | 5,432 chars | |
| calcom/cal.diy | AGENTS.md | 9,222 chars | |
| payloadcms/payload | AGENTS.md | 22,724 chars | |
| simstudioai/sim | AGENTS.md | 23,351 chars | |
| TheOrcDev/8bitcn-ui | AGENTS.md | 9,197 chars | |
| hsnice16/agent-friendly-code(this site's own repo) | AGENTS.md | 13,340 chars | |
| Significant-Gravitas/AutoGPT | AGENTS.md | 12,045 chars |
More examples: FastAPI · Django · Rails · all examples