nextjs-expert

Diagnose and fix Next.js App Router, data fetching, performance, and deployment issues.

3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill nextjs-expert-trudyan141
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-expert
Source: https://github.com/trudyan141/my-antigravity-agents-kit/tree/main/templates/.agent/skills/nextjs-expert
Command: npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill nextjs-expert-trudyan141

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Next.js applications frequently hit framework-specific problems like hydration errors, Server Component misuse, caching surprises, broken dynamic routes, and failed production builds. This Skill provides structured diagnosis commands and prioritized fix playbooks for each problem category. ## Core Features & Use Cases - Problem Playbooks: Step-by-step diagnosis and fixes for App Router, Server Components, data fetching, dynamic routes, API Route Handlers, middleware, and deployment. - Environment Detection: Shell commands to detect Next.js version, router type (App vs Pages), deployment config, and optimization usage. - Code Review Checklist: A structured checklist covering rendering strategy, caching, performance, and migration anti-patterns. - Use Case: Your page throws "Cannot use useState in Server Component". The Skill locates offending components with grep, then applies progressive fixes from adding 'use client' to restructuring component boundaries. ## Quick Start Ask the agent to diagnose why my Next.js page shows a hydration error and apply the recommended fix.

Frequently Asked Questions about nextjs-expert

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

FAQPage Schema
How do I fix hydration errors in Next.js App Router?

Hydration errors occur when server-rendered HTML differs from client rendering. Find browser API usage like window or localStorage in Server Components, then wrap those calls in typeof window checks or move the logic into Client Components marked with 'use client'.

How to fix "Cannot use useState in Server Component" error?

This error means a React hook is used in a Server Component. Add the 'use client' directive at the top of that component file, or better, extract the interactive part into a leaf-level Client Component to keep the rest server-rendered.

Why is my Next.js fetch data not updating on refresh?

Next.js caches fetch requests aggressively by default. Add cache: 'no-store' to the fetch options for dynamic data, or configure a revalidate value to use Incremental Static Regeneration with timed updates.

Does Next.js App Router support getServerSideProps?

No, getServerSideProps is a Pages Router API and does not work in the App Router. Migrate by fetching data directly inside async Server Components and using Route Handlers instead of pages/api routes.

Why is generateStaticParams not generating my dynamic pages?

generateStaticParams must return an array of objects whose keys match the dynamic segment names. Verify the return format, check file naming conventions like [slug], and inspect the build output for generated static paths.

How do I improve Next.js Core Web Vitals scores?

Use next/image with explicit dimensions and priority for above-fold images, apply next/font for font optimization, and reduce Client Component usage to shrink the JavaScript bundle. Validate improvements with Lighthouse audits.