react-best-practices

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

1|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/rockcookies/skills --skill react-best-practices-rockcookies
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/rockcookies/skills/tree/main/skills/vercel-agent/react-best-practices
Command: npx skills add https://github.com/rockcookies/skills --skill react-best-practices-rockcookies

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js codebases often ship with hidden performance problems: sequential async waterfalls, bloated bundles from barrel imports, unnecessary re-renders, and unauthenticated Server Actions. This Skill gives an AI agent a prioritized, rule-based checklist from Vercel Engineering so generated and refactored code follows proven performance patterns from the start. ## Core Features & Use Cases - 70 Prioritized Rules Across 8 Categories: Covers eliminating waterfalls, bundle size optimization, server-side performance, client-side data fetching, re-render optimization, rendering performance, JavaScript micro-optimizations, and advanced patterns, each tagged by impact from CRITICAL to LOW. - Incorrect vs. Correct Code Examples: Every rule includes concrete TypeScript/TSX examples showing the anti-pattern and the fix, plus impact metrics (e.g., 2-10x improvement from parallelizing fetches, 200-800ms savings from avoiding barrel imports). - Use Case: When asked to review a Next.js page that fetches user, posts, and comments sequentially, the agent applies the Promise.all() and Suspense boundary rules to eliminate the waterfall and stream the layout immediately. ## Quick Start Ask the agent to review your React component or Next.js page for performance issues using the react-best-practices guidelines.

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 async waterfalls in Next.js API routes?▼

Start independent operations immediately without awaiting them, then await the promises later. Use Promise.all() for independent fetches and the better-all library for operations with partial dependencies, yielding 2-10x improvement.

How to reduce bundle size from barrel file imports in React?▼

Avoid importing from barrel files like lucide-react or @mui/material entry points, which can load thousands of modules. In Next.js 13.5+, use optimizePackageImports; otherwise import directly from subpaths like @mui/material/Button.

Does this skill work with Next.js Server Actions and RSC?▼

Yes, it includes dedicated server-side rules: authenticate Server Actions like public API routes, use React.cache() for per-request deduplication, avoid shared module state for request data, and minimize serialization at RSC boundaries.

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, when queries are small and fast, or when you want to prevent layout shift between loading and loaded states.

Why does my React component re-render too often?▼

Common causes include defining components inside components, missing memoization of expensive work, broad effect dependencies, and subscribing to raw state instead of derived values. The re-render optimization rules cover functional setState, useDeferredValue, and lazy state initialization.