.agents/skills/react-memoization-guide/SKILL.md
Guidelines for proper React memoization (useMemo, useCallback, React.memo) usage. Use when writing React components, reviewing code with useMemo/useCallback, refactoring performance optimizations, or when asked about React performance patterns. Helps identify common misuse patterns and apply the "clarity first, optimize when justified" principle.
npx skillsauth add FabioFiorita/tastik react-memoization-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply these guidelines when working with useMemo, useCallback, and React.memo in React code.
Clarity comes first. Optimize only when you justify the need.
When reviewing or writing code with memoization hooks, default to questioning whether they're necessary.
Before adding memoization, ask:
Only use when:
React.memo optimizationuseEffect or other hooksCommon misuse:
// ❌ Memoizing cheap work
const fullName = useMemo(
() => `${user.firstName} ${user.lastName}`,
[user]
);
// ✅ Just compute it
const fullName = `${user.firstName} ${user.lastName}`;
Only use when:
useEffectCommon misuse:
// ❌ Unnecessary for simple button clicks
const onClick = useCallback(() => setOpen(true), []);
// ❌ Frozen dependencies cause bugs
const onSave = useCallback(() => {
api.save(formState); // captures first formState forever
}, []);
// ✅ Correct dependencies or don't use it
const onSave = () => api.save(formState);
Red flag: Empty dependency array [] often signals incorrect code structure.
Only wrap components that:
Wrapping cheap components adds overhead without benefit.
For comprehensive examples and anti-patterns, see references/memoization-patterns.md.
When writing React code:
When reviewing code:
tools
Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices.
development
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
tools
Analyzes web performance using Chrome DevTools MCP. Measures Core Web Vitals (FCP, LCP, TBT, CLS, Speed Index), identifies render-blocking resources, network dependency chains, layout shifts, caching issues, and accessibility gaps. Use when asked to audit, profile, debug, or optimize page load performance, Lighthouse scores, or site speed.
development
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.