Next.js Best Practices

Use this skill when

Use for Next.js App Router work: pages/layouts/loading/error files, React Server Component boundaries, route handlers, async params/searchParams/cookies/headers, metadata, images/fonts, Suspense, bundling, or hydration/build errors.

Workflow

  1. Identify which Next.js surface is changing: route tree, component boundary, API route, runtime, asset/metadata, or build config.
  2. Read only the matching reference file(s) below; avoid loading unrelated topics.
  3. Keep pages thin and prefer this repo's API/OpenAPI and lib helper boundaries.
  4. Run the relevant Next.js checks (bun run lint, bun run typecheck, bun run build) or record the local toolchain blocker.

Skill graph

Read references/graph.md for routing. Related skills: setup-product, add-api-endpoint, better-auth-best-practices, vercel-deployment, testing-infra, next-cache-components, next-upgrade.

References

Scripts

See scripts/README.md. Run the inspector before broad Next.js refactors.

Assets

See assets/README.md for checklists and evals.