New advertisers: 50% off your first month with code FIRSTMONTHSee slots
davila7 avatar

Nextjs Best Practices

Next.js App Router principles covering Server Components, data fetching, routing, caching, and server actions.

skills.sh installs
633
GitHub stars
34.1K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers Server vs Client Component decisions, fetch strategies (static, ISR, and dynamic), and cache layers with revalidation methods
  • Includes file conventions (page.tsx, layout.tsx, loading.tsx, error.tsx, not-found.tsx) plus route groups, parallel routes, and intercepting routes
  • Enforces server-by-default rendering, input validation with Zod, and loading and error boundaries before client-side fallbacks
  • Designed for developers building or reviewing Next.js App Router projects that need guidance on rendering and data flow

Install

$ npx -y skills add davila7/claude-code-templates --skill nextjs-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Next.js Best Practices

Principles for Next.js App Router development.


1. Server vs Client Components

Decision Tree

Does it need...?
│
├── useState, useEffect, event handlers
│   └── Client Component ('use client')
│
├── Direct data fetching, no interactivity
│   └── Server Component (default)
│
└── Both? 
    └── Split: Server parent + Client child

By Default

TypeUse
ServerData fetching, layout, static content
ClientForms, buttons, interactive UI

2. Data Fetching Patterns

Fetch Strategy

PatternUse
DefaultStatic (cached at build)
RevalidateISR (time-based refresh)
No-storeDynamic (every request)

Data Flow

SourcePattern
DatabaseServer Component fetch
APIfetch with caching
User inputClient state + server action

3. Routing Principles

File Conventions

FilePurpose
page.tsxRoute UI
layout.tsxShared layout
loading.tsxLoading state
error.tsxError boundary
not-found.tsx404 page

Route Organization

Details

Repository
github.com/davila7/claude-code-templates
Categories
Frontend & UI Code, Backend & APIs
First seen
May 16, 2026

More from davila7/claude-code-templates

All 398

Similar to Nextjs Best Practices

More Frontend & UI Code