Agent skill · software engineering · secondsky
tanstack-query
TanStack Query v5 (React Query) server state management. Use for data fetching, caching, mutations, or encountering v4 migration, stale data, invalidation errors.
Why this skill is useful
Provides specific patterns and configurations for managing server state in React applications using TanStack Query v5, which the AI wouldn't reliably generate on its own.
What it needs
Requires @tanstack/react-query, @tanstack/react-query-devtools installed locally. About 10k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.
What this skill does
TanStack Query (React Query) v5 Status: Production Ready ✅ Last Updated: 2026-08-03 Dependencies: React 18.0+ (18.3+ recommended), TypeScript 4.9+ (5.x preferred) Latest Versions: @tanstack/react-query@5.101.4, @tanstack/react-query-devtools@5.101.4, @tanstack/eslint-plugin-query@5.101.4 --- Quick Start (5 Minutes) 1. Install Dependencies Why this matters: TanStack Query v5 requires React 18+ (uses useSyncExternalStore) DevTools are essential for debugging queries and mutations v5 has breaking changes from v4 - use latest for all fixes 2. Set Up QueryClient Provider CRITICAL: Wrap entire app with QueryClientProvider Configure staleTime to avoid excessive refetches (default is 0) Use gcTime (not cacheTime - renamed in v5) DevTools should be inside provider Know the defaults (v5): staleTime: 0 → data is immediately stale, so refetches on mount/focus unless you raise it gcTime: 5 60 1000 → inactive data is garbage-collected after 5 minutes retry: 3 in browsers, retry: 0 on the server refetchOnWindowFocus: true and refetchOnReconnect: true networkMode: 'online' (requests pause while offline). Switch to 'always' for SSR/prefetch where you don't want cancellation. citeturn1search0turn1search1 3. Create First Query CRITICAL: v5 requires object syntax: useQuery({ queryKey, queryFn }) Use isPending (not isLoading - that now means "pending AND fetching") Always throw errors in queryFn for proper error handling QueryKey should be array for consistent cache keys 4. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills secondsky/tanstack-query