Analyze and fix useCallback anti-patterns in your code
54
61%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.agents/skills/you-might-not-need-a-callback/SKILL.mdArguments:
User arguments: $ARGUMENTS
Read before analyzing:
useCallback is only useful when something observes the reference. Ask: does anything care if this function gets a new identity on re-render?
Observers that care about reference stability:
useEffect that lists the function in its deps arrayuseMemo that lists the function in its deps arrayuseCallback that lists the function in its deps arrayReact.memo that receives the function as a propIf none of those apply — if the function is only called inline, or passed to a non-memoized child, or assigned to a native element event — the reference is unobserved and useCallback adds overhead with zero benefit.
<button onClick={fn}>). Nothing re-runs or bails out based on reference identity. Remove useCallback.<button onClick={fn}> — React never does reference equality on native element props. No benefit.useMemo on the return value instead, or restructure.useCallback whose result is in a useEffect dep array — prevents the effect from re-running on every renderuseCallback whose result is in a useMemo dep array — prevents the memo from recomputing on every renderuseCallback whose result is a dep of another useCallback — stabilises a callback chainuseCallback passed to a React.memo-wrapped child — the whole point of the patternuseRef + callback with empty deps that reads the ref inside — correct, do not flag:const idRef = useRef(id)
useEffect(() => { idRef.current = id }, [id])
const fetchData = useCallback(async () => {
// use idRef.current instead of id
}, []) // empty deps because refs are used6f514c1
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.