nextjs-app-router-patterns

Implements Next.js App Router patterns for Server Components, streaming, parallel routes, and Server Actions.

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill nextjs-app-router-patterns-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-app-router-patterns
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/nextjs-app-router-patterns
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill nextjs-app-router-patterns-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building modern Next.js applications requires navigating complex App Router concepts like Server Components, streaming, caching strategies, and route conventions, and this Skill provides proven patterns and code samples to implement them correctly. ## Core Features & Use Cases - Server Components & Data Fetching: Patterns for async Server Components with fetch caching, ISR revalidation, and tag-based invalidation. - Advanced Routing: Implementations of parallel routes, intercepting routes for modals, and route handlers for API endpoints. - Server Actions & Mutations: Form handling and mutations with revalidation, redirects, and progressive enhancement. - Use Case: When migrating a Pages Router app to App Router, use this Skill to restructure layouts, convert data fetching to Server Components, and add streaming with Suspense boundaries. ## Quick Start Ask the AI to implement a Next.js App Router product page with Server Components, streaming reviews via Suspense, and an add-to-cart Server Action.

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. Use { next: { revalidate: 60 } } for ISR, { cache: 'no-store' } for dynamic data, or { next: { tags: ['products'] } } for tag-based invalidation.

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

Migrate by moving pages into the app directory with page.tsx files, converting getServerSideProps and getStaticProps into async Server Components, and replacing API routes with route handlers in route.ts files.

When should I use 'use client' in Next.js App Router?

Add 'use client' only when a component needs interactivity, React hooks like useState or useEffect, or browser APIs. Start with Server Components by default and push client boundaries as far down the tree as possible.

How do parallel routes work in Next.js App Router?

Parallel routes use named slots like @analytics and @team folders that render simultaneously in the same layout. Each slot gets its own loading.tsx and error.tsx, enabling independent loading states for dashboard-style pages.

Why is my Next.js fetch not revalidating cached data?

Cached fetch responses persist until revalidated by time or tags. Call revalidateTag or revalidatePath inside a Server Action after mutations, or set a revalidate interval in the fetch options to control staleness.