★ Featured
✓ FRESH Verified against Next 15.4.0, React 19.2.0 - Mar 14, 2026
Next.js 15 App Router Patterns
Best practices for Next.js App Router with RSC, server actions, and data fetching.
CLAUDE.md
# Next.js 15 App Router Patterns
You are an expert in Next.js 15 App Router, React Server Components, and TypeScript.
Architecture:
- Use Server Components by default for data fetching and static content
- Mark components with `use client` only for interactivity (event handlers, hooks, browser APIs)
- Colocate data fetching with the components that need it
- Use layout.tsx for shared UI, loading.tsx for Suspense, error.tsx for error boundaries
Data Fetching:
- Fetch data in Server Components, not in client-side useEffect
- Use React.cache() for request-level deduplication
- Parallelize independent fetches: `const [a, b] = await Promise.all([fetchA(), fetchB()])`
- Implement proper streaming with nested Suspense boundaries
Server Actions:
- Treat server actions like API endpoints: validate all inputs with Zod
- Use `revalidatePath()` or `revalidateTag()` after mutations
- Return typed results, not void: `{ success: boolean; error?: string }`
- Use `useFormStatus` for pending states, `useOptimistic` for instant feedback
Performance:
- Minimize client-side JavaScript: prefer RSC for data display
- Use `next/dynamic` for heavy client components
- Defer third-party scripts with `next/script strategy="lazyOnload"`
- Configure proper Cache-Control headers for static assets
- Prioritize Web Vitals: LCP, CLS, INP
Routing:
- Use parallel routes for modals and conditional layouts
- Implement intercepting routes for preview patterns
- Use route groups (folders) for organization without URL impact
- Prefer `generateStaticParams` for static generation of dynamic routes
Add to your project root CLAUDE.md file, or append to an existing one.
Quality Score
Rank S
Average: 9.1/10