next-best-practices

Provide Next.js development guidelines covering file conventions, RSC patterns, and data fetching.

2|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/ylxai/hafiportrait-saas --skill next-best-practices-ylxai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/ylxai/hafiportrait-saas/tree/main/.agents/skills/next-best-practices
Command: npx skills add https://github.com/ylxai/hafiportrait-saas --skill next-best-practices-ylxai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides comprehensive guidelines and best practices for Next.js development, ensuring code quality, performance, and maintainability.

Core Features & Use Cases

  • File Conventions: Defines the project structure and file naming conventions for Next.js applications.
  • RSC Boundaries: Identifies and prevents common mistakes in React Server Components.
  • Async Patterns: Offers guidance on using Next.js 15+ async APIs and patterns.
  • Runtime Selection: Explains the use of Node.js and Edge runtime in Next.js.
  • Directives: Describes the usage of React and Next.js directives for server and client components.
  • Error Handling: Details error handling strategies in Next.js, including error boundaries and navigation APIs.
  • Data Patterns: Discusses best practices for data fetching and handling in Next.js.
  • Route Handlers: Explains how to create API endpoints with route.ts files.
  • Bundling: Covers common bundling issues and solutions in Next.js.
  • Hydration Errors: Diagnoses and fixes React hydration mismatch errors.
  • Suspense Boundaries: Identifies when and how to use Suspense boundaries in Next.js.
  • Parallel & Intercepting Routes: Describes the use of parallel and intercepting routes for modal patterns.
  • Self-Hosting: Provides instructions for self-hosting Next.js applications.
  • Debug Tricks: Offers debugging tips and tricks for Next.js applications.

Quick Start

Use the next-best-practices skill to learn about 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
What are the best practices for React Server Components in Next.js?

Next.js best practices for React Server Components (RSC) involve identifying and preventing common mistakes at the RSC boundaries. These guidelines ensure correct usage of server and client directives to maintain application performance and code quality.

How do I fix React hydration mismatch errors in Next.js?

To fix React hydration errors in Next.js, you need to diagnose rendering mismatches between server and client outputs. Following dedicated debugging techniques and best practices helps identify and resolve these specific hydration mismatches effectively.

When should I use parallel and intercepting routes in Next.js?

You should use parallel and intercepting routes in Next.js when implementing modal patterns. These routing conventions allow you to simultaneously render and intercept navigation to create advanced user interface modal interactions.

How do I create API endpoints with route handlers in Next.js?

You create API endpoints in Next.js by using route.ts files as route handlers. This pattern is a core best practice for handling server-side data fetching and managing backend API logic directly within your Next.js application structure.

What is the best way to optimize images and handle bundling in Next.js?

Next.js best practices for optimization involve utilizing built-in image optimization features and resolving common bundling issues. Following these guidelines ensures efficient asset loading, proper file conventions, and improved overall application performance.

Do I need prior Next.js knowledge to use these development guidelines?

Yes, these Next.js development guidelines require existing knowledge of Next.js concepts and syntax. They provide essential tips and best practices for file conventions, async patterns, and runtime selection rather than teaching the framework from scratch.