react-best-practices

Applies 57 prioritized React and Next.js performance optimization rules to eliminate waterfalls and reduce bundle size.

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill react-best-practices-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/.agent/skills/nextjs-react-expert
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill react-best-practices-virahitvin8

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React and Next.js applications often suffer from slow page loads, large bundles, sequential data fetching waterfalls, and unnecessary re-renders. This Skill provides a structured, impact-prioritized rule set from Vercel Engineering to diagnose and fix these performance issues systematically. ## Core Features & Use Cases - Waterfall Elimination: Rules for parallel data fetching with Promise.all(), dependency-based parallelization, Suspense boundaries, and Next.js 16 after()/connection() APIs. - Bundle Size Optimization: Guidance on avoiding barrel file imports, dynamic imports with next/dynamic, conditional module loading, and preloading based on user intent. - Server & Client Optimization: Covers Server Action authentication, RSC serialization minimization, React.cache() deduplication, SWR patterns, re-render reduction, and Next.js 16 cache components (use cache, cacheLife, cacheTag, PPR). - Use Case: When reviewing a slow Next.js page, follow the quick decision tree to identify whether the issue is waterfalls, bundle size, SSR, or re-renders, then read only the relevant section and apply the fixes in priority order. ## Quick Start Review my Next.js page component for performance issues and fix any data fetching waterfalls or bundle size problems.

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 Next.js?

Start independent async operations immediately and await them together with Promise.all() instead of sequential awaits. For partial dependencies, use better-all or chain promises, and use Suspense boundaries so layout renders while data streams in.

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

Avoid barrel file imports from libraries like lucide-react or @mui/material by importing directly from source files, or enable optimizePackageImports in next.config.js. Use next/dynamic to lazy-load heavy components not needed on initial render.

Does this skill support Next.js 16 cache components?

Yes, it includes a dedicated section on Next.js 16 features: the use cache directive, cacheLife profiles, cacheTag for on-demand invalidation, and Partial Pre-Rendering via Suspense boundaries. These patterns should not be applied to Next.js 15 or earlier.

When should I use React.cache() versus an LRU cache?

React.cache() deduplicates work within a single request, ideal for auth checks and database queries in one render pass. Use an LRU cache like lru-cache when data must persist across sequential requests, such as repeated user actions hitting multiple endpoints.

Why does my React component re-render too often?

Common causes include storing derived state instead of computing it during render, subscribing to continuous values instead of derived booleans, and unstable callback references. Use functional setState updates, narrow effect dependencies, and memoization to reduce re-renders.