nextjs-best-practices

Provide Next.js App Router guidelines for server components, data fetching, and routing.

Updated Feb 5, 2026
One-click install
npx skills add https://github.com/flybirdxx/RunningHub --skill nextjs-best-practices-flybirdxx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/flybirdxx/RunningHub/tree/main/.gemini/skills/nextjs-best-practices
Command: npx skills add https://github.com/flybirdxx/RunningHub --skill nextjs-best-practices-flybirdxx

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to Next.js App Router principles, helping developers understand server components, data fetching patterns, and routing principles to build efficient and scalable Next.js applications.

Core Features & Use Cases

  • Server vs Client Components: Offers a decision tree to choose the right component type based on the application's needs.
  • Data Fetching Patterns: Explains default, revalidate, and no-store patterns with examples.
  • Routing Principles: Details file conventions, route organization, and best practices for API routes.
  • Performance Principles: Discusses image optimization, bundle optimization, and metadata management.
  • Caching Strategy: Outlines cache layers and revalidation methods for efficient data handling.
  • Server Actions: Provides guidelines for using server actions in form submissions and data mutations.
  • Anti-Patterns: Identifies common mistakes and best practices for project structure.

Quick Start

Learn how to implement Next.js best practices by following the guidelines in this skill unit.

Frequently Asked Questions about nextjs-best-practices

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

FAQPage Schema
How do I choose between Server Components and Client Components in Next.js App Router?

Choosing between Server Components and Client Components in Next.js App Router requires analyzing your component's data and interactivity needs, using a decision tree to default to server components and only opting into client components when state or browser APIs are necessary.

What are the best data fetching patterns for Next.js App Router?

The best data fetching patterns for Next.js App Router include default caching, time-based revalidation, and no-store strategies, allowing you to optimize performance by selecting the appropriate fetch behavior for static or dynamic data requirements.

How do I use Server Actions for data mutations in Next.js?

Using Server Actions for data mutations in Next.js involves defining asynchronous functions that run securely on the server to handle form submissions and database updates without creating separate API endpoints.

What is the caching strategy for Next.js performance optimization?

The caching strategy for Next.js performance optimization involves leveraging multiple cache layers and revalidation methods to control data freshness, ensuring efficient data handling and reduced server load.

What are common anti-patterns and project structure mistakes in Next.js?

Common anti-patterns and project structure mistakes in Next.js include improper route organization and misusing file conventions, which can be avoided by following established best practices for API routes and component placement.

Do I need advanced Next.js knowledge to use App Router routing principles?

You need intermediate to advanced Next.js knowledge to effectively use App Router routing principles, as mastering file conventions, route organization, and performance optimization requires understanding underlying server and client boundaries.