nextjs

Detect deprecated Pages Router patterns and invalid Server/Client boundaries in Next.js App Router code.

Updated Mar 22, 2018
One-click install
npx skills add https://github.com/tnunamak/dotfiles --skill nextjs-tnunamak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs
Source: https://github.com/tnunamak/dotfiles/tree/main/ai/skills/local/nextjs
Command: npx skills add https://github.com/tnunamak/dotfiles --skill nextjs-tnunamak

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you avoid common Next.js App Router mistakes and rapidly move from outdated Pages Router patterns to the correct App Router approaches for routing, Server Components, data fetching, caching, and metadata.

Core Features & Use Cases

  • App Router architecture guidance: Covers layouts, route segments, middleware/proxy (Next.js 16 rename), and deployment expectations on Vercel.
  • Server vs client correctness: Detects invalid React Server Component boundaries and issues like missing 'use client' or incorrect async usage.
  • Migration and modernization rules: Flags Pages Router patterns (getServerSideProps/getStaticProps, next/router, next/head, _app/_document) and deprecated Next.js APIs (cookies/headers/params/searchParams async changes, cacheHandler→cacheHandlers, revalidateTag signature changes).
  • Code-quality checks: Validates common pitfalls for routing handlers, caching, error handling, metadata (generateMetadata/export metadata), fonts, images, and bundling-related SSR issues.

Quick Start

Ask: "Review my Next.js codebase and tell me what I should change to correctly use the App Router (Server Components, route handlers, middleware→proxy, and async params/cookies/headers) and provide targeted migration fixes."

Frequently Asked Questions about nextjs

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

FAQPage Schema
How do I migrate Next.js Pages Router patterns like getServerSideProps to the App Router?

To migrate Next.js Pages Router patterns, identify outdated approaches like getServerSideProps, getStaticProps, and next/router, then replace them with App Router equivalents using Server Components for data fetching and the new routing conventions for navigation.

Why are my async params, searchParams, cookies, or headers failing in Next.js 15+?

In Next.js 15+, params, searchParams, cookies, and headers are asynchronous and must be awaited. Failing to await these APIs in Server Components or route handlers causes data-fetching and rendering errors.

How do I correctly use generateMetadata and export metadata in Next.js App Router?

Next.js App Router metadata requires exporting a static metadata object or an asynchronous generateMetadata function from your layout or page. It replaces next/head and dynamically generates SEO tags based on route params and fetched data.

When should I use 'use client' and avoid invalid Server Component boundaries in Next.js?

Use 'use client' when you need interactivity, state, or browser APIs, isolating it to the smallest component subtree. Detect invalid boundaries by checking if Server Components incorrectly attempt to use hooks or event handlers.

What is the best way to migrate Next.js middleware to proxy conventions?

Migrating Next.js middleware to proxy conventions involves updating your routing logic to the Next.js 16 proxy architecture. This ensures correct request interception and response modification before hitting the App Router.

Does my Next.js App Router codebase have deprecated caching or revalidateTag API issues?

Next.js App Router enforces specific caching signatures, including revalidateTag and cacheHandlers (formerly cacheHandler). Validate your route handlers and caching logic against current API expectations to avoid stale data and runtime errors.