V

next-best-practices

by vercel-labs

next-best-practices is a practical Next.js skill for App Router work, covering file conventions, RSC boundaries, async APIs, data patterns, route handlers, bundling, and error handling.

Stars784
Favorites0
Comments0
AddedMar 29, 2026
CategoryFrontend Development
Install Command
npx skills add https://github.com/vercel-labs/next-skills --skill next-best-practices
Curation Score

This skill scores 78/100, which makes it a solid directory listing candidate for agents working on Next.js App Router code. It gives broad, evidence-backed best-practice guidance with concrete examples across many common problem areas, so an agent can often apply it during code writing or review with less guesswork than a generic prompt. The score stops short of a stronger recommendation because the repository is mostly a documentation bundle without explicit trigger rules, install guidance, or a step-by-step operational workflow.

78/100
Strengths
  • Broad practical coverage across real Next.js concerns such as file conventions, RSC boundaries, async APIs, data patterns, bundling, and error handling.
  • Concrete code examples and specific gotchas improve agent leverage, including async `params`/`searchParams`, `cookies()`/`headers()`, dynamic import for client-only packages, and redirect/notFound error-handling pitfalls.
  • Well-structured hub-and-spoke organization in `SKILL.md` links to focused topic files, making the material easy to scan and selectively apply during review or implementation.
Cautions
  • `user-invocable: false` and the lack of explicit trigger criteria may make automatic activation less predictable for some agents.
  • The skill is reference-heavy rather than workflow-heavy: there is no install command, no companion scripts/rules, and limited procedural guidance on when to choose one recommendation over another beyond a few sections like `data-patterns.md`.
Overview

Overview of next-best-practices skill

What next-best-practices actually helps with

The next-best-practices skill is a compact operational guide for writing and reviewing modern Next.js code, especially in App Router projects. It focuses on the mistakes teams repeatedly make in real codebases: wrong Server/Client boundaries, outdated async API usage in Next.js 15+, weak data-fetching choices, route handler misuse, file-convention errors, and bundling problems with browser-only packages.

Best fit readers and teams

This skill is most useful for:

  • developers shipping or refactoring App Router code
  • reviewers who need a reliable Next.js checklist
  • AI-assisted coding workflows that need stronger defaults than a generic “write Next.js code” prompt
  • teams moving across Next.js 15 and 16 changes

If you are debugging why code compiles but behaves oddly at runtime, next-best-practices for Frontend Development is especially valuable because it encodes practical boundary and routing rules, not just style preferences.

The real job-to-be-done

Most users do not need a broad Next.js tutorial. They need the model or reviewer to choose the right pattern quickly:

  • direct server fetch vs Route Handler
  • Server Action vs client mutation flow
  • Node vs Edge runtime
  • page.tsx / layout.tsx / route.ts placement
  • when 'use client' is required
  • how to avoid invalid async patterns after Next.js 15

That makes the next-best-practices skill more useful as a coding and code-review aid than as a learning resource alone.

What differentiates this skill

The strongest differentiator is specificity. Instead of generic “optimize performance” advice, it points to concrete Next.js rules and examples across focused files such as async-patterns.md, data-patterns.md, rsc-boundaries.md, route-handlers.md, and bundling.md.

A second differentiator is version-relevant guidance. The repository includes updated patterns like async params, async searchParams, and async cookies() / headers(), which are easy to miss if your mental model is based on older Next.js versions.

What this skill does not try to do

next-best-practices is not a full framework course, starter template, or production architecture blueprint. It will help an agent make better implementation choices inside an existing Next.js workflow, but it will not replace decisions about auth, database design, deployment, design systems, or product-specific conventions.

How to Use next-best-practices skill

next-best-practices install context

Install it from the vercel-labs/next-skills repository:

npx skills add https://github.com/vercel-labs/next-skills --skill next-best-practices

This skill is best added when your assistant is already helping with a Next.js codebase, not as a standalone package you run directly. It is guidance the agent applies while generating, reviewing, or refactoring code.

How next-best-practices is invoked in practice

The repository marks this skill as not directly user-invocable, so in practice you use it by giving your AI agent a concrete Next.js task. Good examples:

  • “Refactor this page to follow App Router best practices.”
  • “Review these files for RSC boundary mistakes.”
  • “Convert outdated Next.js patterns to Next.js 15+ async APIs.”
  • “Choose between Server Component fetch, Server Action, and Route Handler for this feature.”

The more your request sounds like a real implementation or review task, the more naturally the agent can apply next-best-practices usage.

Inputs that materially improve output

Provide:

  • your Next.js version if known
  • whether you use App Router or Pages Router
  • target files or code snippets
  • whether the code must run on Node or Edge
  • whether the task is read-heavy, mutation-heavy, or API-facing
  • any current error messages

Without that context, the agent may still produce valid code, but it may choose the wrong runtime, overuse Route Handlers, or place interactivity on the wrong side of the RSC boundary.

Turn a rough goal into a strong prompt

Weak prompt:

  • “Build a blog page in Next.js.”

Stronger prompt:

  • “Using the next-best-practices skill, build an App Router blog post page for Next.js 15. The slug comes from dynamic route params, metadata should be generated from the post title, reads should happen in a Server Component, and interactive comments should stay client-side. Explain file placement and any required async typing.”

Why this is better:

  • it signals version-specific async rules
  • it separates server reads from client interactivity
  • it asks for file conventions, not just component code
  • it reduces the chance of outdated patterns

Best repository files to read first

Start here:

  1. SKILL.md
  2. file-conventions.md
  3. data-patterns.md
  4. rsc-boundaries.md
  5. async-patterns.md

Then branch by problem type:

  • bundling issues: bundling.md
  • server/client directive confusion: directives.md
  • runtime choices: runtime-selection.md
  • route API design: route-handlers.md
  • recovery and boundary behavior: error-handling.md
  • development debugging: debug-tricks.md

This reading order is faster than skimming the full tree because it maps directly to the decisions that block shipping.

Practical workflow for next-best-practices usage

A high-signal workflow looks like this:

  1. Define the feature in terms of reads, mutations, and routes.
  2. Identify which parts must be Server Components and which must be Client Components.
  3. Check whether any Next.js 15+ async APIs are involved.
  4. Confirm file placement using file-conventions.md.
  5. Add error/loading behavior where route segments need it.
  6. Check bundling and runtime assumptions before importing third-party libraries.
  7. Only introduce Route Handlers if you truly need external API access or non-UI clients.

This is where the next-best-practices guide beats a generic prompt: it helps you avoid unnecessary abstraction layers.

What the skill is strongest at

The skill is strongest when you need a decision, not just syntax:

  • where data should be fetched
  • whether code belongs in a Server Component
  • whether a package needs a client wrapper or dynamic(..., { ssr: false })
  • whether a Route Handler is justified
  • how to migrate old synchronous assumptions to Next.js 15+ async APIs

It is less differentiated for purely cosmetic component authoring.

Common implementation decisions it helps settle

Use next-best-practices for Frontend Development when debating:

  • direct DB or API fetch in a Server Component vs internal API route
  • Server Action for form mutations vs client-side fetch
  • error.tsx vs global-error.tsx
  • Node runtime by default vs Edge only for specific needs
  • 'use client' because of hooks/browser APIs vs unnecessary client expansion

These choices affect performance, bundle size, and maintainability more than formatting ever will.

Practical warnings before adoption

A few easy-to-miss constraints:

  • examples may assume App Router patterns, so do not blindly apply them to Pages Router work
  • Next.js 15+ async APIs can break older assumptions about params, searchParams, cookies(), and headers()
  • not every package is server-safe; bundling failures often come from importing browser-dependent code into Server Components
  • redirect() and notFound() have special behavior; bad try/catch structure can break expected navigation flow

These are adoption blockers worth checking before you trust generated code.

Debugging help that many users overlook

One useful part of next-best-practices usage is the dev-server debugging guidance in debug-tricks.md. For active Next.js development, the /_next/mcp endpoint can expose project metadata, routes, and current errors through MCP-compatible tooling. That matters when your agent needs live route discovery or source-mapped error context instead of guessing from static files.

next-best-practices skill FAQ

Is next-best-practices good for beginners?

Yes, if you already know basic React and are actively building in Next.js. It is not a beginner-first tutorial, but it is approachable because the files are organized by decision area rather than by abstract theory.

Is this skill only for App Router projects?

Mostly, that is where it is most useful. The file conventions, Server Components, directives, and data-pattern guidance are especially relevant to App Router. If your project is Pages Router-heavy, only parts of the next-best-practices skill will transfer directly.

How is this different from an ordinary Next.js prompt?

A normal prompt often produces plausible code with outdated or mismatched patterns. next-best-practices improves decision quality by grounding the agent in version-relevant rules like async route props, server/client boundaries, route conventions, and when not to create an API layer.

When should I not use next-best-practices?

Skip it if your task is mostly UI polish, CSS styling, or framework-agnostic React patterns. It also adds less value if your team already enforces strong internal Next.js conventions and only needs code generation, not implementation guidance.

Does next-best-practices install anything into my app?

No application runtime dependency is added by the skill itself. The next-best-practices install step adds guidance to your AI skill environment so the assistant can apply it while helping with your repository.

Can it help with migration work?

Yes. It is especially helpful for catching drift between older mental models and newer Next.js behavior, such as async request APIs and updated file/runtime conventions. Migration and refactor prompts are one of the best uses for this skill.

How to Improve next-best-practices skill

Give next-best-practices the architectural context first

Better outputs come from supplying:

  • current route structure
  • target file paths
  • whether the code must be static, dynamic, or mutation-capable
  • any external consumers like mobile apps or webhooks

This helps the agent choose between Server Components, Server Actions, and Route Handlers correctly instead of producing all three.

Show the boundary, not just the feature request

If your problem involves interactivity, state which parts must remain client-side. Example:

  • “The page shell and data fetch should stay server-rendered, but the filter bar needs hooks and URL updates.”

That single sentence improves next-best-practices usage because it clarifies where 'use client' belongs and prevents unnecessary client expansion.

Include version and runtime constraints

Say “Next.js 15 App Router on Node runtime” if that is your target. This avoids two common failures:

  • stale synchronous params patterns
  • premature Edge recommendations

The skill strongly favors Node by default unless your use case clearly benefits from Edge.

Ask for decision justification, not only code

A strong prompt pattern:

  • “Implement this, then explain why you chose Server Component fetch vs Route Handler.”

This exposes whether the agent is actually applying the next-best-practices guide or merely generating familiar-looking code. The explanation is often where bad assumptions become visible.

Common failure modes to watch for

Review first outputs for:

  • unnecessary internal API routes for simple reads
  • browser-only packages imported in Server Components
  • missing 'use client' on interactive components
  • 'use client' added too high in the tree
  • old synchronous typing for params or searchParams
  • navigation helpers wrapped in broad try/catch blocks

These are exactly the kinds of mistakes this skill is meant to reduce, but weak inputs can still let them through.

Improve output quality with file-targeted prompts

Instead of:

  • “Fix my Next.js app.”

Use:

  • “Review app/blog/[slug]/page.tsx, app/blog/[slug]/loading.tsx, and app/blog/[slug]/error.tsx with next-best-practices for file conventions, async params, and error boundary correctness.”

File-targeted prompts produce more actionable output because the skill content is organized around concrete framework surfaces.

Iterate after the first answer

After an initial draft, ask follow-ups like:

  • “Now remove any unnecessary client components.”
  • “Now optimize for fewer network round-trips.”
  • “Now check for bundling hazards with third-party libraries.”
  • “Now verify this against Next.js 15 async request APIs.”

This turns next-best-practices from a one-shot generator into a review loop, which is where it delivers the most value.

Use repo reading paths that match your issue

For better results, point the agent to a narrow source path:

  • routing issue: file-conventions.md, parallel-routes.md
  • invalid component boundary: rsc-boundaries.md, directives.md
  • data flow confusion: data-patterns.md, functions.md
  • unstable package imports: bundling.md
  • runtime or hosting concerns: runtime-selection.md, self-hosting.md

That is a practical way to improve next-best-practices skill outcomes without editing the skill itself.

Ratings & Reviews

No ratings yet
Share your review
Sign in to leave a rating and comment for this skill.
G
0/10000
Latest reviews
Saving...