next-best-practices

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

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

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.

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).
  • Optimization: Learn about image, font, and bundling optimizations.
  • Error Handling: Implement robust error handling with error.tsx and global-error.tsx.
  • Use Case: A developer starting a new Next.js project can use this Skill to ensure they are following recommended patterns from the outset, avoiding common pitfalls related to data fetching, component boundaries, and routing.

Quick Start

Review the Next.js best practices for file conventions and routing.

Frequently Asked Questions about next-best-practices

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

FAQPage Schema
How do I structure data fetching in Next.js React Server Components?

Data fetching in Next.js React Server Components should be structured by choosing the right pattern among Server Components, Server Actions, and Route Handlers to ensure cleaner and more maintainable code.

What is the best way to handle routing and file conventions in Next.js?

The best way to handle Next.js routing and file conventions is to understand project structure, route segments, special files, and advanced patterns like parallel and intercepting routes for optimal application architecture.

How do I implement error handling with error.tsx in Next.js?

Implement robust Next.js error handling by utilizing error.tsx and global-error.tsx files to catch unexpected issues and provide graceful fallbacks within your application's routing segments.

Why does my Next.js application throw hydration errors and how do I debug them?

Next.js hydration errors typically occur due to client-server markup mismatches and can be debugged using general debugging tricks and proper React Server Component boundary separation.

Can I optimize images, fonts, and script loading for self-hosted Next.js applications?

Yes, you can optimize self-hosted Next.js applications by applying built-in image, font, and bundling optimizations alongside proper script loading strategies to improve overall performance.

When do I need to use suspense boundaries in Next.js?

Suspense boundaries in Next.js are needed when streaming server-rendered content, allowing you to wrap components to handle loading states effectively while data fetching completes.