agentsclimarketplace

React performance

Skill LeahyCC/claude-skills/skills/react-performance

Use when optimizing React component rendering, fixing Core Web Vitals (LCP, INP, CLS), reducing bundle size, diagnosing re-renders, code splitting, memoization decisions, Server Component patterns, or profiling React apps. Covers React 19, React Compiler, useTransition, useDeferredValue, Suspense, and Next.js optimization.From its SKILL.md

Install
npx -y skills add LeahyCC/claude-skills --skill react-performance

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

7.7 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it

React Performance

Comprehensive React performance guidance covering measurement, rendering optimization, bundle size, Core Web Vitals, and Server Component patterns. Verified against React docs and Web Vitals specifications.

First principle: Measure before you optimize. This skill teaches you to find problems before fixing them.

Architecture Overview

[Diagnose]
    ├── React DevTools Profiler (component render times)
    ├── Chrome Performance Panel (main thread activity)
    ├── web-vitals library (LCP, INP, CLS in production)
    └── Bundle analyzer (what's in the bundle)
              ↓
[Identify Root Cause]
    ├── Unnecessary re-renders? → Memoization / state colocation
    ├── Slow initial load? → Code splitting / Server Components
    ├── Janky interactions? → useTransition / useDeferredValue
    ├── Layout shifts? → Image/font optimization
    └── Large bundle? → Dynamic imports / tree shaking
              ↓
[Fix — Least Invasive First]
    ├── 1. Restructure components (children pattern, local state)
    ├── 2. Enable React Compiler (auto-memoization)
    ├── 3. Use concurrent features (transitions, deferred values)
    ├── 4. Move work to Server Components
    ├── 5. Code split heavy dependencies
    └── 6. Manual memo/useMemo/useCallback (last resort)

Quick Reference

Need to...See
Measure performance before optimizingProfiling and Measurement
Fix unnecessary re-rendersRendering Optimization
Reduce JavaScript bundle sizeBundle Optimization
Fix LCP, INP, or CLS scoresCore Web Vitals
Decide Server vs Client ComponentsServer Components
Handle large lists and data setsData and Lists
Optimize images, fonts, and mediaAssets
Decide when React Compiler handles itReact Compiler

Decision Matrix: Which Optimization?

"My page loads slowly"

SymptomLikely CauseFixResource
LCP > 2.5s, large imageUnoptimized hero imagenext/image with priorityassets
LCP > 2.5s, text contentRender-blocking JSServer Components, code splitserver-components, bundle
LCP > 2.5s, font flashFont loading delaynext/fontassets
TTFB > 800msSlow data fetchingParallel fetches, streamingserver-components
Large JS bundle (> 200KB)Too much client codeDynamic imports, tree shakingbundle

"My page feels janky/unresponsive"

SymptomLikely CauseFixResource
INP > 200ms on typingHeavy re-renders on inputuseTransition, state colocationrendering
INP > 200ms on clickExpensive event handlerstartTransition, requestIdleCallbackrendering
INP > 200ms on navigationRoute transition re-rendersuseTransition for navigationrendering
Scrolling stutterLarge list renderingVirtualizationdata-and-lists
Input lagContext re-rendering entire treeSplit context, selector patternrendering

"Layout is jumping around"

SymptomLikely CauseFixResource
CLS > 0.1, imagesMissing width/heightnext/image or explicit dimensionsassets, web-vitals
CLS > 0.1, fontsFont swapnext/fontassets
CLS > 0.1, dynamic contentContent inserted after loadReserve space, Suspense fallbackweb-vitals
CLS > 0.1, animationsLayout-triggering CSSUse transform instead of top/leftweb-vitals

"Should I use memo/useMemo/useCallback?"

Is React Compiler enabled?
├── YES → Don't add manual memoization. Compiler handles it.
└── NO
    ├── Have you measured with Profiler?
    │   ├── NO → Measure first. The problem might not be re-renders.
    │   └── YES, renders are slow (> 1ms per component)
    │       ├── Can you restructure? (children pattern, local state)
    │       │   ├── YES → Do that instead. No memo needed.
    │       │   └── NO → Use memo/useMemo/useCallback.
    │       └── Is the child already wrapped in memo()?
    │           ├── NO → Wrapping parent's callback in useCallback alone does nothing.
    │           └── YES → useCallback/useMemo will help.
    └── Can you enable React Compiler?
        ├── YES → Enable it. Remove manual memoization later.
        └── NO → Use memo/useMemo/useCallback where Profiler shows benefit.

The Optimization Hierarchy

The React team's official priority order:

  1. Write correct code first — fix bugs, don't mask them with memoization
  2. Structure components well — local state, children pattern, avoid unnecessary Effects
  3. Measure before optimizing — use Profiler, console.time, CPU throttling in production builds
  4. Adopt React Compiler — handles memo/useMemo/useCallback automatically
  5. Use concurrent features (useTransition, useDeferredValue, Suspense) for responsiveness
  6. Use Server Components to eliminate client bundle weight and fetch waterfalls
  7. Manual memo/useMemo/useCallback only as escape hatches when the compiler is insufficient

Anti-Patterns Checklist

When reviewing code, watch for these performance killers:

  • Effect chainsuseEffect that sets state triggering another useEffect (derive during render instead)
  • Inline object/function props to memo()-wrapped children (defeats memoization)
  • State too high — input state at page level re-rendering entire tree
  • useEffect for derived statesetFiltered(items.filter(...)) in effect (use useMemo or calculate during render)
  • Missing key prop — or using array index as key for dynamic lists
  • Context monolith — one Provider with user + theme + cart + notifications
  • Client Component boundary too high'use client' at layout/page level instead of leaf components
  • Heavy imports in client bundle — syntax highlighters, markdown parsers, date libraries not code-split
  • Images without dimensions — causes CLS
  • onPaste={e => e.preventDefault()} on password fields — blocks password managers (also an a11y violation)
  • Manual memo/useMemo/useCallback without measuring first — adds complexity for no proven benefit
  • new ExpensiveThing() in useRef initializer — runs every render (use lazy init pattern)

What ships with it: 9 files

55.1 KB alongside SKILL.md

Gives 0 of the 12 instructions most caching build skills give in ~1.6k tokens

Counted across 103 of the 134 authors here whose files we hold, read 2026-09-06

  • Prefer App Router and server componentsin 12 of 103, across 7 files
  • Stay on a recent Next.js 16.x releasein 12 of 103, across 7 files
  • Use the Bundle Analyzer to trim large dependenciesin 12 of 103, across 7 files
  • Use Turbopack for day-to-day developmentin 11 of 103, across 6 files
  • Fall back to webpack only for Turbopack bugs or webpack-only pluginsin 11 of 103, across 6 files
  • Set a TTL on every cache entryin 10 of 103, across 9 files
  • Check the official docs for your Next.js versionin 9 of 103, across 5 files
  • Ensure the cache is not cleared unnecessarilyin 8 of 103, across 4 files
  • Verify Turbopack is active when dev is slowin 8 of 103, across 4 files
  • Run next dev for local developmentin 7 of 103, across 6 files
  • Run next dev for local development with Turbopackin 6 of 103, across 2 files
  • Append static extensions to dynamic URLs to trigger cachingin 6 of 103, across 3 files

Said here and by no other author read

  • Restructure components before adding memoization
  • Enable React Compiler for automatic memoization
  • Use transitions to keep interactions responsive
  • Move rendering work to Server Components
  • Code split heavy dependencies
  • Add manual memoization only as a last resort

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.