next-best-practices

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

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/dsgalkar/dnyaneshwar_portfolio --skill next-best-practices-dsgalkar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/dsgalkar/dnyaneshwar_portfolio/tree/main/.agents/plugins/vercel/skills/nextjs/upstream
Command: npx skills add https://github.com/dsgalkar/dnyaneshwar_portfolio --skill next-best-practices-dsgalkar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Next.js applications frequently suffer from subtle bugs and anti-patterns: invalid async client components, non-serializable props crossing server/client boundaries, hydration mismatches, data fetching waterfalls, and misconfigured images, fonts, and scripts. This Skill provides a structured rule set for writing and reviewing Next.js code correctly. ## Core Features & Use Cases - RSC Boundary Validation: Detects invalid patterns like async client components, non-serializable props (Date, Map, class instances), and incorrect Server Action usage. - Modern API Guidance: Covers Next.js 15+/16 async APIs (params, searchParams, cookies, headers), the middleware-to-proxy rename, and cache directives. - Performance & SEO Optimization: Rules for next/image, next/font, metadata generation, OG images, Suspense boundaries, and avoiding data waterfalls with Promise.all and preload patterns. - Use Case: When reviewing a pull request that fetches data sequentially in a Server Component and passes a Date object to a client component, apply this Skill to rewrite it with parallel fetching and serialized props. ## Quick Start Review my Next.js page component for best practice violations and fix any RSC boundary or data fetching issues.

Frequently Asked Questions about next-best-practices

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

FAQPage Schema
How do I fetch data in Next.js Server Components?

Fetch data directly in async Server Components using fetch or database calls without an API layer. Use Promise.all for parallel requests, wrap independent sections in Suspense for streaming, and apply the preload pattern with React cache() to avoid waterfalls.

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

Use Server Actions for mutations triggered from your UI like 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 does my Next.js client component fail when passed a Date object?

Props passed from Server to Client Components must be JSON-serializable, and Date objects silently become strings. Serialize dates with .toISOString() on the server, then reconstruct with new Date() inside the client component.

How do I fix hydration errors in Next.js?

Hydration errors come from browser-only APIs, dates rendered in different timezones, random values, or invalid HTML nesting. Fix them by rendering dynamic content only after mount with useEffect, using the useId hook, and correcting invalid tag nesting.

Does Next.js 16 still use middleware.ts?

Next.js 16 renames middleware.ts to proxy.ts with a proxy() export and proxyConfig object, keeping the same capabilities. Run npx @next/codemod@latest upgrade to migrate automatically from the middleware convention.

How do I deploy Next.js with Docker using standalone output?

Set output: 'standalone' in next.config.js to generate a minimal server.js with only production dependencies. Copy the standalone folder plus .next/static and public into your container, and configure a custom cache handler like Redis for multi-instance ISR.