Building Next.js applications, implementing SSR/SSG
Next.js App Router Patterns

Master Next.js 14+ App Router with Server Components, streaming, parallel routes, and advanced data fetching. Use when building Next.js applications, implementing SSR/SSG, or optimizing React Server Components.
--- name: nextjs-app-router-patterns description: Master Next.js 14+ App Router with Server Components, streaming, parallel routes, and advanced data fetching. Use when building Next.js applications, implementing SSR/SSG, or optimizing React Server Components. --- # Next.js App Router Patterns Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development. ## When to Use This Skill - Building new Next.js applications with App Router - Migrating from Pages Router to App Router - Implementing Server Components and streaming - Setting up parallel and intercepting routes - Optimizing data fetching and caching - Building full-stack features with Server Actions
Overview
Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.
Manual install (npx, ZIP)
Claude Code
npx skills add wshobson/agents --skill nextjs-app-router-patterns -g -a claude-codeClaude Code (manual)
mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \
| tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/frontend-mobile-development/skills/nextjs-app-router-patternsWindows (PowerShell)
New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/d734e81953b20e94af5b/nextjs-app-router-patterns.zip" -OutFile "$env:TEMP\nextjs-app-router-patterns.zip"; Expand-Archive "$env:TEMP\nextjs-app-router-patterns.zip" -DestinationPath "$HOME\.claude\skills" -ForceClaude.ai / desktop
Codex, Cursor, other agents
Connects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md3.6 KBreferences/1 file · 9.7 KB
Read the files here
SKILL.md
Show the full text115 lines
Next.js App Router Patterns
Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.
When to Use This Skill
- Building new Next.js applications with App Router
- Migrating from Pages Router to App Router
- Implementing Server Components and streaming
- Setting up parallel and intercepting routes
- Optimizing data fetching and caching
- Building full-stack features with Server Actions
Core Concepts
1. Rendering Modes
| Mode | Where | When to Use |
|---|---|---|
| Server Components | Server only | Data fetching, heavy computation, secrets |
| Client Components | Browser | Interactivity, hooks, browser APIs |
| Static | Build time | Content that rarely changes |
| Dynamic | Request time | Personalized or real-time data |
| Streaming | Progressive | Large pages, slow data sources |
2. File Conventions
app/
├── layout.tsx # Shared UI wrapper
├── page.tsx # Route UI
├── loading.tsx # Loading UI (Suspense)
├── error.tsx # Error boundary
├── not-found.tsx # 404 UI
├── route.ts # API endpoint
├── template.tsx # Re-mounted layout
├── default.tsx # Parallel route fallback
└── opengraph-image.tsx # OG image generation
Quick Start
// app/layout.tsx
import { Inter } from 'next/font/google'
import { Providers } from './providers'
const inter = Inter({ subsets: ['latin'] })
export const metadata = {
title: { default: 'My App', template: '%s | My App' },
description: 'Built with Next.js App Router',
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
<Providers>{children}</Providers>
</body>
</html>
)
}
// app/page.tsx - Server Component by default
async function getProducts() {
const res = await fetch('https://api.example.com/products', {
next: { revalidate: 3600 }, // ISR: revalidate every hour
})
return res.json()
}
export default async function HomePage() {
const products = await getProducts()
return (
<main>
<h1>Products</h1>
<ProductGrid products={products} />
</main>
)
}
Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
Do's
- Start with Server Components - Add 'use client' only when needed
- Colocate data fetching - Fetch data where it's used
- Use Suspense boundaries - Enable streaming for slow data
- Leverage parallel routes - Independent loading states
- Use Server Actions - For mutations with progressive enhancement
Don'ts
- Don't pass serializable data - Server → Client boundary limitations
- Don't use hooks in Server Components - No useState, useEffect
- Don't fetch in Client Components - Use Server Components or React Query
- Don't over-nest layouts - Each layout adds to the component tree
- Don't ignore loading states - Always provide loading.tsx or Suspense
| 1 | |
| 2 | name nextjs-app-router-patterns |
| 3 | description Master Next.js 14+ App Router with Server Components, streaming, parallel routes, and advanced data fetching. Use when building Next.js applications, implementing SSR/SSG, or optimizing React Server Components. |
| 4 | |
| 5 | |
| 6 | # Next.js App Router Patterns |
| 7 | |
| 8 | Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development. |
| 9 | |
| 10 | ## When to Use This Skill |
| 11 | |
| 12 | Building new Next.js applications with App Router |
| 13 | Migrating from Pages Router to App Router |
| 14 | Implementing Server Components and streaming |
| 15 | Setting up parallel and intercepting routes |
| 16 | Optimizing data fetching and caching |
| 17 | Building full-stack features with Server Actions |
| 18 | |
| 19 | ## Core Concepts |
| 20 | |
| 21 | ### 1. Rendering Modes |
| 22 | |
| 23 | | Mode | Where | When to Use | |
| 24 | | --------------------- | ------------ | ----------------------------------------- | |
| 25 | | **Server Components** | Server only | Data fetching, heavy computation, secrets | |
| 26 | | **Client Components** | Browser | Interactivity, hooks, browser APIs | |
| 27 | | **Static** | Build time | Content that rarely changes | |
| 28 | | **Dynamic** | Request time | Personalized or real-time data | |
| 29 | | **Streaming** | Progressive | Large pages, slow data sources | |
| 30 | |
| 31 | ### 2. File Conventions |
| 32 | |
| 33 | |
| 34 | app/ |
| 35 | ├── layout.tsx # Shared UI wrapper |
| 36 | ├── page.tsx # Route UI |
| 37 | ├── loading.tsx # Loading UI (Suspense) |
| 38 | ├── error.tsx # Error boundary |
| 39 | ├── not-found.tsx # 404 UI |
| 40 | ├── route.ts # API endpoint |
| 41 | ├── template.tsx # Re-mounted layout |
| 42 | ├── default.tsx # Parallel route fallback |
| 43 | └── opengraph-image.tsx # OG image generation |
| 44 | |
| 45 | |
| 46 | ## Quick Start |
| 47 | |
| 48 | |
| 49 | // app/layout.tsx |
| 50 | import { Inter } from 'next/font/google' |
| 51 | import { Providers } from './providers' |
| 52 | |
| 53 | const inter = Inter({ subsets: ['latin'] }) |
| 54 | |
| 55 | export const metadata = { |
| 56 | title: { default: 'My App', template: '%s | My App' }, |
| 57 | description: 'Built with Next.js App Router', |
| 58 | } |
| 59 | |
| 60 | export default function RootLayout({ |
| 61 | children, |
| 62 | }: { |
| 63 | children: React.ReactNode |
| 64 | }) { |
| 65 | return ( |
| 66 | <html lang="en" suppressHydrationWarning> |
| 67 | <body className={inter.className}> |
| 68 | <Providers>{children}</Providers> |
| 69 | </body> |
| 70 | </html> |
| 71 | ) |
| 72 | } |
| 73 | |
| 74 | // app/page.tsx - Server Component by default |
| 75 | async function getProducts() { |
| 76 | const res = await fetch('https://api.example.com/products', { |
| 77 | next: { revalidate: 3600 }, // ISR: revalidate every hour |
| 78 | }) |
| 79 | return res.json() |
| 80 | } |
| 81 | |
| 82 | export default async function HomePage() { |
| 83 | const products = await getProducts() |
| 84 | |
| 85 | return ( |
| 86 | <main> |
| 87 | <h1>Products</h1> |
| 88 | <ProductGrid products={products} /> |
| 89 | </main> |
| 90 | ) |
| 91 | } |
| 92 | |
| 93 | |
| 94 | ## Detailed patterns and worked examples |
| 95 | |
| 96 | Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient. |
| 97 | |
| 98 | ## Best Practices |
| 99 | |
| 100 | ### Do's |
| 101 | |
| 102 | **Start with Server Components** - Add 'use client' only when needed |
| 103 | **Colocate data fetching** - Fetch data where it's used |
| 104 | **Use Suspense boundaries** - Enable streaming for slow data |
| 105 | **Leverage parallel routes** - Independent loading states |
| 106 | **Use Server Actions** - For mutations with progressive enhancement |
| 107 | |
| 108 | ### Don'ts |
| 109 | |
| 110 | **Don't pass serializable data** - Server → Client boundary limitations |
| 111 | **Don't use hooks in Server Components** - No useState, useEffect |
| 112 | **Don't fetch in Client Components** - Use Server Components or React Query |
| 113 | **Don't over-nest layouts** - Each layout adds to the component tree |
| 114 | **Don't ignore loading states** - Always provide loading.tsx or Suspense |
| 115 |
Details
- Updated
- Sep 21, 2026
- License
- MIT
- Stars on the repo
- ★ 39,857
- Checked
- Source
- wshobson/agents ↗
- Creator
- wshobson · 179 listings
Similar skills
See all →
SkillDoing ANY task involving Supabase
PromptAct as a specialized front-end developer with expertiseNext.js Specialized Front-End Developer
SkillReviewing a specific inbound deal before closeDeal desk
SkillGenerates complete, production-ready SaaS projectSAAS scaffolder
SkillBuilding React components, optimizing Next.js performanceSenior frontend
MCPBuilding command-line tools and terminal applicationsCLI developerMore from wshobson
SkillMaster C/.NET backend development patterns for building
SkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliance
SkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Design
SkillMigrate from AngularJS to Angular using hybrid modeAngular migration
SkillUnderstand anti-reversing, obfuscationAnti reversing techniques
SkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patterns