nextjs-best-practices

Apply best-practice patterns to Next.js App Router projects.

34|29|Updated Jul 14, 2025
One-click install
npx skills add https://github.com/adelpro/open-tarteel --skill nextjs-best-practices-adelpro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/adelpro/open-tarteel/tree/main/.agent/skills/nextjs-best-practices
Command: npx skills add https://github.com/adelpro/open-tarteel --skill nextjs-best-practices-adelpro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Next.js App Router projects often struggle with choosing between server and client components, data fetching strategies, and consistent routing patterns. They need clear guidance to maximize performance and maintainability.

Core Features & Use Cases

  • Server vs Client Components guidance with decision rules.
  • Data fetching patterns including ISR, caching, and server actions.
  • Routing conventions for layouts, routes, and error handling across App Router.

Quick Start

Follow these guidelines when starting a Next.js App Router project to establish a solid baseline of performance and maintainability.

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 and client components in Next.js App Router?

Use client components only for interactivity, state, and browser APIs. Server components handle data fetching and static markup to maximize Next.js App Router performance and reduce JavaScript bundle size.

What is the best way to fetch data in Next.js App Router?

The best data fetching pattern in Next.js App Router uses server components with built-in fetch extensions for caching and ISR. This leverages automatic request memoization and avoids client-side waterfall requests.

How do I handle routing and layouts in Next.js App Router?

Next.js App Router routing uses nested folder conventions for layouts, pages, and error boundaries. Shared UI persists in layout files, while route handlers expose API endpoints within the directory structure.

When should I use server actions instead of API route handlers?

Use server actions for direct form mutations and data updates without creating separate API endpoints. Route handlers are better for external webhook ingestion or handling third-party API callbacks.

How does caching work with Next.js App Router data fetching?

Next.js App Router caching relies on fetch-level options to control revalidation and static generation. Data cache persists across requests, while full route cache stores the rendered output of static routes.

Can I use Next.js App Router patterns for performance optimization?

Yes, Next.js App Router patterns optimize performance by defaulting to server components, streaming with Suspense boundaries, and prefetching linked routes to minimize client-side JavaScript execution.