nextjs-best-practices

Codify server and client component guidelines for Next.js App Router projects.

Updated Jan 12, 2026
One-click install
npx skills add https://github.com/BenWork17/VeXeViet --skill nextjs-best-practices-benwork17
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/BenWork17/VeXeViet/tree/main/.agent/skills/nextjs-best-practices
Command: npx skills add https://github.com/BenWork17/VeXeViet --skill nextjs-best-practices-benwork17

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Architecting Next.js App Router apps can be tricky due to the distinction between server and client components, data fetching, and routing patterns. This guide provides clear rules to decide where to render, how to fetch data, and how to organize routes for maintainability and performance.

Core Features & Use Cases

  • Server vs Client Component guidance to optimize rendering and interactivity.
  • Data fetching strategies including static, ISR, and no-store for different load scenarios.
  • Routing conventions covering page.tsx, layout.tsx, loading.tsx, error.tsx, and not-found.tsx to improve UX and resilience.
  • Use Case: apply these patterns to a new Next.js project to maximize performance and developer productivity.

Quick Start

Install or upgrade a Next.js project to use App Router patterns, then annotate components with 'use client' only where necessary and adopt the recommended data-fetching strategies, route file conventions, and component boundaries for predictable behavior.

Frequently Asked Questions about nextjs-best-practices

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

FAQPage Schema
When should I use 'use client' in Next.js App Router?

Use 'use client' in Next.js App Router only when a component requires interactivity, state, or browser APIs. Apply this boundary to optimize rendering and keep server components as the default for predictable performance.

How do I choose between static, ISR, and no-store data fetching in Next.js?

Choose Next.js data fetching strategies based on load requirements: static for build-time data, ISR for periodic revalidation, and no-store for real-time dynamic content. Adopting the appropriate pattern ensures optimal performance across different rendering scenarios.

What Next.js App Router file conventions improve application resilience?

Next.js App Router uses route file conventions like page.tsx, layout.tsx, loading.tsx, error.tsx, and not-found.tsx to structure routes. Organizing routes with these files improves user experience and application resilience during loading or failure states.

How to organize routing patterns across layouts and pages in Next.js?

Organize Next.js routing patterns by applying route file conventions across layouts and pages. Structure your project using layout.tsx for shared UI and page.tsx for route-specific content to ensure maintainability and consistent rendering boundaries.

Does this Next.js App Router guide apply to my existing Pages Router project?

This guide specifically targets Next.js projects using the App Router. It clarifies architecture decisions for server components, data fetching, and routing conventions unique to the App Router paradigm, rather than the older Pages Router.