next-best-practices

Review Next.js code against modern best practices and anti-patterns.

1|Updated Sep 25, 2025
One-click install
npx skills add https://github.com/arroschaves/brandaocontador-site --skill next-best-practices-arroschaves
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/arroschaves/brandaocontador-site/tree/main/.agent/skills/vercel-next-best-practices
Command: npx skills add https://github.com/arroschaves/brandaocontador-site --skill next-best-practices-arroschaves

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write cleaner, more efficient, and maintainable Next.js applications by enforcing best practices and identifying common anti-patterns.

Core Features & Use Cases

  • File Conventions: Understand and apply Next.js routing and file structure rules.
  • RSC Boundaries: Detect and prevent invalid patterns when passing data between Server and Client Components.
  • Data Patterns: Choose the optimal data fetching strategy (Server Components, Server Actions, Route Handlers).
  • Optimization: Ensure proper image, font, and script optimization.
  • Error Handling: Implement robust error handling and boundary strategies.
  • Use Case: A developer is unsure about the correct way to fetch data in a new Next.js 15+ application. This Skill provides clear guidance on using async params, cookies(), headers(), and avoiding data waterfalls.

Quick Start

Review the best practices for handling data fetching in Next.js.

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 Server Components without creating waterfalls?

To implement data fetching in Next.js, utilize Server Components, Server Actions, or Route Handlers based on your mutation needs. This Skill outlines how to choose the optimal strategy, ensuring you handle async params, cookies(), and headers() correctly for efficient data loading.

How do you manage React Server Component boundaries when passing data to Client Components in Next.js?

Managing React Server Component (RSC) boundaries requires passing only serializable props to Client Components. This guidance helps detect and prevent invalid patterns when crossing server and client boundaries, ensuring data is passed safely without breaking the component tree.

How do I optimize images and fonts for web performance in a Next.js application?

Optimizing images and fonts in Next.js involves using the built-in optimization APIs to automatically serve properly sized assets. Following these Next.js best practices ensures improved web performance, reduced layout shift, and maintainable asset delivery across your application.

When should I use Route Handlers instead of Server Actions for Next.js data patterns?

Route Handlers should be used instead of Server Actions when you need to expose HTTP endpoints for webhooks or external API consumption. This Skill provides clear guidance on choosing the optimal data strategy between Server Components, Server Actions, and Route Handlers.

How does error handling and runtime selection work in Next.js App Router?

Error handling in Next.js involves implementing robust error boundaries to catch route segment failures. Runtime selection works by specifying Node.js or Edge directives in your code, ensuring you adhere to modern Next.js development standards for maintainability.