tanstack-query-best-practices
Installation
SKILL.md
TanStack Query Best Practices
Use this skill for TanStack Query authoring, review, architecture decisions, debugging, and migrations. Start by deciding whether the problem is actually a server-state problem, then shape the query keys, defaults, invalidation flow, and framework integration around that boundary.
Use This Skill When
- Building or reviewing TanStack Query usage in React, Preact, Solid, Vue, Svelte, or Angular
- Deciding whether data belongs in TanStack Query, local component state, router state, or a client-state store
- Setting up
QueryClient, providers, prefetching, hydration, persistence, or framework-specific adapters - Designing query keys, reusable option builders, invalidation rules, or optimistic update flows
- Debugging stale UI, duplicate requests, refetch churn, background loading confusion, or pagination bugs
- Modernizing older React Query or TanStack Query code to current v5 guidance
Out Of Scope
- Transport-client-specific advice beyond the query integration point
- Generic router, form, or global-state-library tutorials unless the main problem is the TanStack Query boundary
- Inventing normalized-cache workflows that fight TanStack Query's fetch-cache-invalidate model