deckardger avatar

Tanstack Query Best Practices

This is a comprehensive reference for TanStack Query patterns organized into 38 rules across ten categories, from critical query key management to offline support. It covers the stuff that trips people up: query key factories, optimistic updates with rollback context, when to use placeholderData versus initialData, and proper SSR hydration patterns. Each rule follows a consistent format with bad and good examples. The priority system is helpful, putting query keys and caching at critical because those are where the hardest bugs come from. If you're building a data-heavy React app and tired of cache invalidation gotchas or wondering why your mutations aren't updating the UI correctly, this gives you the patterns to get it right.

skills.sh installs
13.2K
GitHub stars
230
last updated
Aug 21, 2026

Install

$ npx -y skills add deckardger/tanstack-agent-skills --skill tanstack-query-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

TanStack Query Best Practices

Comprehensive guidelines for implementing TanStack Query (React Query) patterns in React applications. These rules optimize data fetching, caching, mutations, and server state synchronization.

When to Apply

  • Creating new data fetching logic
  • Setting up query configurations
  • Implementing mutations and optimistic updates
  • Configuring caching strategies
  • Integrating with SSR/SSG
  • Refactoring existing data fetching code

Rule Categories by Priority

Sponsors

Details

Repository
github.com/deckardger/tanstack-agent-skills
Categories
Frontend Development, Backend & APIs, AI & Agent Building

More from deckardger/tanstack-agent-skills

All 4
1elevenlabs avataragentselevenlabs/skillsBuild voice AI agents with ElevenLabs. Use when creating voice assistants, voice-based customer service bots, interactive voice characters, or any real-time voi12.9Kskills.sh installs
2antfu avatarvitepressantfu/skillsVitePress static site generator powered by Vite and Vue. Use when building documentation sites, configuring themes, or writing Markdown with Vue components.12.1Kskills.sh installs
3superdesigndev avatarsuperdesignsuperdesigndev/superdesign-skillDesign or redesign frontend UI on the Superdesign canvas. Use whenever the user wants to design a page, feature, flow, or a brand-new product with no code yet; 11.8Kskills.sh installs
4patricio0312rev avatarframer-motion-animatorpatricio0312rev/skillsCreates smooth animations and micro-interactions using Framer Motion including page transitions, gestures, scroll-based animations, and orchestrated sequences. 11.5Kskills.sh installs
5anthropics avatarclaude-automation-recommenderanthropics/claude-plugins-officialAnalyze a codebase and recommend Claude Code automations (hooks, subagents, skills, plugins, MCP servers). Use when user asks for automation recommendations, wa10.7Kskills.sh installs
6flutter avatarflutter-building-layoutsflutter/skillsMaster Flutter's constraint system to build responsive, overflow-free layouts efficiently.10.7Kskills.sh installs