This skill helps you build production-ready Next.js apps with App Router, Server Components, and advanced data fetching and caching.
npx playbooks add skill greedychipmunk/agent-skills --skill nextjs-developer
This skill provides comprehensive expertise in building production-ready Next.js applications using the App Router (Next.js 15+). It covers Server Components, React 19 support, data fetching patterns, routing, API routes, caching, and performance optimization.
"use client" directiveloading.tsx fileserror.tsx[param] and catch-all [...slug] patterns(folder) for organization without URL impact@slot for simultaneous route rendering(.), (..), (...)action attributeapp/
├── layout.tsx # Root layout
├── page.tsx # Home page
├── globals.css # Global styles
├── (auth)/ # Route group
│ ├── login/page.tsx
│ └── register/page.tsx
├── dashboard/
│ ├── layout.tsx # Dashboard layout
│ ├── page.tsx # Dashboard home
│ ├── loading.tsx # Loading UI
│ ├── error.tsx # Error boundary
│ └── [id]/page.tsx # Dynamic route
├── api/
│ └── [route]/route.ts # API routes
└── components/ # Shared components
// app/posts/page.tsx
async function PostsPage() {
const posts = await db.posts.findMany()
return (
<ul>
{posts.map(post => (
<li key={post.id}>{post.title}</li>
))}
</ul>
)
}
export default PostsPage
// app/components/counter.tsx
"use client"
import { useState } from "react"
export function Counter() {
const [count, setCount] = useState(0)
return (
<button onClick={() => setCount(c => c + 1)}>
Count: {count}
</button>
)
}
// In Next.js 15+, fetch is uncached by default (implicit cache: 'no-store')
async function Page() {
const data = await fetch('https://api.example.com/data')
return <div>{data}</div>
}
// Explicitly opt into caching
async function Page() {
const data = await fetch('https://api.example.com/data', {
cache: 'force-cache',
})
return <div>{data}</div>
}
async function Page() {
const data = await fetch('https://api.example.com/data', {
next: { revalidate: 3600 }, // Revalidate every hour
})
return <div>{data}</div>
}
> Note: The client router cache is also uncached by default in Next.js 15, replacing the old 30s/5m defaults.
// app/actions.ts
"use server"
import { revalidatePath } from "next/cache"
export async function createPost(formData: FormData) {
const title = formData.get("title") as string
await db.posts.create({ data: { title } })
revalidatePath("/posts")
}
// app/posts/new/page.tsx
import { createPost } from "@/app/actions"
export default function NewPost() {
return (
<form action={createPost}>
<input name="title" required />
<button type="submit">Create</button>
</form>
)
}
experimental.ppr: 'incremental' in next.config.js, or use ppr: true when you want full PPR.Suspense boundaries to define dynamic holes inside static shells.// app/page.tsx — static shell with dynamic hole
export const experimental_ppr = true
export default function Page() {
return (
<main>
<StaticHeader />
<Suspense fallback={<ProductSkeleton />}>
<DynamicProductList />
</Suspense>
</main>
)
}
next dev in Next.js 15 and for next build in Next.js 15.3+.next dev --turbopack and next build --turbopack to opt in.next dev --turbopack
next build --turbopack
use() to consume promises and contexts during render.useFormStatus() for form state without prop drilling.useOptimistic() for optimistic UI updates.import { use } from "react"
import { useFormStatus } from "react-dom"
import { useOptimistic } from "react"
function ProductName({ productPromise }: { productPromise: Promise<{ name: string }> }) {
const product = use(productPromise)
return <h1>{product.name}</h1>
}
after() Post-Response Workafter() for post-response work.next/server.import { after } from 'next/server'
after(() => {
logAnalytics()
})
useLinkStatus() helps show inline link-loading indicators.onNavigate lets you track or block client-side navigation.useLinkStatus() is a client hook from next/link and returns { pending }.onNavigate is a Link prop for SPA navigations only.'use client'
import Link, { useLinkStatus } from 'next/link'
function LinkHint() {
const { pending } = useLinkStatus()
return <span aria-hidden>{pending ? 'Loading…' : null}</span>
}
export function Nav() {
return (
<nav>
<Link href="/dashboard" prefetch={false} onNavigate={() => trackNavigation('/dashboard')}>
Dashboard <LinkHint />
</Link>
</nav>
)
}
experimental.ppr: 'incremental' for route-by-route PPR adoption.ppr: true only when you want a fully PPR-enabled app.next.config.js switch.// next.config.ts
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
ppr: 'incremental',
},
// For full PPR:
// ppr: true,
}
export default nextConfig
{
"scripts": {
"dev": "next dev --turbopack",
"build": "next build --turbopack"
}
}
next/imagenext/font for font optimizationThis skill includes executable scripts in the scripts/ folder:
./scripts/dev-server.sh [--port PORT] [--turbo]
./scripts/build-production.sh [--analyze]
./scripts/analyze-bundle.sh
./scripts/create-page.sh <page-path> [--layout] [--loading] [--error]
./scripts/create-api-route.sh <route-name> [--dynamic]
./scripts/create-component.sh <name> [--client] [--test] [--dir DIR]
./scripts/setup-testing.sh [--playwright]
./scripts/run-tests.sh [--watch] [--coverage] [--file FILE]
This skill includes production-ready templates in the templates/ folder:
This skill includes detailed reference guides in the resources/ folder:
---
Specialization: Next.js App Router Development
Version: 2.0
Last Updated: May 2026
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.