leahycc/claude-skills/react-performance
Claude Code and agent skill by leahycc/claude-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when optimizing React component rendering, fixing Core Web Vitals (LCP, INP, CLS), reducing bundle size, diagnosing re-renders, a store update under a large tree, code splitting, memoization decisions, Server Component patterns, or profiling React apps. Covers React 19, React Compiler, useTransition, useDeferredValue, useEffectEvent, Activity, Suspense, hydration mismatches, and Next.js optimization.
Install
npx vskill@latest install leahycc/claude-skills/react-performanceSKILL.md
The same SKILL.md was published earlier as leahycc/claude-skills/react-performance.
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.
Contents
- Architecture Overview
- Quick Reference
- Decision Matrix: Which Optimization?
- Choose a proportional fix
- Anti-Patterns Checklist
Architecture Overview
Before prescribing an API, inspect the app's installed React/Next versions, bundler and Compiler configuration. Preserve the project's supported setup; an optimization task is not automatic authorization to enable a compiler or change frameworks. Source checks are scoped in SOURCES.md.
Quick Reference
| Need to... | See | |
|---|---|---|
| Measure performance before optimizing | Profiling and Measurement | |
| Fix unnecessary re-renders | Rendering Optimization | |
| Reduce JavaScript bundle size | Bundle Optimization | |
| Fix LCP, INP, or CLS scores | Core Web Vitals | |
| Decide Server vs Client Components | Server Components | |
| Handle large lists and data sets | Data and Lists | |
| Optimize images, fonts, and media | Assets | |
| Decide when React Compiler handles it | React Compiler |
Decision Matrix: Which Optimization?
"My page loads slowly"
| Symptom | Likely Cause | Fix | Resource | |
|---|---|---|---|---|
| LCP > 2.5s, large image | Unoptimized hero image | Measure image discovery/size; choose version-supported loading hints | assets | |
| LCP > 2.5s, text content | Render-blocking JS | Server Components, code split | server-components, bundle | |
| LCP > 2.5s, font flash | Font loading delay | next/font | assets | |
| TTFB > 800ms | Slow data fetching | Parallel fetches, streaming | server-components | |
| Large client JS bundle | Too much client code | Measure with next analyze, then split or tree-shake | bundle |
"My page feels janky/unresponsive"
| Symptom | Likely Cause | Fix | Resource | |
|---|---|---|---|---|
| INP > 200ms on typing | Heavy re-renders on input | useTransition, state colocation | rendering | |
| INP > 200ms on click | Long task in the handler | scheduler.yield(), or a worker | web-vitals | |
| INP > 200ms on navigation | Route transition re-renders | useTransition for navigation | rendering | |
| Scrolling stutter | Large list rendering | Virtualization | data-and-lists | |
| Input lag | Context re-rendering entire tree | Split context, selector pattern | rendering | |
| Input loses focus, state resets or an animation restarts on each render | Component declared inside another component, so React remounts it | Declare it at module top level, pass props | rendering | |
| Effect tears down and re-subscribes on every render | Object, function or read-only value in its dependencies | Depend on primitives or a derived boolean; useEffectEvent for values only read when it fires | rendering | |
| Switching tabs loses state or remounts slowly | Hidden panel is unmounted | <Activity mode="hidden"> | rendering | |
| Slow first interaction after load, hydration error in console | Server HTML and first client render differ | Make them match; client-only parts after hydration | server-components |
"Layout is jumping around"
| Symptom | Likely Cause | Fix | Resource | |
|---|---|---|---|---|
| CLS > 0.1, images | Missing width/height | next/image or explicit dimensions | assets, web-vitals | |
| CLS > 0.1, fonts | Font swap | next/font | assets | |
| CLS > 0.1, dynamic content | Content inserted after load | Reserve space, Suspense fallback | web-vitals | |
| CLS > 0.1, animations | Layout-triggering CSS | Use transform instead of top/left | web-vitals |
"Should I use memo/useMemo/useCallback?"
Inspect whether the affected component is actually compiled. Prefer measuring and fixing state placement or repeated work first. Existing memo/useMemo/useCallback can remain; do not remove them in bulk when enabling Compiler. If the compiler covers new code, manual memoization is often unnecessary, but it can still be useful for a measured case or an external identity contract. A stable callback can matter to an Effect or subscription even when a child is not wrapped in memo.
Choose a proportional fix
Keep code correct, identify the measured bottleneck, and choose the smallest effective change: component structure, memoization, deferred rendering, bundle splitting or server work where the framework supports it. Compiler adoption is a separate, incremental project choice with behavior/performance checks, not an official universal ordering of optimizations. Transitions schedule rendering; they do not split an expensive synchronous function into yielding work.
Anti-Patterns Checklist
When reviewing code, watch for these performance killers:
- [ ] Effect chains —
useEffectthat sets state triggering anotheruseEffect(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 state —
setFiltered(items.filter(...))in effect (useuseMemoor 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
- [ ] Per-asset state or store hook under thousands of siblings. The cost is the walk from the root. Subscribe in an effect and write the DOM. See rendering.md.
- [ ] `new ExpensiveThing()` in `useRef` initializer — runs every render (use lazy init pattern)
- [ ] `useState(expensive())`. The call runs on every render. Pass
() => expensive(). - [ ] A component declared inside another component. It remounts on every parent render. Declare it at module level.
- [ ] App-wide setup in a mount Effect. It runs twice in development. Use a module-level flag or module top-level code.
- [ ] State set after `await` inside `startTransition`. It is not a transition. Wrap it in another
startTransition.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/react-performance/SKILL.md
Popularity
- Repository stars
- 3
- Repository forks
- 1
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/leahycc/claude-skills/react-performance)