
react-best-practices
Vercel's React and Next.js performance guide packaged as a skill with 57 rules across eight categories.
- version
- 3.12.0
- GitHub stars
- 250
What it does
- Adds the
react-best-practicesskill with 57 rules covering waterfalls, bundle size, server and client components, and re-renders - Ranks rule categories by impact, from CRITICAL async waterfall and bundle fixes down to LOW advanced patterns
- Provides incorrect versus correct code examples for each rule, with a concise SKILL.md and a full AGENTS.md guide
- Designed for writing, reviewing, or refactoring React and Next.js code, and for debugging hydration errors
React and Next.js performance optimization guidelines from Vercel Engineering. Use when writing/reviewing/refactoring React code for optimal performance. Covers async patterns, bundle optimization, server/client components, re-render optimization.
Add marketplace
/plugin marketplace add secondsky/claude-skillsRun it inside Claude Code once, then install the plugin below.
Install
/plugin install react-best-practices@claude-skillsRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceVercel React Best Practices
Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 57 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Writing new React components or Next.js pages
- Implementing data fetching (client or server-side)
- Reviewing code for performance issues
- Refactoring existing React/Next.js code
- Optimizing bundle size or load times
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Eliminating Waterfalls | CRITICAL | async- |
| 2 | Bundle Size Optimization | CRITICAL | bundle- |
| 3 | Server-Side Performance | HIGH | server- |
| 4 | Client-Side Data Fetching | MEDIUM-HIGH | client- |
| 5 | Re-render Optimization | MEDIUM | rerender- |
| 6 | Rendering Performance | MEDIUM | rendering- |
| 7 | JavaScript Performance | LOW-MEDIUM | js- |
| 8 | Advanced Patterns | LOW | advanced- |
Quick Reference
1. Eliminating Waterfalls (CRITICAL)
async-defer-await- Move await into branches where actually usedasync-parallel- Use Promise.all() for independent operationsasync-dependencies- Use better-all for partial dependenciesasync-api-routes- Start promises early, await late in API routesasync-suspense-boundaries- Use Suspense to stream content
2. Bundle Size Optimization (CRITICAL)
bundle-barrel-imports- Import directly, avoid barrel filesbundle-dynamic-imports- Use next/dynamic for heavy componentsbundle-defer-third-party- Load analytics/logging after hydrationbundle-conditional- Load modules only when feature is activatedbundle-preload- Preload on hover/focus for perceived speed
3. Server-Side Performance (HIGH)
server-cache-react- Use React.cache() for per-request deduplicationserver-cache-lru- Use LRU cache for cross-request cachingserver-serialization- Minimize data passed to client componentsserver-parallel-fetching- Restructure components to parallelize fetchesserver-after-nonblocking- Use after() for non-blocking operationsserver-auth-actions- Authenticate server actions like API routesserver-dedup-props- Avoid duplicate serialization in RSC props
4. Client-Side Data Fetching (MEDIUM-HIGH)
client-swr-dedup- Use SWR for automatic request deduplicationclient-event-listeners- Deduplicate global event listeners
5. Re-render Optimization (MEDIUM)
rerender-defer-reads- Don't subscribe to state only used in callbacksrerender-memo- Extract expensive work into memoized componentsrerender-dependencies- Use primitive dependencies in effectsrerender-derived-state- Subscribe to derived booleans, not raw valuesrerender-functional-setstate- Use functional setState for stable callbacksrerender-lazy-state-init- Pass function to useState for expensive valuesrerender-transitions- Use startTransition for non-urgent updatesrerender-memo-with-default-value- Hoist default non-primitive propsrerender-derived-state-no-effect- Derive state during render, not effectsrerender-simple-expression-in-memo- Avoid memo for simple primitivesrerender-move-effect-to-event- Put interaction logic in event handlersrerender-use-ref-transient-values- Use refs for transient frequent values
6. Rendering Performance (MEDIUM)
rendering-animate-svg-wrapper- Animate div wrapper, not SVG elementrendering-content-visibility- Use content-visibility for long listsrendering-hoist-jsx- Extract static JSX outside componentsrendering-svg-precision- Reduce SVG coordinate precisionrendering-hydration-no-flicker- Use inline script for client-only datarendering-activity- Use Activity component for show/hiderendering-conditional-render- Use ternary, not && for conditionalsrendering-hydration-suppress-warning- Suppress expected mismatchesrendering-usetransition-loading- Prefer useTransition for loading state
7. JavaScript Performance (LOW-MEDIUM)
js-batch-dom-css- Group CSS changes via classes or cssTextjs-index-maps- Build Map for repeated lookupsjs-cache-property-access- Cache object properties in loopsjs-cache-function-results- Cache function results in module-level Mapjs-cache-storage- Cache localStorage/sessionStorage readsjs-combine-iterations- Combine multiple filter/map into one loopjs-length-check-first- Check array length before expensive comparisonjs-early-exit- Return early from functionsjs-hoist-regexp- Hoist RegExp creation outside loopsjs-min-max-loop- Use loop for min/max instead of sortjs-set-map-lookups- Use Set/Map for O(1) lookupsjs-tosorted-immutable- Use toSorted() for immutability
8. Advanced Patterns (LOW)
advanced-event-handler-refs- Store event handlers in refsadvanced-use-latest- useLatest for stable callback refsadvanced-init-once- Initialize app once per app load
How to Use
Read individual rule files for detailed explanations and code examples:
rules/async-parallel.md
rules/bundle-barrel-imports.md
rules/_sections.md
Each rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and references
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
Readme
React Best Practices
Status: ✅ Production Ready Version: 1.0.0 (Vercel source) Last Updated: 2026-01-28
Comprehensive React and Next.js performance optimization guide from Vercel Engineering, containing 57 rules across 8 categories.
What This Skill Provides
✅ Eliminating Waterfalls (CRITICAL) - 5 rules for async optimization ✅ Bundle Size Optimization (CRITICAL) - 5 rules for reducing bundle size ✅ Server-Side Performance (HIGH) - 7 rules for SSR optimization ✅ Client-Side Data Fetching (MEDIUM-HIGH) - 2 rules for client optimization ✅ Re-render Optimization (MEDIUM) - 12 rules for preventing unnecessary renders ✅ Rendering Performance (MEDIUM) - 9 rules for efficient rendering ✅ JavaScript Performance (LOW-MEDIUM) - 14 rules for JS optimization ✅ Advanced Patterns (LOW) - 3 rules for advanced techniques
Total: 57 production-tested rules with incorrect vs correct examples
When to Use This Skill
Use this skill when:
- Writing new React components or Next.js pages
- Reviewing code for performance issues
- Refactoring existing React/Next.js applications
- Optimizing bundle size or load times
- Debugging hydration errors, re-render issues, or memory leaks
- Implementing async patterns, server components, or streaming
Structure
- SKILL.md - Concise overview with rule categories (~1,500 words)
- AGENTS.md - Full compiled guide with all rules expanded (~40,000 words)
- rules/ - 57 individual rule files for granular reference
- metadata.json - Version and attribution metadata
Attribution
This skill packages Vercel's React Best Practices guide for Claude Code.
Original Author: @shuding (Vercel Engineering) Source: https://github.com/vercel-labs/agent-skills/tree/main/skills/react-best-practices Packaging: Claude Skills Maintainers License: MIT
We are grateful to Vercel for creating and open-sourcing this comprehensive guide.
Installation
# Add the marketplace once (if not already added)
/plugin marketplace add https://github.com/secondsky/claude-skills
# Install this plugin
/plugin install react-best-practices@claude-skills
Usage Examples
Example 1: Optimize Re-renders
Ask: "How can I prevent unnecessary re-renders in my React component?"
Claude will:
- Reference SKILL.md re-render optimization section
- Suggest memo, useMemo, useCallback patterns
- Provide code examples from rules/
Example 2: Reduce Bundle Size
Ask: "My React bundle is too large, help me reduce it"
Claude will:
- Reference bundle optimization rules
- Suggest dynamic imports, tree-shaking, direct imports
- Show examples from rules/bundle-*.md
Example 3: Fix Hydration Errors
Ask: "I'm getting hydration mismatches in Next.js"
Claude will:
- Reference hydration and server component patterns
- Explain common causes and solutions
- Point to specific rules/rendering-hydration-no-flicker.md
Progressive Disclosure
SKILL.md (auto-loaded): Quick reference, rule categories, top errors AGENTS.md (on request): Full guide with all 57 rules expanded rules/ (on request): Individual rule files for specific topics
Ask Claude to "Load AGENTS.md" for the comprehensive guide.
Related Skills
nextjs- Next.js framework patternstanstack-query- Data fetching optimizationreact-hook-form-zod- Form validation patternszustand-state-management- State managementtailwind-v4-shadcn- UI component styling
Support
- Documentation: See SKILL.md and AGENTS.md in skills/react-best-practices/
- Issues: https://github.com/secondsky/claude-skills/issues
- Original Source: https://github.com/vercel-labs/agent-skills
Details
- Marketplace
- secondsky/claude-skills
- Source
- plugins/react-best-practices
- Category
- Frontend
- Keywords
- react-best-practices, react, best, practices, frontend, components, refactoring, async
- Listed since
- Apr 7, 2026
More from secondsky/claude-skills
All 122- react-composition-patternsv3.12.0
- react-hook-form-zodv3.12.0
- react-native-skillsv3.12.0
- recommendation-enginev3.12.0
- recommendation-systemv3.12.0
- responsive-web-designv3.12.0
- rest-api-designv3.12.0
- root-cause-tracingv3.12.0
- security-headers-configurationv3.12.0
- seo-keyword-cluster-builderv3.12.0
- seo-optimizerv3.12.0
- sequential-thinkingv3.12.0
- session-managementv3.12.0
- shadcn-vuev3.12.0
- systematic-debuggingv3.12.0
- tailwind-v4-shadcnv3.12.0
- tanstack-aiv3.12.0
- tanstack-queryv3.12.0
- tanstack-routerv3.12.0
- tanstack-startv3.12.0
- tanstack-tablev3.12.0
- tech-debtv3.12.0
- technical-specificationv3.12.0
- test-quality-analysisv3.12.0
Similar to react-best-practices
More Frontend & UI Code
vercel-react-best-practicesSkillvercel-labs/agent-skills905.6K installsPerformance guide of 70 React and Next.js rules, ordered by impact from waterfalls to advanced patterns.
react-performanceSkillaffaan-m/ecc6.4K installsReact and Next.js performance rules grouped into 8 priority categories, from waterfalls to advanced patterns.
react-skillsPluginfcakyon/claude-codex-settings1.2K starsReact, Next.js, and React Native best practices with web design guidelines.
nextjsPluginvercel/next.js143.7K starsOfficial Next.js skills: adopt and optimize Cache Components, adopt Partial Prefetching, and verify runtime behavior against a running dev server.
nextjs-vercel-proPlugindavila7/claude-code-templates24.2K starsComplete Next.js and Vercel development toolkit with deployment automation and performance optimization
frontend-excellencePlugindotclaude/marketplace43 starsModern React and UI development. Master React 19, Next.js 15, component architecture, state management, and performance optimization.