next-best-practices

Guide Next.js App Router development with file conventions and RSC boundaries.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/hiroto0701/dotfiles --skill next-best-practices-hiroto0701
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/hiroto0701/dotfiles/tree/main/private_dot_claude/skills/next-best-practices
Command: npx skills add https://github.com/hiroto0701/dotfiles --skill next-best-practices-hiroto0701

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill ensures your Next.js applications are built with optimal performance, maintainability, and adherence to the latest framework conventions, preventing common pitfalls and improving code quality.

Core Features & Use Cases

  • File Conventions: Understand and apply correct project structure, routing, and special file usage.
  • RSC Boundaries: Detect and fix invalid React Server Component patterns and data flow issues.
  • Data Fetching: Implement efficient and modern data fetching strategies using Server Components, Server Actions, and Route Handlers.
  • Optimization: Leverage built-in features for image, font, and script optimization.
  • Error Handling: Set up robust error boundaries and graceful error management.
  • Use Case: A developer is unsure about the correct way to fetch data in a new Next.js 15 project, or how to properly structure their components to avoid hydration errors. This Skill provides clear guidelines and examples for these scenarios.

Quick Start

Review the file conventions for Next.js App Router.

Frequently Asked Questions about next-best-practices

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

FAQPage Schema
What's the best way to fetch data in Next.js App Router using Server Components?

Next.js App Router best practices for data fetching involve making requests directly inside React Server Components to leverage server-side execution. Use Server Actions for mutations and Route Handlers for API endpoints, ensuring data flows correctly across RSC boundaries without hydration errors.

How do I fix hydration errors caused by invalid React Server Component boundaries?

Hydration errors from invalid React Server Component boundaries are fixed by correctly structuring your component tree and data flow. Apply Next.js App Router file conventions and wrap asynchronous components in Suspense boundaries to manage loading states and prevent client-server markup mismatches.

How do I optimize images, fonts, and scripts in a Next.js application?

Optimize images, fonts, and scripts in Next.js by utilizing the framework's built-in optimization features. Apply App Router best practices to automatically handle asset bundling, script loading strategies, and font optimization, resulting in improved Core Web Vitals and application performance.

When do I need to use parallel and intercepting routes in Next.js?

Parallel and intercepting routes in Next.js are needed when building advanced UI patterns like modals that load within the current layout context. They allow rendering multiple routes simultaneously and intercepting navigation to display content without a full page transition.

How do I set up error handling and metadata generation in Next.js App Router?

Error handling and metadata generation in Next.js App Router are set up by defining error boundaries for graceful runtime management and exporting metadata objects from route files. This ensures robust error recovery and dynamic SEO tag generation without blocking the rendering pipeline.