Agent skill

React Best Practices

by shapeshift in shapeshift/web

Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering.

MITAuto-check passedDevelopment

Install React Best Practices

skills CLI
$ npx skills add shapeshift/web --skill react-best-practices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install shapeshift/web react-best-practices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/shapeshift/web.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/react-best-practices .claude/skills/react-best-practices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
react-best-practices
GitHub stars
206
Used in
1 other repo
Token cost
~2k tokens
SKILL.md length
806 words
Files
48 (incl. references)
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering.

  • Works in 8 steps: Eliminating Waterfalls (CRITICAL) → Bundle Size Optimization (CRITICAL) → Server-Side Performance (HIGH) → …
  • Optimizing React apps
  • SKILL.md covers When to use this skill, Quick reference, Using the guidelines and Categories overview, plus 6 more sections
  • Runs Shell scripts from its folder

What it does

React Best Practices is an agent skill from shapeshift/web. Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering. Use when optimizing React apps, reviewing performance, or refactoring components.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 49 other files, including reference files (for example `references/react-performance-guidelines.md`, `references/rules/_sections.md` and `references/rules/_template.md`).

It sits in Development, covering React components, Performance optimization and Refactoring. It works with React, Next.js and JavaScript. The licence is MIT.

When your agent uses it

  • Optimizing React apps
  • Reviewing performance
  • Refactoring components

Example prompts

  • “/react-best-practices”

Requirements

  • A Bash shell

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Eliminating Waterfalls (CRITICAL)
  2. Bundle Size Optimization (CRITICAL)
  3. Server-Side Performance (HIGH)
  4. Client-Side Data Fetching (MEDIUM-HIGH)
  5. Re-render Optimization (MEDIUM)
  6. Rendering Performance (MEDIUM)
  7. JavaScript Performance (LOW-MEDIUM)
  8. Advanced Patterns (LOW)

What it can do on your machine

Read from SKILL.md and the folder at commit 52aebb2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Shell, from the files we listed), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • vercel.com
    • github.com
    • react.dev
    • nextjs.org
    • swr.vercel.app

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

React Best Practices loads about 2k tokens when it runs, and up to ~28k if it reads all its reference files. Until then it costs about 63 tokens; SKILL.md has 806 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~63
When it runs · the whole SKILL.md, loaded when a task matches
~2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~28k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from shapeshift/web at commit 52aebb2, republished under its MIT licence (© shapeshift). 806 words, ~1,983 tokens.

Download SKILL.mdSave it as .claude/skills/react-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 47 other files; get the full folder from GitHub.
name
react-best-practices
description
Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering. Use when optimizing React apps, reviewing performance, or refactoring components.
version
1.0.0
author
Vercel Engineering
license
MIT
tags
React, Next.js, Performance, Optimization, Best Practices, Bundle Size, Rendering, Server Components

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 automatic deduplication
5. Re-render Optimization (MEDIUM)

Reduce unnecessary re-renders to minimize wasted computation.

  • Defer state reads to usage point
  • Extract to memoized components
  • Narrow effect dependencies
  • Subscribe to derived state
  • Use lazy state initialization
  • Use transitions for non-urgent updates
6. Rendering Performance (MEDIUM)

Optimize the browser rendering process.

  • Animate SVG wrapper instead of SVG element
  • CSS content-visibility for long lists
  • Hoist static JSX elements
  • Optimize SVG precision
  • Prevent hydration mismatch without flickering
  • Use Activity component for show/hide
  • Use explicit conditional rendering
7. JavaScript Performance (LOW-MEDIUM)

Micro-optimizations for hot paths.

  • Batch DOM CSS changes
  • Build index maps for repeated lookups
  • Cache property access in loops
  • Cache repeated function calls
  • Cache storage API calls
  • Combine multiple array iterations
  • Early length check for array comparisons
  • Early return from functions
  • Hoist RegExp creation
  • Use loop for min/max instead of sort
  • Use Set/Map for O(1) lookups
  • Use toSorted() instead of sort()
Show full SKILL.md (303 more words)Show less
8. Advanced Patterns (LOW)

Specialized techniques for edge cases.

  • Store event handlers in refs
  • useLatest for stable callback refs

Implementation approach

When optimizing a React application:

  1. Profile first: Use React DevTools Profiler and browser performance tools to identify bottlenecks
  2. Focus on critical paths: Start with eliminating waterfalls and reducing bundle size
  3. Measure impact: Verify improvements with metrics (LCP, TTI, FID)
  4. Apply incrementally: Don't over-optimize prematurely
  5. Test thoroughly: Ensure optimizations don't break functionality

Key metrics to track

  • Time to Interactive (TTI): When page becomes fully interactive
  • Largest Contentful Paint (LCP): When main content is visible
  • First Input Delay (FID): Responsiveness to user interactions
  • Cumulative Layout Shift (CLS): Visual stability
  • Bundle size: Initial JavaScript payload
  • Server response time: TTFB for server-rendered content

Common pitfalls to avoid

❌ Don't:

  • Use barrel imports from large libraries
  • Block parallel operations with sequential awaits
  • Re-render entire trees when only part needs updating
  • Load analytics/tracking in the critical path
  • Mutate arrays with .sort() instead of .toSorted()
  • Create RegExp or heavy objects inside render

✅ Do:

  • Import directly from source files
  • Use Promise.all() for independent operations
  • Memoize expensive components
  • Lazy-load non-critical code
  • Use immutable array methods
  • Hoist static objects outside components

Project-specific style preferences

The reference guidelines use function keyword syntax for examples, but this project prefers:

  1. Arrow functions for components - Use const Component = memo(() => ...) not memo(function Component() ...)
  2. useMemo over IIFE in TSX - Use useMemo(() => ..., [deps]) not (() => { ... })()
  3. Implicit returns when possible - Use useMemo(() => value, [deps]) not useMemo(() => { return value }, [deps])
  4. Avoid nested ternaries - Use useMemo with early returns or IIFE with if/else blocks for complex conditionals

Resources

Version history

v0.1.0 (January 2026)

  • Initial release from Vercel Engineering
  • 40+ performance rules across 8 categories
  • Comprehensive code examples and impact analysis

© shapeshift, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 47 other files (references) in .claude/skills/react-best-practices of shapeshift/web.

  • SKILL.md
  • references/react-performance-guidelines.md
  • references/rules/_sections.md
  • references/rules/_template.md
  • references/rules/advanced-event-handler-refs.md
  • references/rules/advanced-use-latest.md
  • references/rules/async-api-routes.md
  • references/rules/async-defer-await.md
  • references/rules/async-dependencies.md
  • references/rules/async-parallel.md
  • references/rules/async-suspense-boundaries.md
  • references/rules/bundle-barrel-imports.md
  • references/rules/bundle-conditional.md
  • references/rules/bundle-defer-third-party.md
  • references/rules/bundle-dynamic-imports.md
  • references/rules/bundle-preload.md
  • references/rules/client-event-listeners.md
  • references/rules/client-swr-dedup.md
  • references/rules/download_rules.sh
  • … and 29 more

Open the folder on GitHubat commit 52aebb2

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in shapeshift/web, which our catalogue first saw on October 7, 2026.

Compare with similar skills

React Best Practices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

React Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
React Best Practices this skillshapeshift/web2061 repos~2kAutomated safety check: PassMIT
React Performanceaffaan-m/ECC274k1 repos~4.5kAutomated safety check: PassMIT
Vercel React Best Practicessanity-io/sanity6.4k130 repos~1.6kAutomated safety check: PassMIT
React Best Practicesryokun6/ryos1.3k—~2kAutomated safety check: PassMIT
Vercel React Best Practicesgambitph/Stackable350—~2kAutomated safety check: PassMIT
Reactpproenca/dot-skills214—~4.1kAutomated safety check: PassMIT

Similar skills

  • React Performance

    affaan-m/ECC

    React and Next.js performance optimization patterns adapted from Vercel Engineering's React Best Practices (https://github.com/vercel-labs/agent-skills).

    274k GitHub starsUsed in 1 repo~4.5k tokens
    DevelopmentAuto-check passed
  • Official

    React and Next.js performance optimization guidelines from Vercel Engineering.

    6.4k GitHub starsUsed in 130 repos~1.6k tokens
    Frontend & DesignAuto-check passed
  • React performance optimization guidelines from Vercel Engineering (vercel-labs/agent-skills).

    1.3k GitHub stars~2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Vercel React Best Practices

    gambitph/Stackable

    React performance optimization guidelines from Vercel Engineering.

    350 GitHub stars~2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • React

    pproenca/dot-skills

    React 19/19.2 modern patterns for concurrent rendering, Server Components, actions, ref-as-prop, document metadata, resource hints, hooks, and memoization — plus a category-major review/refactor…

    214 GitHub stars~4.1k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • React Refactor Tournament

    ragnar-pwninskjold/tech-snacks

    Review React/Next.js code against the real vercel-react-best-practices skill, backlog the performance findings keyed to actual rule ids + impact tiers, rank the most over-subscribed tiers, then fix…

    136 GitHub stars~1.3k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed

More from shapeshift/web

  • Benchmark Translate

    shapeshift/web

    Run a quality benchmark of the /translate skill by selecting stratified test keys, capturing ground truth, translating, judging with sub-agents, and compiling a regression report.

    206 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Qabot Fixture

    shapeshift/web

    Create a new qabot E2E test fixture interactively. An agent skill from shapeshift/web.

    206 GitHub stars~838 tokensUpdated today
    Auto-check: notes
  • Translate

    shapeshift/web

    Translate new/changed English UI strings into all supported languages using a translate-review-refine pipeline.

    206 GitHub stars~4.5k tokensUpdated today
    Auto-check passed
  • Chain Integration

    shapeshift/web

    Integrate a new blockchain as a second-class citizen in ShapeShift Web.

    206 GitHub stars~20k tokensUpdated today
    Auto-check: notes
  • Qabot

    shapeshift/web

    Run QA tests using agent-browser and post results to the qabot dashboard.

    206 GitHub stars~8.2k tokensUpdated today
    Auto-check: notes
  • Swapper Integration

    shapeshift/web

    Integrate new DEX aggregators, swappers, or bridge protocols (like Bebop, Portals, Jupiter, 0x, 1inch, etc.) into ShapeShift Web.

    206 GitHub stars~11k tokensUpdated today
    Auto-check: notes

Questions about React Best Practices

What does React Best Practices do?

Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering. React Best Practices is an agent skill from shapeshift/web.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering.

When should I use React Best Practices?

React Best Practices fits situations like: optimizing React apps; reviewing performance; refactoring components.

How do I install React Best Practices in Claude Code?

Run `npx skills add shapeshift/web --skill react-best-practices -a claude-code`. Or copy the skill folder (.claude/skills/react-best-practices in shapeshift/web) into .claude/skills/react-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install React Best Practices in Codex?

Run `npx skills add shapeshift/web --skill react-best-practices -a codex`. Or copy the skill folder (.claude/skills/react-best-practices in shapeshift/web) into .agents/skills/react-best-practices in your project. Codex loads it when a task matches its description.

Can I use React Best Practices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add shapeshift/web --skill react-best-practices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/react-best-practices, .gemini/skills/react-best-practices, .github/skills/react-best-practices and .opencode/skills/react-best-practices in your project.

What does React Best Practices need to run?

Going by SKILL.md and its folder, React Best Practices needs a shell for the scripts in its folder. Our summary lists: A Bash shell.

Does React Best Practices access the network?

SKILL.md names 5 domains. As links in the text: vercel.com, github.com, react.dev, nextjs.org and swr.vercel.app. This is read from the text; nothing was executed.

Is React Best Practices safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does React Best Practices use?

React Best Practices is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does React Best Practices use?

About 2k tokens (SKILL.md is roughly 7.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 26k tokens, read only when the agent opens those files.

What are the alternatives to React Best Practices?

Skills that share tags, products or a category with React Best Practices: React Performance (affaan-m/ECC, 274k stars), Vercel React Best Practices (sanity-io/sanity, 6.4k stars), React Best Practices (ryokun6/ryos, 1.3k stars) and Vercel React Best Practices (gambitph/Stackable, 350 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains React Best Practices?

shapeshift (a GitHub organization) maintains it in shapeshift/web, which has 206 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 7, 2026.

Source: shapeshift/web on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.