.claude/skills/nextjs-16/SKILL.md
Next.js 16 App Router reference guide (NOT a verification skill — use /verify-nextjs for validation). Use when creating or modifying pages, layouts, routes, Server Actions, or Server Components. Covers params Promise pattern, PageProps typing, useActionState (replaces useFormState), Server/Client component boundaries, and Cache Components. 페이지/레이아웃/라우트/Server Action 작성 시 참조.
npx skillsauth add junnv93/equipment_management_system nextjs-16Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Version: 16.1.1 (Jan 2025)
// ❌ WRONG
export default function Page({ params }: { params: { slug: string } }) {
return <h1>{params.slug}</h1>
}
// ✅ CORRECT
export default async function Page(props: PageProps<'/blog/[slug]'>) {
const { slug } = await props.params
return <h1>{slug}</h1>
}
// ❌ DEPRECATED
import { useFormState } from 'react-dom';
// ✅ CORRECT
import { useActionState } from 'react';
any Types| Pattern | Key Points |
|---------|-----------|
| Static Page | Default export function, export const metadata |
| Dynamic Page | PageProps<'/blog/[slug]'>, await props.params, generateStaticParams |
| Root Layout | { children: React.ReactNode }, <html> + <body> |
| Server Action (Form) | 'use server', void return, revalidatePath |
| Server Action (State) | useActionState(action, initialState), returns data |
| Client Component | 'use client', useState/useEffect |
| Cache Components | 'use cache', cacheLife('hours'), cacheTag('posts') |
| Proxy (Middleware) | proxy.ts (root), export function proxy(), export const config |
| Need | Reference File | |------|---------------| | Project setup, folder conventions | reference/01-project-structure.md | | Pages, layouts, dynamic routes | reference/02-routing-pages.md | | Links, prefetching, streaming | reference/03-navigation.md | | Server vs Client Components | reference/04-server-client.md | | TypeScript patterns | reference/05-typescript.md | | Server Actions, form handling | reference/06-server-actions.md | | Metadata, SEO, OG images | reference/07-metadata-seo.md | | Cache Components, PPR | reference/08-cache-components.md | | Proxy (Middleware) | reference/09-proxy.md | | Data fetching (Server Components) | reference/10-fetching-data.md | | Data updating, revalidation | reference/11-updating-data.md | | Caching & revalidation config | reference/12-caching-revalidating.md | | Error handling (error.tsx) | reference/13-error-handling.md | | CSS & styling | reference/14-css.md | | Image optimization | reference/15-image-optimization.md | | Font optimization | reference/16-font-optimization.md | | API Routes (route.ts) | reference/17-route-handlers.md |
| File | Purpose |
|------|---------|
| page.tsx | Public route |
| layout.tsx | Shared wrapper |
| loading.tsx | Loading state |
| error.tsx | Error boundary ('use client' required) |
| not-found.tsx | 404 page |
| route.ts | API endpoint |
| proxy.ts | Middleware |
page.tsx, add PageProps<'/path/[param]'> if dynamicawait props.params for dynamic segmentsgenerateStaticParams if prerenderableloading.tsxactions.ts with 'use server'useActionState (returns data)revalidatePath/revalidateTagcacheComponents: true in next.config.ts'use cache' + cacheLife + cacheTag to cacheable components<Suspense>| Mistake | Fix |
|---------|-----|
| Not awaiting params | const { slug } = await props.params |
| Form action returns data | Use void + revalidatePath, or useActionState |
| Client Component for data fetching | Use Server Component, pass data to Client |
| Using <img> | Use next/image with <Image> |
| Missing error boundaries | Add error.tsx with 'use client' |
| No cache for dynamic content | Add 'use cache' + cacheLife |
any types?'use client' only when necessary?loading.tsx for dynamic routes?error.tsx)?testing
Verifies Zod validation pattern compliance — ZodValidationPipe usage (no class-validator), versionedSchema inclusion in state-change DTOs, controller pipe application, query DTO consistency. Run after adding/modifying DTOs or controller endpoints.
testing
Verifies cross-feature workflow E2E test coverage against critical-workflows.md checklist. Checks WF-01~WF-35 coverage, step completeness, role correctness, side-effect verification, and status transition assertions. Run after adding workflow tests or before PR.
testing
SSOT(Single Source of Truth) 임포트 소스를 검증합니다. 타입/enum/상수가 올바른 패키지에서 임포트되는지 확인. 타입/enum 추가/수정 후 사용.
development
Verifies SQL safety — LIKE wildcard escaping, N+1 query pattern detection, COUNT(DISTINCT) for fan-out JOINs, RBAC INNER JOIN enforcement. Run after adding/modifying search or list API endpoints.