next-best-practices

Applies Next.js best practices for file conventions, RSC boundaries, data patterns, and optimization.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/rub803030/examenprograma --skill next-best-practices-rub803030
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/rub803030/examenprograma/tree/main/EXAMEN_PROGRA_2-master/.agents/skills/next-best-practices
Command: npx skills add https://github.com/rub803030/examenprograma --skill next-best-practices-rub803030

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing and reviewing Next.js code requires keeping track of many evolving conventions—async APIs in Next.js 15+, Server/Client Component boundaries, middleware renames in v16, and correct data fetching patterns. This Skill provides a structured rulebook so AI-assisted code generation and review follows current Next.js best practices instead of outdated or invalid patterns. ## Core Features & Use Cases - RSC Boundary Validation: Detects invalid patterns like async Client Components and non-serializable props (Date, Map, class instances) passed across the Server/Client boundary. - Modern API Guidance: Covers Next.js 15+ async params, searchParams, cookies(), and headers(), plus the v16 middleware-to-proxy rename. - Data & Rendering Patterns: Guides choosing between Server Components, Server Actions, and Route Handlers, and avoiding data waterfalls with Promise.all, Suspense, and preload patterns. - Use Case: When asked to build a dynamic blog page, the Skill ensures params is typed as a Promise, metadata uses generateMetadata, images use next/image with proper sizes, and mutations use Server Actions instead of unnecessary API routes. ## Quick Start Review my Next.js page component and fix any violations of current Next.js best practices.

Frequently Asked Questions about next-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle async params and searchParams in Next.js 15?▼

Type params and searchParams as Promise<...> and await them inside async page or layout components. For synchronous client components, use React's use() hook to unwrap the promise. A codemod is available via npx @next/codemod@latest next-async-request-api.

When should I use Server Actions vs Route Handlers in Next.js?▼

Use Server Actions for mutations triggered from your UI, such as form submissions, since they offer type safety and progressive enhancement. Use Route Handlers for external webhooks, public REST APIs, and GET endpoints that need HTTP caching.

Why can't I pass a Date object to a Client Component?▼

Props crossing the Server/Client boundary must be JSON-serializable, and Date objects lose their methods during serialization. Convert dates with .toISOString() on the server and reconstruct them with new Date() inside the Client Component.

Why does my Next.js modal route 404 on refresh?▼

Parallel route slots like @modal require a default.tsx file that returns null. Without it, Next.js cannot determine what to render in the slot during hard navigation, causing a 404 on refresh.

Does Next.js middleware still work in version 16?▼

In Next.js 16, middleware.ts is renamed to proxy.ts with a proxy() export and proxyConfig object, but the capabilities remain the same. Run npx @next/codemod@latest upgrade to auto-rename existing files.

Why does useSearchParams cause my whole page to become client-rendered?▼

useSearchParams triggers a client-side rendering bailout in static routes unless wrapped in a Suspense boundary. Wrap the component using it in <Suspense> with a fallback to keep the rest of the page statically rendered.