nextjs-app-router-patterns

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

4|Updated May 13, 2026
One-click install
npx skills add https://github.com/RuixeWolf/modbus-simulator --skill nextjs-app-router-patterns-ruixewolf
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nextjs-app-router-patterns
Source: https://github.com/RuixeWolf/modbus-simulator/tree/main/.agents/skills/nextjs-app-router-patterns
Command: npx skills add https://github.com/RuixeWolf/modbus-simulator --skill nextjs-app-router-patterns-ruixewolf

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building modern Next.js applications requires navigating complex decisions about Server vs Client Components, caching strategies, streaming, and route architecture, and mistakes lead to hydration errors, poor performance, or broken data flows. ## Core Features & Use Cases - Rendering Architecture Guidance: Covers Server Components, Client Components, static rendering, dynamic rendering, and streaming with Suspense boundaries. - Routing Patterns: Provides working examples of parallel routes, intercepting routes for modals, route handlers for APIs, and file conventions like loading.tsx and error.tsx. - Data Fetching & Mutations: Demonstrates fetch caching with revalidation tags, Server Actions for form mutations, and metadata generation for SEO. - Use Case: When migrating a Pages Router app to App Router or building a dashboard with independently loading panels, apply the parallel routes and Suspense streaming patterns to structure the code correctly. ## Quick Start Ask the AI to scaffold a Next.js App Router page that fetches product data with ISR caching and streams slow sections using Suspense.

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 use Server Components in Next.js App Router?▼

Components in the app directory are Server Components by default, so you can fetch data directly with async/await without useEffect. Add the 'use client' directive only when you need hooks, event handlers, or browser APIs.

How to fetch and cache data in Next.js App Router?▼

Use the native fetch API with cache options: 'no-store' for fresh data, 'force-cache' for static data, or next.revalidate for ISR. Tag fetches with next.tags and invalidate them from Server Actions using revalidateTag.

What is the difference between Server Actions and API routes in Next.js?▼

Server Actions are functions marked with 'use server' that handle mutations directly from components with progressive enhancement. Route handlers in route.ts files expose REST endpoints for external clients and third-party integrations.

Can I use useState or useEffect in Next.js Server Components?▼

No, React hooks like useState and useEffect are not allowed in Server Components. Move interactive logic into a separate component marked with 'use client' and pass serializable props from the Server Component.

How do I build a modal with intercepting routes in Next.js?▼

Create a @modal slot in your layout and add an intercepting route like @modal/(.)photos/[id]/page.tsx that renders the content inside a modal. The full page route still exists for direct navigation and refreshes.

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

Streaming only works when the slow data fetch happens inside a component wrapped in a Suspense boundary, not in the parent page. Move the await call into the child component and provide a fallback skeleton.