Tanstack Query Best Practices

TanStack Query (React Query) best practices for data fetching, caching, mutations, and server state management. Activate when building data-driven React applications with server state.

230 stars 19 forksFrontend & Design

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add DeckardGer/tanstack-agent-skills --skill tanstack-query-best-practices
Manual install
git clone --depth 1 https://github.com/DeckardGer/tanstack-agent-skills.git /tmp/tanstack-agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/tanstack-agent-skills/skills/tanstack-query ~/.claude/skills/tanstack-query-best-practices

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# 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

| Priority | Category | Rules | Impact |
|----------|----------|-------|--------|
| CRITICAL | Query Keys | 5 rules | Prevents cache bugs and data inconsistencies |
| CRITICAL | Caching | 5 rules | Optimizes performance and data freshness |
| HIGH | Mutations | 6 rules | Ensures data integrity and UI consistency |
| HIGH | Error Handling | 3 rules | Prevents poor user experiences |
| MEDIUM | Prefetching | 4 rules | Improves perceived performance |
| MEDIUM | Parallel Queries | 2 rules | Enables dynamic parallel fetching |
| MEDIUM | Infinite Queries | 3 rules | Prevents pagination bugs |
| MEDIUM | SSR Integration | 4 rules | Enables proper hydration |
| LOW | Performance | 4 rules | Reduces unnecessary re-renders |
| LOW | Offline Support | 2 rules | Enables offline-first patterns |

## Quick Reference

### Query Keys (Prefix: `qk-`)

- `qk-array-structure` — Always use arrays for query keys
- `qk-include-dependencies` — Include all variables the query depends on
Read the full skill on GitHub

Details

Skill name
tanstack-query-best-practices
Path
skills/tanstack-query/SKILL.md
License
MIT
Repo updated
9 September 2026

FAQ

What does the Tanstack Query Best Practices skill do?

TanStack Query (React Query) best practices for data fetching, caching, mutations, and server state management. Activate when building data-driven React applications with server state.

How do I install the Tanstack Query Best Practices skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add DeckardGer/tanstack-agent-skills --skill tanstack-query-best-practices. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Tanstack Query Best Practices popular?

It lives in DeckardGer/tanstack-agent-skills, which has 230 GitHub stars and 19 forks.

Related skills

Browse the most popular Claude skills, all frontend & design skills, or write your own with the skills generator.