nextjs-anti-patterns

Identify and correct anti-patterns in Next.js App Router applications.

Updated Apr 23, 2025
One-click install
npx skills add https://github.com/Cyberworld-builders/legend --skill nextjs-anti-patterns-cyberworld-builders
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-anti-patterns
Source: https://github.com/Cyberworld-builders/legend/tree/main/.claude/skills/nextjs-anti-patterns
Command: npx skills add https://github.com/Cyberworld-builders/legend --skill nextjs-anti-patterns-cyberworld-builders

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill identifies and rectifies common anti-patterns in Next.js App Router applications, ensuring code quality, performance, and adherence to best practices.

Core Features & Use Cases

  • Anti-Pattern Detection: Pinpoints issues like incorrect useEffect or useState usage, inappropriate Server/Client component boundaries, and legacy Pages Router patterns.
  • Code Correction Guidance: Provides clear examples of wrong vs. correct implementations for various scenarios.
  • Use Case: When reviewing a Next.js project, use this Skill to automatically flag instances where useEffect is used for data fetching instead of Server Components, and suggest the correct implementation.

Quick Start

Review the provided Next.js code for common anti-patterns and suggest corrections.

Frequently Asked Questions about nextjs-anti-patterns

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

FAQPage Schema
How do I fix useEffect data fetching anti-patterns in Next.js App Router?

Fix Next.js App Router useEffect data fetching anti-patterns by migrating data retrieval logic into Server Components, eliminating unnecessary client-side state, and enforcing correct component boundaries to prevent waterfall requests and improve performance.

What are common Next.js App Router anti-patterns when migrating from the Pages Router?

Common Next.js App Router anti-patterns when migrating from the Pages Router include retaining legacy data fetching methods, misusing useEffect for client-side data synchronization, and drawing incorrect Server and Client component boundaries. Correcting these ensures proper rendering responsibilities and TypeScript adherence.

How do I review Next.js code for improper Server and Client component boundaries?

Review Next.js code for improper Server and Client component boundaries by identifying unnecessary client-side state and incorrect useEffect usage. Shift data fetching and static rendering responsibilities to Server Components to optimize performance and align with TypeScript best practices.

Does this Next.js code review approach require TypeScript?

This Next.js code review approach requires adherence to TypeScript best practices to effectively identify and correct anti-patterns. Applying TypeScript ensures accurate detection of unnecessary client-side state and enforces correct rendering responsibilities within the App Router.

When should I not use useEffect for state management in Next.js?

You should not use useEffect for state management in Next.js when the data can be fetched on the server or derived from URL parameters. Moving this logic to Server Components or optimizing component boundaries eliminates unnecessary client-side state and improves App Router performance.