nextjs-best-practices

Architect Next.js App Router applications with routing, data fetching, and performance patterns.

2|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/ivanshtokov/copilot-kit --skill nextjs-best-practices-ivanshtokov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/ivanshtokov/copilot-kit/tree/main/.github/skills/nextjs-best-practices
Command: npx skills add https://github.com/ivanshtokov/copilot-kit --skill nextjs-best-practices-ivanshtokov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Architect Next.js App Router applications.

Core Features & Use Cases

  • Server/Client component decision guidance
  • Data fetching patterns (Default, ISR, No-store)
  • Routing conventions and route organization (layout.tsx, page.tsx, loading.tsx, error.tsx, not-found.tsx)
  • API routes and Server Actions
  • Performance, caching, metadata, and anti-pattern guidance
  • Project structure recommendations

Quick Start

Set up a Next.js project and apply the App Router patterns outlined above to your codebase.

Frequently Asked Questions about nextjs-best-practices

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

FAQPage Schema
How do I decide between server and client components in Next.js App Router?

To decide between server and client components in Next.js, evaluate data fetching needs and interactivity. Use server components for data fetching and static rendering, and switch to client components only when you need state, event handlers, or browser APIs.

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

The best data fetching patterns for Next.js include default caching for static data, ISR for periodic updates, and no-store for dynamic, real-time data. Choose your fetching strategy based on how frequently your underlying data changes.

How do I organize routing conventions using layout, page, and error files?

Organize Next.js routing conventions by placing layout.tsx for shared UI, page.tsx for route content, loading.tsx for pending states, error.tsx for error boundaries, and not-found.tsx for 404 handling within each route directory.

What are common Next.js App Router anti-patterns to avoid?

Common Next.js App Router anti-patterns to avoid include unnecessary client-side data fetching, improper metadata handling, missing loading or error boundaries, and overusing client components, which degrades performance and bypasses built-in caching optimizations.

Does Next.js App Router support API routes and Server Actions?

Yes, Next.js App Router supports API routes and Server Actions. You can define route handlers for HTTP endpoints and use Server Actions to mutate data directly from client components without writing separate API endpoints.

How do I optimize performance and caching in a modern Next.js project?

Optimize Next.js performance and caching by leveraging server components, configuring ISR or default fetch caching, implementing proper metadata, and structuring routes with loading.tsx to improve perceived page load speeds.