nextjs-app-router-patterns

Implements Next.js App Router patterns for Server Components, routing, and data fetching.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/RobinMillford/GopherNotebook --skill nextjs-app-router-patterns-robinmillford
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-app-router-patterns
Source: https://github.com/RobinMillford/GopherNotebook/tree/main/.claude/skills/nextjs-app-router-patterns
Command: npx skills add https://github.com/RobinMillford/GopherNotebook --skill nextjs-app-router-patterns-robinmillford

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers building or migrating Next.js applications often struggle with App Router concepts like Server vs Client Components, streaming, caching, and route conventions, leading to incorrect architecture and poor performance. ## Core Features & Use Cases - Server Component Patterns: Provides code templates for data fetching, Suspense streaming, and colocated queries in Server Components. - Routing Structures: Covers parallel routes, intercepting routes for modals, route handlers for APIs, and file conventions like loading.tsx and error.tsx. - Server Actions & Caching: Includes mutation patterns with revalidateTag/revalidatePath and ISR strategies with tag-based invalidation. - Use Case: When migrating a Pages Router e-commerce site to App Router, use this Skill to restructure product pages with Server Components, add a cart via Server Actions, and implement a photo modal with intercepting routes. ## Quick Start Use the nextjs-app-router-patterns skill to scaffold a products page with Server Components, Suspense streaming, and a Server Action for adding items to the cart.

Frequently Asked Questions about nextjs-app-router-patterns

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

FAQPage Schema
How do I fetch data in Next.js App Router Server Components?

Fetch data directly inside async Server Components using the fetch API with cache options like next: { revalidate: 60 } for ISR or next: { tags: ['products'] } for tag-based invalidation. Colocate the fetch where the data is rendered and wrap slow sections in Suspense boundaries.

How to migrate from Next.js Pages Router to App Router?

Migrate incrementally by moving routes into the app directory, converting data fetching from getServerSideProps to async Server Components, and replacing API routes with route handlers in route.ts files. Add 'use client' only to components needing hooks or browser APIs.

When should I use Server Components vs Client Components in Next.js?

Use Server Components for data fetching, heavy computation, and accessing secrets, since they render only on the server. Use Client Components marked with 'use client' for interactivity, React hooks like useState, and browser APIs.

How do Server Actions work in Next.js App Router?

Server Actions are async functions marked with 'use server' that run on the server for mutations like form submissions. They support progressive enhancement, can call revalidateTag or revalidatePath to refresh cached data, and redirect users after completion.

What are intercepting routes in Next.js and when to use them?

Intercepting routes let you load a route within the current layout, commonly for modal patterns like photo previews. Use the (.)folder convention inside a parallel route slot such as @modal, with a default.tsx fallback for hard navigations.

Why is my Next.js page not streaming with Suspense?

Streaming fails when data is fetched at the page level before rendering, blocking the entire response. Move slow fetches into child components wrapped in Suspense boundaries with skeleton fallbacks so the shell renders immediately.