react-best-practices

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js codebases often suffer from slow load times, unnecessary re-renders, and bloated bundles because developers miss subtle performance pitfalls. This Skill provides 45 prioritized, battle-tested rules from Vercel Engineering so AI agents and developers consistently generate performant code. ## Core Features & Use Cases - Waterfall Elimination: Rules for parallelizing async operations with Promise.all(), better-all, and strategic Suspense boundaries to cut network latency. - Bundle Size Optimization: Guidance on avoiding barrel file imports, dynamic imports for heavy components, and deferring third-party libraries. - Server & Client Optimization: Covers React.cache() deduplication, LRU caching, SWR patterns, re-render reduction, and JavaScript micro-optimizations. - Use Case: When reviewing a Next.js page that loads slowly, apply the skill to identify sequential awaits in route handlers, barrel imports from icon libraries, and missing Suspense boundaries, then refactor with concrete before/after code examples. ## Quick Start Review my React component and Next.js API route for performance issues using the react-best-practices guidelines and suggest fixes.

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 promises immediately without awaiting them, then await Promise.all() at the point of use. For partial dependency chains, use the better-all library to automatically maximize parallelism, yielding 2-10x improvements.

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

Import directly from source files instead of barrel entry points, such as importing from lucide-react/dist/esm/icons/check rather than lucide-react. In Next.js 13.5+, configure optimizePackageImports to transform barrel imports automatically at build time.

What is the difference between React.cache() and LRU caching?▼

React.cache() deduplicates requests only within a single server request, ideal for authentication and database queries. LRU caching persists data across sequential requests, useful when multiple user actions hit endpoints needing the same data.

Does this skill work with React Compiler enabled projects?▼

Yes, though some manual optimizations become unnecessary. The React Compiler automatically handles memoization and static JSX hoisting, but rules on waterfalls, bundle size, and functional setState updates remain recommended for correctness.

When should I not use Suspense boundaries for data fetching?▼

Avoid Suspense when data drives 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 during streaming.

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

Common causes include subscribing to continuous values instead of derived booleans, wide effect dependencies on objects rather than primitives, and reading state in subscriptions only used inside callbacks. Narrow dependencies and use media query hooks for derived state.