Loading...
Loading...
Validate Next.js 16 configuration and detect/prevent deprecated patterns. Ensures proxy.ts usage, Turbopack, Cache Components, and App Router best practices. Use before any Next.js work or when auditing existing projects.
npx skill4agent add shipshitdev/library nextjs-validatorpython3 ~/.claude/skills/nextjs-validator/scripts/validate.py --root .
python3 ~/.claude/skills/nextjs-validator/scripts/validate.py --root . --strict// GOOD: v16+
"next": "^16.0.0"
// BAD: v15 or earlier
"next": "^15.0.0"// proxy.ts (Node.js runtime - REQUIRED)
import { createProxy } from 'next/proxy';
export const proxy = createProxy();// middleware.ts (Edge runtime - DEPRECATED)
export function middleware() { }app/
├── layout.tsx # Root layout
├── page.tsx # Home page
├── (routes)/ # Route groups
│ ├── dashboard/
│ │ └── page.tsx
│ └── settings/
│ └── page.tsx
└── api/ # API routes (optional)pages/
├── _app.tsx
├── index.tsx
└── api/use cache// app/dashboard/page.tsx
'use cache';
export default async function Dashboard() {
const data = await fetch('/api/data');
return <DashboardView data={data} />;
}// app/actions.ts
'use server';
export async function createItem(formData: FormData) {
// Server-side logic
}// next.config.ts (Turbopack is default, no config needed)// Don't disable unless absolutely necessary
experimental: {
turbo: false // BAD
}// next.config.ts
import type { NextConfig } from 'next';
const config: NextConfig = {
// ...
};
export default config;// next.config.js - Prefer .ts
module.exports = { }| Deprecated (v15-) | Replacement (v16+) |
|---|---|
| |
| Server Components + |
| Server Components + |
| |
| |
| |
| |
| |
| |
'use cache';
// Entire component cached
export default async function CachedPage() {
const data = await fetchData();
return <View data={data} />;
}// next.config.ts
const config: NextConfig = {
experimental: {
ppr: true,
},
};// Enable in development
// Works with Claude Code and other MCP-compatible toolsapp/
├── @modal/
│ └── login/
│ └── page.tsx
├── @sidebar/
│ └── default.tsx
└── layout.tsxapp/
├── feed/
│ └── page.tsx
├── photo/
│ └── [id]/
│ └── page.tsx
└── @modal/
└── (.)photo/
└── [id]/
└── page.tsx=== Next.js 16 Validation Report ===
Package Version: next@16.1.0 ✓
File Structure:
✓ Using app/ directory (App Router)
✗ Found pages/ directory - migrate to App Router
✓ Found proxy.ts
✗ Found middleware.ts - migrate to proxy.ts
Patterns:
✓ Using Server Components
✗ Found getServerSideProps in 2 files
✓ Using next/navigation
Config:
✓ next.config.ts (TypeScript)
✓ Turbopack enabled (default)
Summary: 2 issues found
- Migrate pages/ to app/ directory
- Replace middleware.ts with proxy.ts// middleware.ts
import { NextResponse } from 'next/server';
export function middleware(request) {
// Edge runtime
return NextResponse.next();
}
export const config = {
matcher: ['/dashboard/:path*'],
};// proxy.ts
import { createProxy } from 'next/proxy';
export const proxy = createProxy({
// Node.js runtime
async handle(request) {
// Full Node.js APIs available
return request;
},
matcher: ['/dashboard/:path*'],
});// pages/dashboard.tsx
export async function getServerSideProps() {
const data = await fetchData();
return { props: { data } };
}
export default function Dashboard({ data }) {
return <View data={data} />;
}// app/dashboard/page.tsx
export default async function Dashboard() {
const data = await fetchData();
return <View data={data} />;
}# .github/workflows/validate.yml
- name: Validate Next.js 16
run: |
python3 ~/.claude/skills/nextjs-validator/scripts/validate.py \
--root . \
--strict \
--citailwind-validatorbiome-validatorclerk-validator