next-best-practices

Guide Next.js development with file conventions, RSC boundaries, and data fetching patterns.

Updated Sep 22, 2025
One-click install
npx skills add https://github.com/Menschlichkeit-Osterreich/menschlichkeit-oesterreich-development --skill next-best-practices-menschlichkeit-osterreich
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/Menschlichkeit-Osterreich/menschlichkeit-oesterreich-development/tree/main/.agents/skills/next-best-practices
Command: npx skills add https://github.com/Menschlichkeit-Osterreich/menschlichkeit-oesterreich-development --skill next-best-practices-menschlichkeit-osterreich

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and best practices for developing with Next.js, ensuring efficient, maintainable, and performant web applications.

Core Features & Use Cases

  • File Conventions: Understand project structure and routing.
  • RSC Boundaries: Detect invalid React Server Component patterns.
  • Data Patterns: Choose the right data fetching strategy (Server Components, Server Actions, Route Handlers).
  • Error Handling: Implement robust error handling with error.tsx and global-error.tsx.
  • Optimization: Optimize images, fonts, and bundling.
  • Use Case: A developer is unsure about the correct way to fetch data in a new Next.js 14+ project and wants to ensure they are following the latest recommendations for performance and maintainability.

Quick Start

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

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?

Data fetching in Next.js Server Components should be done directly inside the component using async/await, while Server Actions and Route Handlers handle mutations and backend logic to ensure maintainable and performant web applications.

How do I handle errors in Next.js App Router projects?

Handle errors in Next.js App Router projects by implementing robust error handling strategies using `error.tsx` for route-level recovery and `global-error.tsx` to catch unhandled exceptions, ensuring comprehensive error management across your web application.

When do I need to use Server Actions instead of Route Handlers?

Use Server Actions for form mutations directly within React Server Components, whereas Route Handlers are needed to expose external API endpoints, allowing precise control over data patterns and RSC boundaries in Next.js.

How do I detect invalid React Server Component patterns in Next.js?

Detect invalid React Server Component patterns by understanding RSC boundaries, ensuring that client-side hooks and APIs are correctly isolated, and following Next.js file conventions to prevent invalid component structures.

What are the best practices for optimizing images and fonts in Next.js?

Best practices for optimizing images and fonts in Next.js involve using built-in components for automatic image optimization, properly configuring font loading, and optimizing bundling to reduce runtime overhead and improve web performance.

Does this Next.js guidance cover debugging techniques and runtime selection?

Yes, this Next.js guidance covers debugging techniques and runtime selection, detailing how to choose the appropriate runtime environment and implement effective debugging strategies for modern web development.