next-best-practices

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

1|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/salafidurus/salafi-audios --skill next-best-practices-salafidurus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/salafidurus/salafi-audios/tree/main/apps/web/.opencode/skills/next-best-practices
Command: npx skills add https://github.com/salafidurus/salafi-audios --skill next-best-practices-salafidurus

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers adhere to recommended patterns and avoid common pitfalls when building applications with Next.js, ensuring robust, performant, and maintainable code.

Core Features & Use Cases

  • Code Quality: Enforces file conventions, RSC boundaries, and data fetching patterns.
  • Performance: Guides on image/font optimization, bundling, and runtime selection.
  • Error Handling: Provides strategies for robust error management and debugging.
  • Use Case: A developer is unsure about the correct way to handle data fetching in a new Next.js feature. They consult this Skill to understand Server Components vs. Server Actions vs. Route Handlers and implement the most efficient pattern.

Quick Start

Review the Next.js best practices for file conventions and RSC boundaries.

Frequently Asked Questions about next-best-practices

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

FAQPage Schema
What is the best way to handle data fetching in Next.js Server Components?

Next.js data fetching in Server Components should leverage async/await directly within the component to retrieve data before rendering, ensuring optimal performance by executing requests on the server and reducing client-side JavaScript bundles.

How do I choose between Server Components, Server Actions, and Route Handlers?

Choose Next.js Server Components for direct data fetching and rendering, Server Actions for form mutations and data modifications, and Route Handlers for standalone API endpoints processing HTTP requests like webhooks.

How do I manage errors and metadata in Next.js App Router applications?

Next.js error management utilizes dedicated error.tsx boundaries to gracefully catch runtime exceptions, while metadata handling uses the exported Metadata API to dynamically generate SEO tags and HTML head elements per route.

Can I optimize images and fonts automatically in Next.js without external configuration?

Next.js automatically optimizes images and fonts through its built-in components, serving responsive formats like WebP and self-hosting fonts to prevent layout shifts and eliminate external network requests.

What are the common pitfalls with React Server Component boundaries in Next.js?

Common Next.js RSC boundary pitfalls include passing non-serializable data across boundaries and misusing client hooks in server components, which disrupts bundling strategies and breaks the intended server-side execution model.

Do I need specific file conventions for routing and error handling in Next.js?

Next.js requires strict file conventions like page.tsx for routing UI, layout.tsx for shared structure, and error.tsx for error handling, establishing maintainable application architecture and predictable rendering boundaries.