/waris-skill-library:warisskill-react-performancefrom waris-skill-library
Use when writing or reviewing React (or React Native) UI where render behavior matters — a component re-renders too often, a list is long, typing/scroll feels janky, or someone reaches for useMemo/useCallback/ React.memo. Triggers on "this component re-renders too much," "should I memoize this," long-list rendering, context-driven re-render storms, or slow typing in a controlled input. This is narrower than `warisskill-performance-optimization` — that skill owns the general measure-first loop, Core Web Vitals, bundles, and backend/query work. This one owns React's render model specifically. "Should this component exist at all" is ponytail's territory, not this skill's.
Ships in waris-skill-library. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Scope note: the general MEASURE → IDENTIFY → FIX → VERIFY → GUARD loop,
Core Web Vitals, bundle size, and query/N+1 work all live in
warisskill-performance-optimization — don't re-litigate them here. This
skill is only React's render model. The measure-first rule still applies:
the profiler here is React DevTools Profiler, and memoization is not
free, so don't add it blind.
React re-renders a component when its own state changes, its props change, or a context it consumes changes — and by default that re-renders the entire subtree below it. Almost all "React perf" work is one of two moves:
Everything below is an application of those two.
Same tier as picking a semantic element in accessibility work — do these by default, they're free and expensive to retrofit:
key for dynamic lists.
Never use the array index as key for a list that can reorder, insert, or
delete — it silently corrupts state and DOM identity.React.memo, useMemo, and useCallback all trade comparison cost +
memory + code complexity for skipped work. Default to not memoizing
until the Profiler shows a real cost. When the Profiler does point here:
| Tool | Use it when | Don't bother when |
|---|---|---|
React.memo(Component) | A child re-renders often with unchanged props and its render is non-trivial | The child is cheap, or its props change on nearly every parent render anyway |
useMemo(fn, deps) | A computation in render is genuinely expensive (large sort/filter/derive), or you need a stable object/array reference for a memoized child or a dependency array | The value is a primitive or a cheap expression — memo overhead costs more than it saves |
useCallback(fn, deps) | You pass a function as a prop to a React.memo child, or as a dependency to another hook | Nothing downstream depends on the function's identity |
Rule of thumb: React.memo on a child and useCallback/useMemo on the
props you pass it go together — memoizing the child alone does nothing
if you hand it a fresh function/object literal every render.
react-window / @tanstack/virtual). This is usually
a bigger win than any amount of memoization, because the cost is the
number of mounted nodes, not the render function.useSelector) so a component only re-renders when its slice changes.useTransition / useDeferredValue so typing never blocks on it.lazy + Suspense (modals,
editors, charts, route boundaries) so they don't cost anything until
used.| Symptom | Likely cause | Fix |
|---|---|---|
| Whole page re-renders on one small change | State lifted too high | Colocate state lower |
| Memoized child still re-renders | New object/array/function literal in its props | Memoize the prop with useMemo/useCallback, or pass primitives |
| Every consumer re-renders together | One monolithic context | Split context / selector subscription |
| Typing lags in a big filtered view | Expensive derive runs synchronously on each keystroke | useDeferredValue / useTransition |
| Long list scrolls poorly | Thousands of mounted nodes | Virtualize |
warisskill-performance-optimization.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sodiqabdulwaris/waris-skill-library --plugin waris-skill-library129 skills in this plugin
/api-and-interface-designGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend./browser-testing-with-devtoolsTests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured./ci-cd-and-automationAutomates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies./code-review-and-qualityConducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch./code-simplificationSimplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity./constraint-driven-developmentEstablishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.