agentleFS
yaaabsyaaabs/nextjs-16-boilerplate/AGENTS.md

nextjs-16-boilerplate

AGENTS.md3 starsChanged 5 months agoMITView on GitHub

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ before writing any code. Heed deprecation notices. This file is the single source of truth for AI coding agents (Claude Code, Codex, Cursor, etc.). CLAUDE.md imports it. Read it fully before your first change in a session. A reusable, production-ready Next.js 16 (App Router) boilerplate. It gets cloned as the starting point for new apps, so…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository7 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the matching skill file before editing.

    line 82
  2. Distinctive:

    Verify with the right gate before reporting done.

    line 86
  3. Distinctive:

    Commit only intentional repo changes with a Conventional Commit message.

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md
<!-- BEGIN:nextjs-agent-rules -->

This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ before writing any code. Heed deprecation notices.

<!-- END:nextjs-agent-rules -->

Agent Guide — Next.js 16 Boilerplate

This file is the single source of truth for AI coding agents (Claude Code, Codex, Cursor, etc.). CLAUDE.md imports it. Read it fully before your first change in a session.

What this project is

A reusable, production-ready Next.js 16 (App Router) boilerplate. It gets cloned as the starting point for new apps, so every pattern here gets copied — keep it exemplary, minimal, and consistent. Robustness and scalability beat cleverness.

Stack

ConcernTool
FrameworkNext.js 16 (App Router, Turbopack, src/ dir, @/* → src/*)
LanguageTypeScript 5, strict mode
UIReact 19 + Tailwind CSS v4 + shadcn/ui (Radix, Nova preset)
Iconslucide-react
Validationzod
TestsJest 30 + React Testing Library (via next/jest)
QualityESLint 9 (flat config), Prettier, Husky, lint-staged
CommitsConventional Commits (commitlint, enforced by hook)

Commands

npm run dev           # dev server (Turbopack)
npm run lint          # ESLint CLI — `next lint` was REMOVED in Next 16, never use it
npm run lint:fix      # auto-fix lint issues
npm run type-check    # tsc --noEmit
npm run format        # prettier --write
npm run format:check  # prettier --check
npm run test          # jest (once) / npm run test:watch
npm run build         # quality gate: lint + type-check + test + next build
npx shadcn@latest add <component>   # add a UI primitive (never hand-roll one)

Pre-commit hook runs lint + type-check + test + format:check; commit-msg enforces Conventional Commits. A failing gate blocks the commit — run the gates yourself first.

Project structure

src/
├── app/                # Routes ONLY: page.tsx, layout.tsx, route.ts, globals.css
├── components/
│   └── ui/             # shadcn primitives — managed by CLI, do not hand-edit
├── components/*        # shared feature components composed from primitives
├── lib/                # pure utilities (cn()), zod schemas, clients — no React here
└── __tests__/          # tests (co-located *.test.tsx also fine)

Skills — read before the matching task

Detailed standards live in .claude/skills/. Claude Code loads them automatically; other agents (Codex, Cursor, ...) must read the relevant SKILL.md before starting:

SkillRead it when...
impeccable-intentstarting any non-trivial or ambiguous task
nextjs-qualitytouching routes, layouts, data fetching, framework APIs
ui-ux-pro-maxcreating/modifying any UI, page, component, or style
security-best-practiceshandling input, env vars, auth, APIs, dependencies
clean-codewriting or refactoring any TypeScript/React
evaluatefinishing — before committing or reporting done

Agent workflow

For the public, contributor-facing version of this process, see docs/AI_AGENT_WORKFLOW.md.

  1. Clarify intent before non-trivial work.
  2. Read the matching skill file before editing.
  3. For Next.js APIs, routes, layouts, or config, read the relevant Next.js 16 guide in node_modules/next/dist/docs/ before coding.
  4. Make the smallest correct change and avoid unrelated refactors.
  5. Verify with the right gate before reporting done.
  6. Commit only intentional repo changes with a Conventional Commit message.

Personal agent setup stays local. Do not commit Codex or Claude plugin caches, local MCP config, private memories, generated worktrees, or lockfile-only churn from unrelated install commands.

Non-negotiable rules (summary)

  1. Server Components by default; "use client" only at the leaves that need it.
  2. UI comes from shadcn/ui primitives + semantic design tokens (bg-background, text-muted-foreground...) — never raw palette classes, never hand-rolled buttons.
  3. Validate all external input with zod at every boundary.
  4. No any, no dead code, no console.log left behind.
  5. Secrets never reach the client — no NEXT_PUBLIC_ on private values; real env values only in .env.local; document new vars in .env.example.
  6. Small diffs — the smallest correct change; don't refactor beside the task.
  7. Verify before done — the four gates pass and the feature was actually exercised.
  8. Conventional Commit messages — feat: ..., fix(scope): ..., etc.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.