
next-v16
Next.js 16 App Router performance, caching, server components, server actions, routing, and codebase-hygiene best practices — plus a category-major review/refactor algorithm with codebase-level (remove/dedup/reuse) findings. This skill should be used when writing Next.js 16 App Router code, configuring caching with 'use cache' or the previous fetch-cache model, building Server Components, setting up parallel/intercepting routes, configuring next.config OR proxy.ts, OR auditing/refactoring a Next.js codebase (single file or whole repo). This skill does NOT cover generic React 19 patterns (use vercel-react) or non-Next.js server rendering.
- Installs
- 243
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/blockmatic/basilic-skills --skill next-v16- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads next-v16 automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Skill: next-v16
Next.js 16 App Router (GA October 2025). Prefer the version-matched docs in node_modules/next/dist/docs/ over training data. Codemods: npx @next/codemod@canary upgrade latest, middleware-to-proxy, next-async-request-api.
Scope
- Applies to: Next.js 16 App Router — Turbopack, Cache Components vs previous cache model,
proxy.ts, async request APIs, Server Components, Server Actions, streaming, metadata, client islands - Does NOT cover: Pages Router, generic React 19 (see vercel-react), non-Next server rendering
Assumptions
- Next.js 16.x, React 19.2 App Router, Node.js 20.9+, TypeScript 5.1+
- Two cache models exist. Detect
cacheComponentsinnext.configbefore choosing APIs fetchis not cached by default in either model. Opt in explicitly
Principles
- Read
node_modules/next/dist/docs/for this installed version before generating Next APIs - Cache is opt-in. Declare intent on every server
fetch - Network boundary is
proxy.ts(Node.js). Auth gates, rewrites, redirects, header mutation - Request APIs are async:
await cookies(),await headers(),await draftMode(),await params,await searchParams - Turbopack is the default bundler.
--webpackis an opt-out, not the 16 idiom - Prefer Server Components. Push
'use client'to interactive leaves - When the user asks to audit or modernize Next code, follow
references/_review-algorithm.md
Constraints
MUST
awaitparams,searchParams,cookies(),headers(),draftMode()- Call
revalidateTag(tag, profile)with acacheLifeprofile ('max'|'hours'|'days'| inline{ expire }). One-arg form is deprecated - Use
updateTag(tag)from Server Actions when the user must see the write immediately (read-your-writes). UserevalidateTag(tag, 'max')for stale-while-revalidate - Export
proxyfromproxy.ts(named or default). Runtime isnodejsand cannot be set to Edge - Before adding
'use cache',cacheLife, orcacheTag, confirmcacheComponents: true
SHOULD
- Enable Cache Components only as an explicit migration:
cacheComponents: true, then replace segment configsdynamic/revalidate/fetchCachewith'use cache'+cacheLife. Guide: Migrating to Cache Components - If the app was not adopting
experimental.dynamicIO/experimental.useCache/experimental.ppr, remove those flags. Do not setcacheComponents: trueas a rename — it can fail the build for uncached data outside Suspense - Without Cache Components, cache with
cache: 'force-cache',next: { revalidate, tags }, orunstable_cache. Guide: Caching without Cache Components - Keep a
config.matcheronproxy.tsthat excludes/_next/static,/_next/image, and public assets - Use
next/imageremotePatterns(not deprecatedimages.domains). Usenext/image, notnext/legacy/image - Generate sitemaps/robots from
app/sitemap.tsandapp/robots.ts - Import
cacheLife/cacheTagfromnext/cache(stable). Do not useunstable_cacheLife/unstable_cacheTag - Rename
skipMiddlewareUrlNormalizetoskipProxyUrlNormalize
AVOID
- Generating
'use cache'in an app that has not setcacheComponents: true(directive is a Cache Components feature) - Flipping
cacheComponents: truebecauseexperimental.dynamicIO/experimental.useCache/experimental.pprwere present. Enabling the flag is a programming-model migration middleware.tsfor new code. Keep it only if Edge runtime is still required; it is deprecated- Sync
params/cookies()/headers()(removed, not warned) next lint(removed). Lint with ESLint or Biomeexperimental.ppr,experimental.dynamicIO,experimental.useCache,export const experimental_ppr(removed)experimental.turbopack(moved to top-levelturbopack)experimental.turbo.persistentCaching— that is not the Next 16 API. Filesystem cache isexperimental.turbopackFileSystemCacheForDev/experimental.turbopackFileSystemCacheForBuild(on by default)next dev --turbopack/next build --turbopackas the 16 idiom. Turbopack is already default;--webpackis the opt-out- Custom
webpackin config while running defaultnext build(fails). Migrate to Turbopack or pass--webpack - Treating
'max'onrevalidateTagas “read-your-writes”. That is SWR; useupdateTagin Server Actions - Claiming Server Actions must replace every Route Handler. Route Handlers remain correct for cookies, webhooks, OAuth callbacks, and proxying an external API
Interactions
- React 19 concurrent UI: vercel-react
- Client data after hydration: tanstack-query-v5
- Forms that stay on the Next server: workflow/form
Two cache models (do not mix)
| Config | What to generate |
|---|---|
cacheComponents unset / false | Previous model. fetch uncached unless cache: 'force-cache' or next.revalidate. Segment configs dynamic, revalidate, fetchCache still work. unstable_cache for non-fetch. Do not emit 'use cache' |
cacheComponents: true | Cache Components. Dynamic by default. Cache with 'use cache' + cacheLife / cacheTag. Segment configs dynamic / revalidate / fetchCache error. PPR is the default behavior. Fetches inside a 'use cache' scope are cached |
'use cache' requires cacheComponents: true (use cache). Enabling the flag is a migration, not an automatic Next 16 default (cacheComponents).
Invalidation (both models, Next 16 signatures):
revalidateTag(tag, 'max')— stale-while-revalidate; works in Server Actions and Route HandlersupdateTag(tag)— expire and read fresh in the same request; Server Actions onlyrefresh()— refresh uncached data only; Server Actions onlyrevalidatePath— unchanged
Next.js 16 idioms (do not generate Next 15)
proxy.ts+export function proxy(Node) — notmiddleware.tsunless Edge is required- Turbopack default —
next dev/next buildwith no--turbopack. Opt out:--webpack await params/await searchParams/await cookies()revalidateTag(tag, profile)— notrevalidateTag(tag)reactCompiler: trueis stable and opt-in (not default)turbopack: { ... }at the Next config root — notexperimental.turbopack- Parallel route slots need
default.js(build fails without it)
How to review or refactor
When the user asks to review, refactor, modernize, or audit Next code, follow references/_review-algorithm.md. Do not improvise.
- Pick Mode A (≤~20 files) or Mode B (whole tree)
- Detect cache model from
next.configbefore Category 2 - Category-major sweep with a scope declaration, per-category progress lines, and a coverage table
- Category 9 last (dedup / consolidate / delete / demote
'use client')
Rule categories
- Build & Bundle — CRITICAL — barrels,
optimizePackageImports,serverExternalPackages, Turbopack,next/dynamic - Caching — CRITICAL — fetch intent, segment config or
'use cache'(model-dependent),revalidateTag+profile,revalidatePath, Reactcache() - Server Components — HIGH — parallel fetch, Suspense, colocation, preload, no client initial fetch
- Routing — HIGH — parallel/intercepting routes, prefetch,
proxy.ts,notFound() - Server Actions — MEDIUM-HIGH — forms,
useFormStatus, action results, optimistic UI, revalidation. Skip when mutations already go to an external API - Streaming — MEDIUM — Suspense,
loading.tsxon routes that await,error.tsx, matching skeletons - Metadata — MEDIUM —
generateMetadata,sitemap.ts,robots.ts,opengraph-image.tsx - Client islands — LOW-MEDIUM —
'use client'leaf, children slot, hydration,next/script - Hygiene — CROSS-CUTTING — dedup fetchers, consolidate routes, dead code, boundary audit, name drift
Full rule list: references/compiled.md. Rule files: references/.
References
FAQ
What does the next-v16 skill do?
Next.js 16 App Router performance, caching, server components, server actions, routing, and codebase-hygiene best practices — plus a category-major review/refactor algorithm with codebase-level (remove/dedup/reuse) findings. This skill should be used when writing Next.js 16 App Router code, configuring caching with 'use cache' or the previous fetch-cache model, building Server Components, setting up parallel/intercepting routes, configuring next.config OR proxy.ts, OR auditing/refactoring a Next.js codebase (single file or whole repo). This skill does NOT cover generic React 19 patterns (use vercel-react) or non-Next.js server rendering.
How do I install next-v16?
Run npx skills add https://github.com/blockmatic/basilic-skills --skill next-v16 in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/next-v16/ (personal) or .claude/skills/next-v16/ (project).
Which AI agents can use next-v16?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is next-v16 safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains next-v16?
It is published by blockmatic in blockmatic/basilic-skills. It has 243 recorded installs.
More from blockmatic/basilic-skills
workflow
blockmatic/basilic-skills
Basilic /w- playbooks packed so install lands at .agents/skills/workflow/w-plan and the rest.
w-review-plan
blockmatic/basilic-skills
Review a plan's Goals, Assumptions, Tasks, Risks, and References.
w-git-repair
blockmatic/basilic-skills
Resolve common Git problems and conflicts with inspected commands.
w-perf
blockmatic/basilic-skills
Measure bottlenecks with repository tools, then recommend or apply evidenced optimizations.
w-api-test
blockmatic/basilic-skills
Add API tests that exercise public HTTP behavior against existing harnesses.
w-architecture
blockmatic/basilic-skills
Plan an implementation structure; durable decisions belong in ADRs and architecture docs.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.