react-best-practices

Applies Vercel performance optimization rules when writing or refactoring React and Next.js code.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/po4yka/blog --skill react-best-practices-po4yka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/po4yka/blog/tree/main/.claude/skills/react-best-practices
Command: npx skills add https://github.com/po4yka/blog --skill react-best-practices-po4yka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js codebases often suffer from performance issues like data-fetching waterfalls, bloated bundles, and unnecessary re-renders that are hard to spot during development and code review. ## Core Features & Use Cases - 65 Prioritized Rules: Covers 8 categories ranked by impact, from eliminating async waterfalls (CRITICAL) to advanced hook patterns (LOW). - Incorrect vs. Correct Examples: Every rule includes side-by-side code comparisons with explanations and impact metrics for automated refactoring. - Use Case: When reviewing a Next.js page that fetches user, posts, and comments sequentially, apply the Promise.all() and Suspense boundary rules to cut load time from three round trips to one. ## Quick Start Review my React component for performance issues and apply the relevant best practice rules.

Frequently Asked Questions about react-best-practices

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

FAQPage Schema
How do I eliminate data fetching waterfalls in React?

Use Promise.all() for independent async operations and start promises early in API routes before awaiting them. For partial dependencies, chain dependent fetches or use the better-all library to maximize parallelism.

How to reduce bundle size in a Next.js application?

Avoid barrel file imports from libraries like lucide-react or @mui/material, use next/dynamic for heavy components, and defer non-critical third-party scripts until after hydration. Next.js 13.5+ can optimize package imports automatically via optimizePackageImports.

Does this guide apply to React without Next.js?

Yes, most rules apply to any React codebase, including re-render optimization, JavaScript performance, and client-side data fetching. Next.js-specific rules cover Server Components, Server Actions, and next/dynamic imports.

When should I not use Suspense boundaries for data fetching?

Avoid Suspense when data is critical for layout decisions, when content is SEO-critical above the fold, or when queries are small and fast. The trade-off is faster initial paint versus potential layout shift.

Why do Server Actions need authentication checks inside them?

Server Actions are exposed as public endpoints just like API routes, so middleware or layout guards alone are insufficient. Always verify authentication and authorization inside each action, and validate inputs with a schema like Zod.