From antigravity-awesome-skills
Diagnoses slow React components, identifies re-render hotspots and expensive updates, and suggests targeted fixes like memoization, useCallback, and state isolation.
npx claudepluginhub sickn33/antigravity-awesome-skillsThis skill uses the workspace's default tool permissions.
Identify render hotspots, isolate expensive updates, and apply targeted optimizations without changing UI behavior.
Diagnoses slow React components, identifies re-render hotspots and expensive updates, and suggests targeted fixes like memoization, useCallback, and state isolation.
Diagnoses slow React components using React DevTools Profiler and suggests fixes like isolating ticking state, memoizing callbacks, stabilizing props, and virtualizing lists.
Optimizes React apps using memoization (React.memo, useMemo, useCallback), code splitting, virtualization, and concurrent rendering. Use for slow components, bundle size reduction, large datasets, and re-render prevention.
Share bugs, ideas, or general feedback.
Identify render hotspots, isolate expensive updates, and apply targeted optimizations without changing UI behavior.
memo only when props are stable.useCallback/useMemo for handlers and derived values.Move a timer or animation counter into a child so the parent list never re-renders on each tick.
// ❌ Before – entire parent (and list) re-renders every second
function Dashboard({ items }: { items: Item[] }) {
const [tick, setTick] = useState(0);
useEffect(() => {
const id = setInterval(() => setTick(t => t + 1), 1000);
return () => clearInterval(id);
}, []);
return (
<>
<Clock tick={tick} />
<ExpensiveList items={items} /> {/* re-renders every second */}
</>
);
}
// ✅ After – only <Clock> re-renders; list is untouched
function Clock() {
const [tick, setTick] = useState(0);
useEffect(() => {
const id = setInterval(() => setTick(t => t + 1), 1000);
return () => clearInterval(id);
}, []);
return <span>{tick}s</span>;
}
function Dashboard({ items }: { items: Item[] }) {
return (
<>
<Clock />
<ExpensiveList items={items} />
</>
);
}
useCallback + memo// ❌ Before – new handler reference on every render busts Row memo
function List({ items }: { items: Item[] }) {
const handleClick = (id: string) => console.log(id); // new ref each render
return items.map(item => <Row key={item.id} item={item} onClick={handleClick} />);
}
// ✅ After – stable handler; Row only re-renders when its own item changes
const Row = memo(({ item, onClick }: RowProps) => (
<li onClick={() => onClick(item.id)}>{item.name}</li>
));
function List({ items }: { items: Item[] }) {
const handleClick = useCallback((id: string) => console.log(id), []);
return items.map(item => <Row key={item.id} item={item} onClick={handleClick} />);
}
// ❌ Before – recomputes on every render
function Summary({ orders }: { orders: Order[] }) {
const total = orders.reduce((sum, o) => sum + o.amount, 0); // runs every render
return <p>Total: {total}</p>;
}
// ✅ After – recomputes only when orders changes
function Summary({ orders }: { orders: Order[] }) {
const total = useMemo(() => orders.reduce((sum, o) => sum + o.amount, 0), [orders]);
return <p>Total: {total}</p>;
}
Load references/examples.md when the user wants a concrete refactor example.