← ClaudeAtlas

tanstack-querylisted

TanStack Query v5 (React Query) async state management for React. Use when implementing or reviewing code that uses `@tanstack/react-query` — query keys, queryOptions, useQuery/useSuspenseQuery, mutations and invalidation, QueryClient defaults, SSR hydration, or infinite queries.
Firzus/agent-skills · ★ 3 · AI & Automation · score 74
Install: claude install-skill Firzus/agent-skills
# TanStack Query Reference for TanStack Query v5 (`@tanstack/react-query`), the async state manager for server data in React. Prefer the project's existing API client, query-key conventions, and hook layer; apply these rules on top so cache identity, staleness, and invalidation stay predictable. TanStack Query owns *server state*: data it did not create, stored elsewhere, potentially stale at any moment. It is not a replacement for client state (form inputs, modal toggles, wizard steps) — keep those in React state. Branch-specific references, loaded on demand: - [ssr.md](./ssr.md) — prefetch, `dehydrate`, `HydrationBoundary`, Next.js App Router and Server Components. - [mutations.md](./mutations.md) — `useMutation` lifecycle, optimistic updates, rollback, invalidation strategy. - [infinite-queries.md](./infinite-queries.md) — `useInfiniteQuery`, cursors, bi-directional lists, page-limited caches. - [typescript.md](./typescript.md) — inference, narrowing, global `Register` types, `skipToken`. ## First Checks 1. Confirm `@tanstack/react-query` is installed and on **v5** (`package.json`, lockfile). v4 code differs on renamed options — `cacheTime` became `gcTime`, `useErrorBoundary` became `throwOnError`, `keepPreviousData` became `placeholderData: keepPreviousData`. 2. Find where the `QueryClient` is created and which `defaultOptions` are set — `staleTime`, `gcTime`, `retry` change the behavior of every hook below. 3. Find the existing query-key convent