From React Expert
Expert modern React (18/19): hooks, component design, state, performance, and Server Components. Trigger keywords: React, hooks, useState, useEffect, useMemo, useCallback, useRef, context, re-render, key, Suspense, Server Components, RSC, JSX, stale closure. Use when building/refactoring components or hooks, fixing render/effect bugs, or choosing a state-management approach.
How this skill is triggered — by the user, by Claude, or both
Slash command
/react-expert:react-expertThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> UI is a pure function of state. Derive during render; use effects only to sync with the outside world. Most "React performance" problems are really "I created an effect/state I didn't need."
UI is a pure function of state. Derive during render; use effects only to sync with the outside world. Most "React performance" problems are really "I created an effect/state I didn't need."
typescript-expert.nextjs-expert.tailwind-expert. Accessibility semantics → accessibility-expert.useEffect — that adds a render and bugs.key, not an effect. Adjust state during render (the rare "store previous value" pattern) instead of in an effect when possible.useEffect is an escape hatchuseState → useReducer when transitions are related/complex → lift to the closest common parent → Context for low-frequency global values (theme, auth) → external store (Zustand/Redux) for high-frequency or cross-cutting state.useEffect.useMemo/useCallback cost memory + comparison; sprinkling them everywhere is net-negative. React.memo only helps if props are referentially stable.key (an ID), never the array index for reorderable/insertable lists — index keys corrupt state and inputs.| Need | Reach for |
|---|---|
| Value computed from props/state | derive in render (no state/effect) |
| Reset state when a prop changes | key={...} |
| Server data (fetch/cache/refetch) | TanStack Query / RSC |
| Global low-frequency value | Context |
| High-frequency / cross-tree state | Zustand/Redux |
| Imperative DOM / mutable value across renders | useRef |
useState + effect → derive instead.useEffect for data fetching without cleanup → race conditions on fast prop changes; abort on cleanup or use a query lib.React.memo.Derive, don't store-and-sync
// ❌ extra state + effect (renders twice, can desync)
const [full, setFull] = useState("");
useEffect(() => setFull(`${first} ${last}`), [first, last]);
// ✅
const full = `${first} ${last}`;
Fetch effect that survives fast prop changes
useEffect(() => {
const ctrl = new AbortController();
let active = true;
fetch(`/api/user/${id}`, { signal: ctrl.signal })
.then((r) => r.json())
.then((u) => active && setUser(u))
.catch((e) => { if (e.name !== "AbortError") setError(e); });
return () => { active = false; ctrl.abort(); };
}, [id]);
nextjs-expert — App Router, RSC, and server-side data fetching.typescript-expert — typing props, generic components, and events.tailwind-expert — styling. accessibility-expert — accessible interactions.performance-expert — profiling render hotspots.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub miaoge-ge/coding-agent-skills --plugin react-expert