tanstack-query

TanStack Query (React Query) for data fetching and caching.

View on GitHub
Author Jeremy Dawes
Namespace @jezweb/claude-skills
Category frontend
Version 1.0.0
Stars 79
Downloads 7
self.md verified
Table of content

TanStack Query (React Query) for data fetching and caching.

Installation

npx claude-plugins install @jezweb/claude-skills/tanstack-query

Contents

Folders: assets, references, rules, scripts, templates

Files: README.md, SKILL.md

Documentation

Status: ✅ Production Ready Last Updated: 2025-10-22 Production Tested: Patterns verified with TypeScript strict mode


Auto-Trigger Keywords

Claude Code automatically discovers this skill when you mention:

Primary Keywords

Secondary Keywords

Error-Based Keywords


What This Skill Does

Provides comprehensive knowledge for TanStack Query v5 (React Query) server state management in React applications, including setup, queries, mutations, caching strategies, v4→v5 migration, optimistic updates, infinite queries, and error handling.

Core Capabilities

✅ QueryClient configuration and setup ✅ useQuery, useMutation, useInfiniteQuery patterns ✅ Optimistic updates and cache management ✅ v4 to v5 migration (all breaking changes) ✅ TypeScript patterns and type safety ✅ Error handling strategies ✅ Caching and refetching strategies ✅ DevTools setup and debugging ✅ Testing patterns with MSW


Known Issues This Skill Prevents

IssueWhy It HappensSourceHow Skill Fixes It
#1: Object Syntax Requiredv5 removed function overloadsMigration GuideAlways use useQuery({ queryKey, queryFn })
#2: Query Callbacks RemovedonSuccess/onError removed from queriesv5 Breaking ChangesUse useEffect or move to mutations
#3: Status Renamedloadingpendingv5 MigrationUse isPending for initial load
#4: cacheTime → gcTimeRenamed for clarityv5 MigrationUse gcTime instead
#5: useSuspenseQuery + enabledenabled option not availableGitHub #6206Use conditional rendering
#6: initialPageParam Requiredv5 requires explicit valuev5 MigrationAlways provide initialPageParam
#7: keepPreviousData RemovedReplaced with placeholderDatav5 MigrationUse placeholderData: keepPreviousData
#8: Error Type DefaultChanged from unknown to Errorv5 MigrationSpecify error type if non-Error

When to Use This Skill

✅ Use When:

❌ Don’t Use When:


Quick Usage Example

# Install dependencies
npm install @tanstack/react-query@latest
npm install -D @tanstack/react-query-devtools@latest

# Set up QueryClient Provider (see SKILL.md for complete setup)

Result: Full TanStack Query v5 setup with best practices

Full instructions: See SKILL.md


Token Efficiency Metrics

ApproachTokens UsedErrors EncounteredTime to Complete
Manual Setup~10,0002-3 (v5 migration errors)~30 min
With This Skill~3,5000 ✅~10 min
Savings~65%

…(truncated)

Source

View on GitHub

Tags: frontend reacttanstackquerydata-fetchingcache