next-best-practices

Guide Next.js development with best practices for file conventions and data patterns.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/songyinggoh/renovation-agent-monorepo --skill next-best-practices-songyinggoh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/songyinggoh/renovation-agent-monorepo/tree/main/.claude/skills/next-best-practices
Command: npx skills add https://github.com/songyinggoh/renovation-agent-monorepo --skill next-best-practices-songyinggoh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on Next.js best practices, helping developers write cleaner, more efficient, and maintainable code, and avoid common pitfalls.

Core Features & Use Cases

  • File Conventions: Understand project structure, route segments, and special files.
  • RSC Boundaries: Detect and prevent 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: Learn about image, font, and script optimization.
  • Use Case: A developer is unsure about the correct way to fetch data in a new Next.js 15+ application. This Skill guides them on using Server Components for reads and Server Actions for mutations, preventing common waterfalls and performance issues.

Quick Start

Review the file conventions for organizing your Next.js project structure.

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 fetch data in Next.js App Router applications?

For Next.js App Router, use React Server Components for data reads and Server Actions for mutations to prevent waterfall requests and improve performance.

How do I organize project structure and route segments in Next.js?

Organize your Next.js project structure by following file conventions for route segments and special files to properly define routing and layouts within the App Router.

When do I need error.tsx versus global-error.tsx in Next.js?

You need error.tsx for route-level error handling and global-error.tsx for application-wide error boundaries in Next.js to implement robust error recovery patterns.

Does Next.js App Router support parallel and intercepting routes?

Next.js App Router supports parallel and intercepting routes, allowing you to render multiple route segments simultaneously and intercept navigation for advanced routing patterns.

How do I optimize images and fonts in Next.js?

Optimize images and fonts in Next.js by leveraging built-in optimization features for automatic resizing, responsive loading, and font preloading to improve web performance.

Why does my Next.js application throw a React Server Component boundary error?

React Server Component boundary errors occur when invalid patterns are used, such as passing non-serializable props or using client-only hooks in server components.