From revskills
Next.js 15+ App Router best practices for pages, layouts, routes, server components, server actions, caching, API routes, and streaming. Use when building or reviewing Next.js code, implementing RSC patterns, PPR, metadata, error boundaries, or proxy.ts. Covers React 19 conventions, data fetching, ISR, and common mistakes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/revskills:next-best-practicesThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
- All components are Server Components by default — no `'use client'` needed
'use client' needed'use client' when you need: hooks, event handlers, browser APIs, or Contextpage.tsx — route pagelayout.tsx — shared layout (wraps children, persists across navigations)loading.tsx — streaming fallback (instant loading UI)error.tsx — error boundary ('use client' required)not-found.tsx — 404 pageproxy.ts — request proxy/middleware (NOT middleware.ts in v16+)route.ts — API route handlergetServerSideProps)fetch() with Next.js caching extensions'use server')// Static (build time)
export const dynamic = 'force-static';
// Dynamic (every request)
export const dynamic = 'force-dynamic';
// ISR (revalidate every N seconds)
export const revalidate = 3600;
// On-demand revalidation
import { revalidatePath, revalidateTag } from 'next/cache';
next.config.ts: experimental: { ppr: true }<Suspense> boundaries to mark dynamic regions// Static
export const metadata: Metadata = {
title: 'Page Title',
description: 'Page description',
};
// Dynamic
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const data = await fetchData(params.id);
return { title: data.title };
}
'use server';
export async function createItem(formData: FormData) {
const name = formData.get('name') as string;
// Validate, write to DB, revalidate
revalidatePath('/items');
}
import Image from 'next/image';
<Image
src="/hero.jpg"
alt="Description"
width={1200}
height={630}
priority // above the fold
placeholder="blur"
/>
'use client' on pages that don't need interactivityuseEffect for data fetching — use server components or server actionsmiddleware.ts at the root — use proxy.ts in Next.js 16+router.push() for mutations — use server actions + revalidatePath()useCallback, useMemo, or React.memo — React Compiler handles memoizationuse() instead of useContext() for reading context{condition ? <A/> : null} instead of {condition && <A/>}ref is a regular prop now — no forwardRef neededSkill by RevealUI Studio — the agentic business runtime.
npx claudepluginhub revealuistudio/revskills --plugin revskillsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.