nextjs-best-practices

Guide Next.js App Router projects with server components and routing patterns.

1|Updated Apr 5, 2025
One-click install
npx skills add https://github.com/Artag-Chris/Artagsite --skill nextjs-best-practices-artag-chris
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-best-practices
Source: https://github.com/Artag-Chris/Artagsite/tree/main/.agents/skills/nextjs-best-practices
Command: npx skills add https://github.com/Artag-Chris/Artagsite --skill nextjs-best-practices-artag-chris

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Next.js App Router projects require clear patterns for component types, data fetching, routing, and performance to remain maintainable and scalable.

Core Features & Use Cases

  • Server/Client Component guidance: decide when to mark a component as client and when to keep it server-rendered.
  • Data Fetching & Routing patterns: prescribe fetch strategies, layout and route organization, and parallel routes.
  • Performance & Project Structure: emphasize file conventions, caching, and bundling best practices for production-grade apps.

Quick Start

Audit your Next.js app and implement server components by default, moving interactive elements to client components only where needed.

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

Next.js App Router projects use server components by default for data fetching and static rendering, switching to client components only when you need interactivity, state, or browser APIs. This keeps your bundle minimal and rendering server-first.

How do I structure layouts and routing patterns in a Next.js App Router project?

Structure Next.js App Router projects using file conventions like page.tsx and layout.tsx, organizing routes with route groups for logical grouping and parallel routes for independent dynamic content sections. This ensures scalable project architecture.

What is the best way to handle data fetching for SSR and ISR scenarios in Next.js?

The best way to handle Next.js data fetching is prescribing fetch strategies directly within server components to leverage SSR and ISR caching. This server-first approach optimizes performance and minimizes client-side data requests.

What file conventions do I need for production-grade Next.js App Router apps?

Production-grade Next.js App Router apps require file conventions including page.tsx, layout.tsx, loading.tsx, error.tsx, and not-found.tsx. These establish robust routing, UI states, and error boundaries for scalable application infrastructure.

How does caching and bundling affect Next.js App Router performance?

Next.js App Router performance relies heavily on caching strategies and performance-minded bundling. By emphasizing server-first data fetching and selective client components, you minimize JavaScript payloads and optimize render paths.