What problem does it solve?
This Skill provides comprehensive guidelines and best practices for building Next.js applications, enhancing code quality, and optimizing performance.
Core Features & Use Cases
- File Conventions: Offers guidelines for organizing projects, understanding route structures, and managing special files.
- RSC Boundaries: Helps developers detect and prevent invalid patterns in Server/Client component interactions.
- Async Patterns: Explains Next.js 15+ async API changes and best practices for handling async operations.
- Error Handling: Describes how to handle errors gracefully in Next.js applications, including error boundaries and navigation API gotchas.
- Data Patterns: Provides a decision tree and patterns for data fetching, including Server Components, Server Actions, and Route Handlers.
- Route Handlers: Explains how to create API endpoints with
route.ts files and how to handle different HTTP methods.
- Bundling: Offers solutions for common bundling issues with third-party packages and provides insights into optimizing bundle size.
- Debugging: Suggests various debugging tricks for Next.js applications, including the MCP endpoint and rebuilding specific routes.
- Directives: Details React directives and Next.js-specific directives for controlling component behavior and caching.
- Hydration Errors: Diagnoses and fixes React hydration mismatch errors, including common causes and solutions.
- Image Optimization: Shows how to optimize images using
next/image and configure remote images.
- Metadata: Describes how to add SEO metadata to Next.js pages and use the Metadata API.
- Parallel & Intercepting Routes: Explains parallel routes and intercepting routes for creating modal patterns.
- Self-Hosting: Provides information on self-hosting Next.js, including Docker deployment, PM2 deployment, and cache handlers.
- Suspense Boundaries: Discusses the use of Suspense boundaries for client hooks that cause CSR bailout.
- Runtime Selection: Guides on choosing the appropriate runtime for Next.js applications.
- Scripts: Shows how to load third-party scripts in Next.js using
next/script and loading strategies.
- Provenance: Lists the provenance of the skill unit, including the source, commit, and license.
Quick Start
Use the next-best-practices skill to learn and apply best practices for your Next.js project.