dev-nextjs
Installation
SKILL.md
Next.js 15 App Router Best Practices
Warning: Next.js 15 has breaking changes from older versions. Before writing non-trivial code, check the relevant docs in node_modules/next/dist/docs/.
Critical Rules
- Never throw from server actions — return
{ error: string }so clients handle failures gracefully - No waterfall fetches — use
Promise.allfor independent queries paramsandsearchParamsare Promises in Next.js 15+ — alwaysawaitthem before accessing properties
Server vs Client Components
Default to Server Components. Add 'use client' only when you need:
useState,useReducer,useEffect, or other React hooks- Browser-only APIs (
window,document,localStorage) - Event handlers (
onClick,onChange, etc.) - Third-party client libraries that require a browser context