Audit React Query usage for best practices — key factories, staleTime, mutations, and server state ownership
58
67%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Fix and improve this skill with Tessl
tessl review fix ./.agents/skills/react-query-best-practices/SKILL.mdArguments:
User arguments: $ARGUMENTS
This codebase uses React Query (TanStack Query) as the single source of truth for all server state. All query hooks live in hooks/queries/. Zustand is used only for client-only UI state. Server data must never be duplicated into useState or Zustand outside of mutation callbacks that coordinate cross-store state.
Read these before analyzing:
Enforce CLAUDE.md "React Query" and .claude/rules/sim-queries.md (key factory with all + plural prefixes, signal forwarding, named staleTime constants reused by prefetches, keepPreviousData only on variable keys, requestJson boundary). Additionally:
staleTime constant that a server module (a prefetch.ts, route, block, trigger) imports, which must live in a non-'use client' module under hooks/queries/utils/ per .claude/rules/sim-queries.md (a 'use client' export called from the server crashes SSR)enabled to prevent queries from running without required paramsqueryClient.prefetchQuery and shared queryOptions; never temporarily enable a mounted hidden observer, which can remain active after focus restoration and refetch data for closed UIenabled options with required-param guards (Boolean(id) && (options?.enabled ?? true)). Never spread options after an internal guard, because { enabled: true } can silently re-enable an invalid request.isPending: true. Aggregate loading state only for queries that are applicable/enabled, or an optional query can hold the whole surface in a permanent loading state.queryFn so an optional warm cannot fail the page, and never bypass a route that redacts fields.Enforce CLAUDE.md "Mutation Hooks" (targeted invalidation, onMutate/onError rollback, mutation objects out of useCallback deps). Additionally:
onSuccess; optimistic mutations reconcile in onSettled (fires on success and error) with rollback in onError — see .claude/rules/sim-queries.md "Mutation Hook" / "Optimistic Updates"setQueryData is for optimistic updates and the server-prefetch seeding case in .claude/rules/sim-queries.md "Server prefetching", nothing else/you-might-not-need-an-effect "Query-backed forms"; do not duplicate its finding7945b29
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.