The Problem Every Next.js Dev Hits With AI
What Is AGENTS.md? (And Why It’s Trending)
- Next.js bundles version-matched docs inside the next package.
- AGENTS.md points agents at those docs before they generate code.
- Vercel’s agent evals showed always-on AGENTS.md context beating skill-based / on-demand doc lookup agents often don’t know when they should search, so a permanent rule wins.
Catchy Mental Model
If you’ve already written about not trusting AI blindly, this is the repo-level half of that story: don’t just review suggestions constrain the context so fewer bad suggestions show up.
How to Add AGENTS.md to a Next.js Repo
New projects
Existing projects
AGENTS.md Alone Isn’t Enough: Add Project Rules
- Extra sections in AGENTS.md (outside the managed block)
- Cursor rules / .agents / skill files your team already uses
- Short “do / don’t” lists for blog MDX, API routes, and env vars
What to put in project rules (high leverage)
- Stack truth: “We use App Router, Once UI (Column / Row), no Tailwind utility soup.”
- Boundaries: “Don’t commit secrets. Don’t invent API routes that bypass existing /api/* handlers.”
- Review habit: “Prefer small diffs. Explain tradeoffs when changing caching or auth.”
- Content conventions: “Blog posts live in src/app/blog/posts/*.mdx with publishedAt, summary, tag.”
A Practical Workflow That Works
- Open the task with a clear goal (“Add CTA to work MDX,” not “improve the site”).
- Rely on AGENTS.md so Next.js API choices come from bundled docs.
- Rely on project rules so UI and structure match your portfolio.
- Review like production code same habit as in my post on not trusting AI assistants blindly: read it, lint it, run it, understand it.
SEO-Friendly Takeaways (For Readers and Crawlers)
- AGENTS.md = root instructions for AI coding agents in a Next.js (or any) repo.
- Next.js ships version-matched docs under node_modules/next/dist/docs/.
- Point agents there before they write Next.js code.
- Keep custom project rules outside managed Next.js blocks.
- Pair with Cursor/Claude rules for design system and architecture.
- Still review every change rules improve odds, they don’t replace ownership.
Common Mistakes
- Empty AGENTS.md “be careful” without pointing at docs does almost nothing.
- Only global Cursor rules great for style; weak for version-accurate Next.js APIs.
- Editing inside the managed block Next.js may overwrite your custom notes on upsert.
- Huge rule dumps agents lose the signal; keep rules scannable.
- Ignoring upgrades after bumping next, re-check that agents still read the new bundled docs.

