/major-ai-skills:nextjsfrom major-ai-skills
Build Next.js App Router apps with explicit server/client boundaries, caching (fetch, revalidate, Cache Components), Route Handlers, and pages-router migration pitfalls. Use for SSR, RSC, deployment prep, and Next 15–16 cache model changes.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Next.js App Router (app/) uses file-based routes, React Server Components (RSC) by default, and Client Components only where browser interactivity is required. Data fetching on the server participates in a caching model that changed materially in Next.js 15–16: implicit static-by-default gave way to dynamic-by-default when Cache Components (cacheComponents: true, formerly experimental.dynamicIO) is enabled—opt-in caching via "use cache", cacheLife, and cacheTag.
Claude operates as a Principal Full-Stack Architect: server/client boundary, secrets isolation, Route Handlers vs pages/api, Suspense for dynamic segments, and webhook raw-body routes.
app/
layout.tsx (Server Component default)
page.tsx
loading.tsx / error.tsx
(route)/page.tsx (dynamic segments)
api/.../route.ts (Route Handlers)
components/
*.tsx + "use client" only when needed
Pages Router (pages/) still exists in brownfield apps—do not mix routing models in one tree without a deliberate migration plan.
Use when
"use client" sprawl and leaking server imports.Do not use when
output: 'export' constraints)."use client" only for state, effects, browser APIs, or event handlers.NEXT_PUBLIC_* or modules imported by client components. Use server-only package on server modules.getServerSideProps / getStaticProps → async Server Components or "use cache" helpers._app.tsx providers → client providers.tsx imported from root layout.tsx.pages/api/* → app/**/route.ts with different body parsing rules.cookies(), headers(), params, searchParams) make routes dynamic—wrap in <Suspense> when using Cache Components or expect build/runtime validation errors.Date.now(), Math.random(), or crypto.randomUUID() in prerendered Server Components—move to request-time Suspense or client.request.text() / arrayBuffer()) before JSON parse—see @stripe.dynamic, revalidate, fetchCache—many are removed or error under Cache Components.Server page + client island:
// app/items/page.tsx
import { Counter } from "@/components/counter";
export default async function ItemsPage() {
const res = await fetch(`${process.env.API_URL}/items`, {
next: { revalidate: 60 }, // verify against project's Next major
});
const data = await res.json();
return (
<main>
<h1>Items ({data.length})</h1>
<Counter />
</main>
);
}
Webhook Route Handler (raw body):
// app/api/webhooks/stripe/route.ts
export async function POST(request: Request) {
const rawBody = await request.text();
// verify signature on rawBody, then JSON.parse for logging only
}
| Pages pattern | App Router equivalent | Gotcha |
|---|---|---|
pages/index.tsx | app/page.tsx | No default _document |
pages/api/x.ts | app/api/x/route.ts | Export GET/POST functions |
useRouter() from next/router | next/navigation | Different API |
_app global CSS | app/layout.tsx | Metadata API replaces Head |
getStaticPaths | generateStaticParams | Async in Server Components |
Middleware req.cookies | cookies() in RSC | Dynamic boundary |
| Issue | Root cause | Fix |
|---|---|---|
| Secret leaked to client bundle | Server module imported by "use client" | Split modules; server-only |
| Webhook signature fails | express.json()-style parse before verify | Raw body route; parse after verify |
| Stale data | Aggressive caching / missing revalidate | Explicit revalidate or "use cache" + cacheLife |
| Build error: missing Suspense | Dynamic API in static shell (Cache Components) | Suspense boundary or "use cache" scope |
cookies() in cached function | Illegal under Cache Components | Pass values as args into cached helper |
| Hydration mismatch | Server/client render diff | Fix conditional rendering; avoid random in RSC |
loading.tsx / error.tsx per route segment.next/image with explicit dimensions.cacheComponents."use cache" default storage is in-memory per instance—use remote cache for cross-deploy persistence when needed.@react — hooks, effects, composition@typescript — typing server props and loaders@stripe — payment webhooks in Route Handlers@supabase — SSR auth cookie patterns@vercel — deployment-specific cachingMANDATORY: Keep secrets and DB clients on the server only. For webhooks, verify signatures on the raw body. Before changing caching flags, confirm the project's Next.js major version and whether Cache Components is enabled. Prefer explicit cache boundaries over implicit assumptions from older App Router tutorials.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization.Other plugins' skills for the same job
/act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.