nextjs-anti-patterns

Detect and fix Next.js App Router anti-patterns during code reviews.

109|21|Updated Oct 23, 2025
One-click install
npx skills add https://github.com/wsimmonds/claude-nextjs-skills --skill nextjs-anti-patterns-wsimmonds
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-anti-patterns
Source: https://github.com/wsimmonds/claude-nextjs-skills/tree/main/nextjs-anti-patterns
Command: npx skills add https://github.com/wsimmonds/claude-nextjs-skills --skill nextjs-anti-patterns-wsimmonds

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps detect and fix common Next.js App Router anti-patterns, such as misused useEffect, improper data fetching, and incorrect component boundaries.

Core Features & Use Cases

  • Detect misuse of useEffect for data fetching and browser detection
  • Provide correct server vs client patterns and migration tips
  • Code review guidance to avoid common pitfalls during migration

Quick Start

Run a code-review pass with this Skill to identify anti-patterns in a Next.js project and apply recommended fixes.

Frequently Asked Questions about nextjs-anti-patterns

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

FAQPage Schema
How do I identify Next.js App Router anti-patterns in my code?

Next.js App Router anti-patterns include misused useEffect for data fetching, unnecessary client-side state, incorrect Server/Client component boundaries, and browser detection outside proper contexts. This Skill detects these issues during code reviews and migrations, flagging violations like useEffect-driven data fetching and explicit any types in TypeScript.

Why shouldn't I use useEffect for data fetching in Next.js App Router?

useEffect for data fetching is an anti-pattern in App Router because Server Components handle data fetching directly. useEffect runs only on the client, delaying data retrieval, increasing bundle size, and breaking Server Component benefits. Use async Server Components or route handlers instead.

What's the correct way to handle browser detection in Next.js App Router?

Browser detection must occur directly in Client Components without useEffect wrappers. Store detection logic in dedicated Client Components and import them where needed. This prevents hydration mismatches and unnecessary client-side overhead compared to useEffect-based detection.

How do I migrate from Pages Router to App Router without anti-patterns?

App Router migration requires reclassifying components as Server or Client, moving data fetching from useEffect into Server Components, and removing unnecessary client-side state. This Skill provides migration guidance during code reviews to enforce correct component boundaries and data-fetching patterns.

Can I use useState and useEffect together in App Router Server Components?

No. useState and useEffect are Client-only hooks and cannot run in Server Components. Use them only in Client Components marked with 'use client'. For state in Server Components, use Server Actions or route handlers instead.

What TypeScript practices does App Router enforce?

App Router best practices forbid explicit any types in TypeScript, requiring proper type safety across components. This Skill flags any usage violations during code reviews to maintain type safety and catch potential runtime errors early.