nextjs-anti-patterns

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

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/mcclowes/puzzles --skill nextjs-anti-patterns
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nextjs-anti-patterns
Source: https://github.com/mcclowes/puzzles/tree/main/.claude/skills/nextjs-anti-patterns
Command: npx skills add https://github.com/mcclowes/puzzles --skill nextjs-anti-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps identify and fix common Next.js App Router anti-patterns, such as misuse of useEffect, improper client/server boundaries, and inefficient data-fetching patterns.

Core Features & Use Cases

  • Anti-pattern detection: Identify overuse of useEffect for data fetching or browser checks.
  • Server-first patterns: Promote server components for data fetching and SSR benefits.
  • Performance improvements: Eliminate unnecessary client-side JavaScript and hydration issues.

Quick Start

Audit a Next.js App Router project for common anti-patterns, then refactor components to prefer server components, minimal client components, and proper data-fetching patterns.

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 useEffect anti-patterns in Next.js App Router?▼

useEffect for data fetching is an anti-pattern in Next.js App Router. Instead, fetch data directly in server components or use route handlers, which eliminate unnecessary client-side JavaScript and hydration mismatches while improving performance.

Why should I use server components instead of client components in Next.js?▼

Server components in Next.js App Router enable direct database access, keep secrets server-side, and reduce client JavaScript bundle size. They handle SSR natively and eliminate common useEffect and browser-detection mistakes that hurt performance.

What's the best way to fetch data in Next.js App Router?▼

Fetch data directly in server components using async functions, or use route handlers for client-side requests. Avoid useEffect-based fetching, which causes hydration issues and duplicates requests. This approach improves SSR safety and performance.

How do I refactor Pages Router code to App Router patterns?▼

When migrating from Pages Router to App Router, replace getServerSideProps and getStaticProps with server component async functions, move client-side state into Client Components marked with 'use client', and eliminate useEffect data fetching in favor of server-side patterns.

What are improper server and client component boundaries in Next.js?▼

Improper boundaries occur when you use client components for data fetching, browser detection, or state management that should happen server-side. Next.js App Router anti-pattern detection identifies these misplacements and helps enforce correct component roles for optimal rendering and performance.

Can I use browser APIs like localStorage in Next.js server components?▼

No—browser APIs fail in server components and cause hydration errors. Anti-pattern detection catches direct browser checks and localStorage access in server contexts, guiding you to isolate these in Client Components or eliminate them entirely through server-side patterns.