nextjs

Guides building, debugging, and architecting Next.js App Router applications with best practices.

Updated Jul 31, 2026
One-click install
npx skills add https://github.com/AarnavBaddam/skills --skill nextjs-aarnavbaddam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs
Source: https://github.com/AarnavBaddam/skills/tree/main/nextjs
Command: npx skills add https://github.com/AarnavBaddam/skills --skill nextjs-aarnavbaddam

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Next.js App Router introduces complex concepts like Server Components, async request APIs, caching directives, and file-based routing conventions that are easy to misuse, causing hydration errors, bundling failures, and broken deployments. This Skill provides expert guidance and reference documentation to write correct Next.js code and diagnose common pitfalls. ## Core Features & Use Cases - App Router Guidance: Covers file conventions, route segments, parallel and intercepting routes, middleware/proxy migration, and Route Handlers. - RSC Boundary Validation: Detects invalid patterns like async client components and non-serializable props crossing Server/Client boundaries. - Debugging & Optimization: Provides fixes for hydration errors, bundling issues with third-party packages, image/font optimization, and MCP-based dev server debugging. - Use Case: When a page fails with "window is not defined" after adding a chart library, consult the bundling reference to fix it with a dynamic import or a client component wrapper. ## Quick Start Ask the assistant to review your Next.js page component for Server Component and async params best practices.

Frequently Asked Questions about nextjs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle async params and searchParams in Next.js 15?

In Next.js 15+, params and searchParams are Promises that must be awaited. Type them as Promise<{ slug: string }> and await them in pages, layouts, route handlers, and generateMetadata, or use React's use() hook in synchronous components.

How do I fix "window is not defined" errors in Next.js?

This error occurs when a package using browser APIs runs in a Server Component. Fix it by using dynamic import with ssr: false, wrapping usage in a client component, or adding the package to serverExternalPackages in next.config.js.

Should I use Server Actions or Route Handlers for mutations?

Use Server Actions for mutations triggered from your UI, such as form submissions, since they offer type safety and progressive enhancement. Use Route Handlers for external webhooks, public REST APIs, and third-party integrations.

Why does my Next.js modal route 404 on page refresh?

Parallel route slots like @modal require a default.tsx file that returns null. Without it, Next.js cannot determine what to render in the slot during hard navigation, causing a 404 on refresh.

Can I use metadata in Next.js client components?

No, the metadata object and generateMetadata function only work in Server Components. Remove 'use client' from the page, move client logic into child components, or define metadata in a parent Server Component layout.

How do I deploy Next.js with Docker using ISR on multiple instances?

Set output: 'standalone' in next.config.js for a minimal Docker build. For multi-instance ISR, configure a custom cacheHandler backed by Redis or S3, since the default filesystem cache is not shared between instances.