Claude-skill-registry developing-nextjs
Use this skill when developing Next.js 16 applications - creating pages, components, layouts, API routes, implementing proxy.ts, adding caching with Cache Components, or refactoring frontend code. This includes working with App Router patterns, Server Components, Server Actions, React 19.2 features, and Tailwind CSS v4.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/developing-nextjs" ~/.claude/skills/majiayu000-claude-skill-registry-developing-nextjs && rm -rf "$T"
manifest:
skills/data/developing-nextjs/SKILL.mdsource content
Next.js 16 Development
Write concise, targeted, DRY code using modern React 19 and Next.js 16 patterns.
Next.js 16 Key Changes
proxy.ts (Replaces middleware.ts)
The
middleware.ts file is deprecated. Use proxy.ts instead:
// proxy.ts (at project root or src/) import { NextResponse } from 'next/server' import type { NextRequest } from 'next/server' export function proxy(request: NextRequest) { // Runs on Node.js runtime (NOT Edge) return NextResponse.redirect(new URL('/home', request.url)) } export const config = { matcher: '/api/:path*', }
remains backwards compatible, but will be deprecated soonmiddleware.ts- When it exists, mention but DO NOT rename or change anything
export function is now calledproxy.ts
instead ofproxymiddleware- Runs on Node.js runtime (not Edge)
- Config flags renamed:
→skipMiddlewareUrlNormalizeskipProxyUrlNormalize
Async Request APIs (Breaking)
All request APIs must be awaited:
// Next.js 16 - MUST await const cookieStore = await cookies() const headersList = await headers() const draft = await draftMode() const { slug } = await params const query = await searchParams
Turbopack (Default)
Turbopack is now the default bundler. No
--turbopack flag needed.
{ "scripts": { "dev": "next dev", "build": "next build" } }
- Use
flag to opt out if needed--webpack - Config moved from
to top-levelexperimental.turbopackturbopack
Cache Components
New caching model replacing
experimental.ppr:
// next.config.ts const nextConfig = { cacheComponents: true, }
Use
"use cache" directive for explicit caching:
async function getData() { "use cache" return await fetchData() }
New Caching APIs
import { updateTag, revalidateTag, refresh } from 'next/cache' // updateTag - read-your-writes semantics (Server Actions only) export async function updateProfile(userId: string) { await db.update(userId) updateTag(`user-${userId}`) // User sees changes immediately } // revalidateTag - now requires cacheLife profile revalidateTag('blog-posts', 'max') // SWR behavior with profile // refresh - refresh uncached data (Server Actions only) refresh()
React 19.2 Features
- View Transitions: Animate navigation/updates
: Extract non-reactive logic from EffectsuseEffectEvent
: Background rendering with<Activity>display: none
React Compiler (Stable)
// next.config.ts const nextConfig = { reactCompiler: true, }
Requires:
bun add -D babel-plugin-react-compiler
Other Breaking Changes
- Node.js 20.9+ required (Node.js 18 dropped)
- TypeScript 5.1+ required
- Parallel routes require explicit
filesdefault.js
removed - use ESLint directlynext lint- AMP support removed
deprecated - usenext/legacy/imagenext/image
deprecated - useimages.domainsimages.remotePatterns
next/image Defaults Changed
: 60s → 4 hoursminimumCacheTTL
: removedimageSizes
from default array16
: nowqualities
only by default[75]- Local images with query strings require
images.localPatterns
Coding Standards
DRY & Conciseness
- Write minimal code solving the problem
- Extract repeated patterns into reusable components/hooks
- Keep files under 300 lines; split when approaching limit
- One component per file unless tightly coupled
Next.js 16 Patterns
- Use App Router (
directory) exclusivelyapp/ - Server Components by default; add
only when absolutely needed'use client' - Use Server Actions for mutations
- Implement
andloading.tsx
boundarieserror.tsx - Use
,next/image
,next/linknext/font
Tailwind CSS v4
- Use
(not v3 directives)@import "tailwindcss" - Configure via
in CSS, not tailwind.config.js@theme - Use
(notbg-linear-to-r
)bg-gradient-to-r - Prefer CSS variables over
@apply
TypeScript
- Strict typing always
- Use
for Convex document IDsId<'tableName'> - Define explicit return types
- Use
for string literals in unionsas const
Operational Guidelines
- Read existing codebase and ensure no duplicate code exists
- Make surgical, targeted changes
- Preserve existing patterns in the codebase
Research Protocol
When encountering unfamiliar Next.js 16 APIs, use Exa and Ref MCP servers (if available) to search examples and official documentation. When unavailable, use web search tools.