
React Best Practices
Apply Vercel-style React and Next.js performance rules when a solo builder is shaving bundle size, killing waterfalls, or fixing slow renders before release.
Install
npx skills add https://github.com/davila7/claude-code-templates --skill react-best-practicesWhat is this skill?
- 40+ rules grouped by impact from CRITICAL (waterfalls, bundle size) through MEDIUM (re-render tuning)
- Covers Next.js server components, server-side data fetching, and client cache patterns
- Explicit guidance to eliminate async waterfalls and reduce initial JavaScript payload
- Fits optimization passes, perf-oriented refactors, and review of existing React/Next features
- MIT guide attributed to Vercel Engineering patterns for modern App Router stacks
Adoption & trust: 477 installs on skills.sh; 27.9k GitHub stars; 2/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Performance bottlenecks and bundle regressions are usually caught and fixed in the ship window when the app must feel fast in production, even though the edits happen in frontend code. The skill is organized as 40+ impact-ranked perf rules (waterfalls, bundles, RSC, re-renders)—a perf playbook, not a greenfield UI tutorial.
Common Questions / FAQ
Is React Best Practices safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - React Best Practices
# React Best Practices - Performance Optimization Comprehensive performance optimization guide for React and Next.js applications with 40+ rules organized by impact level. Designed to help developers eliminate performance bottlenecks and follow best practices. ## When to use this skill **Use React Best Practices when:** - Optimizing React or Next.js application performance - Reviewing code for performance improvements - Refactoring existing components for better performance - Implementing new features with performance in mind - Debugging slow rendering or loading issues - Reducing bundle size - Eliminating request waterfalls **Key areas covered:** - **Eliminating Waterfalls** (CRITICAL): Prevent sequential async operations - **Bundle Size Optimization** (CRITICAL): Reduce initial JavaScript payload - **Server-Side Performance** (HIGH): Optimize RSC and data fetching - **Client-Side Data Fetching** (MEDIUM-HIGH): Implement efficient caching - **Re-render Optimization** (MEDIUM): Minimize unnecessary re-renders - **Rendering Performance** (MEDIUM): Optimize browser rendering - **JavaScript Performance** (LOW-MEDIUM): Micro-optimizations for hot paths - **Advanced Patterns** (LOW): Specialized techniques for edge cases ## Quick reference ### Critical priorities 1. **Defer await until needed** - Move awaits into branches where they're used 2. **Use Promise.all()** - Parallelize independent async operations 3. **Avoid barrel imports** - Import directly from source files 4. **Dynamic imports** - Lazy-load heavy components 5. **Strategic Suspense** - Stream content while showing layout ### Common patterns **Parallel data fetching:** ```typescript const [user, posts, comments] = await Promise.all([ fetchUser(), fetchPosts(), fetchComments() ]) ``` **Direct imports:** ```tsx // ❌ Loads entire library import { Check } from 'lucide-react' // ✅ Loads only what you need import Check from 'lucide-react/dist/esm/icons/check' ``` **Dynamic components:** ```tsx import dynamic from 'next/dynamic' const MonacoEditor = dynamic( () => import('./monaco-editor'), { ssr: false } ) ``` ## Using the guidelines The complete performance guidelines are available in the references folder: - **react-performance-guidelines.md**: Complete guide with all 40+ rules, code examples, and impact analysis Each rule includes: - Incorrect/correct code comparisons - Specific impact metrics - When to apply the optimization - Real-world examples ## Categories overview ### 1. Eliminating Waterfalls (CRITICAL) Waterfalls are the #1 performance killer. Each sequential await adds full network latency. - Defer await until needed - Dependency-based parallelization - Prevent waterfall chains in API routes - Promise.all() for independent operations - Strategic Suspense boundaries ### 2. Bundle Size Optimization (CRITICAL) Reducing initial bundle size improves Time to Interactive and Largest Contentful Paint. - Avoid barrel file imports - Conditional module loading - Defer non-critical third-party libraries - Dynamic imports for heavy components - Preload based on user intent ### 3. Server-Side Performance (HIGH) Optimize server-side rendering and data fetching. - Cross-request LRU caching - Minimize serialization at RSC boundaries - Parallel data fetching with component composition - Per-request deduplication with React.cache() ### 4. Client-Side Data Fetching (MEDIUM-HIGH) Automatic deduplication and efficient data fetching patterns. - Deduplicate global event listeners - Use SWR for automati