tanstack-query-expert — Claude Code skill: setup and install
This skill guides TanStack Query work in React and Next.js, from query design and cache handling to mutations and server-side hydration. Use it when building or revising data-fetching flows.
npx claude-code-templates@latest --skill web-development/tanstack-query-expertWhat tanstack-query-expert does
The skill covers putting queries in custom hooks, choosing cache keys, and configuring data freshness and retry behavior. It also addresses server mutations, cache invalidation, and optimistic changes that can be rolled back when a request fails.
For the Next.js App Router, it shows server-fetched data passed to a client component through hydration. Its examples use TanStack Query APIs and TypeScript. After a mutation, the related cache needs updating or invalidation; otherwise the interface can retain old data.
Install it from the templates package with npx.
What it helps with
- organize data fetching in custom hooks
- choose cache keys for queries
- refresh cached data after a mutation
- apply an optimistic change and undo it on failure
- hydrate server-fetched data in an App Router client component
Example prompts for the agent
- Set up a TanStack Query hook for loading a user profile.
- Show how to refresh the posts cache after creating a post.
- Prepare App Router code that hydrates a client component with server-fetched data.
How to install tanstack-query-expert
1claude-code-templates
npx claude-code-templates@latest --skill web-development/tanstack-query-expert2Skills CLI (Vercel)
npx skills add davila7/claude-code-templates --skill tanstack-query-expert -a claude-code3Manually: put the files in place
~/.claude/skills/tanstack-query-expert/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/tanstack-query-expert/
Manually: put the files in place
.agents/skills/tanstack-query-expert/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/tanstack-query-expert/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install davila7/claude-code-templates tanstack-query-expert2Manually: put the files in place
.github/skills/tanstack-query-expert/SKILL.mdPlatform CLI
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/web-development/tanstack-query-expertManually: put the files in place
.devin/skills/tanstack-query-expert/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about tanstack-query-expert
How do I install tanstack-query-expert in Claude Code?
Run npx claude-code-templates@latest --skill web-development/tanstack-query-expert.
What does tanstack-query-expert do?
It guides TanStack Query patterns for React and Next.js, including queries, cache handling, mutations, and App Router hydration.
How does the skill handle optimistic updates?
It describes changing cached data before the server responds, keeping the previous value, and restoring it if the mutation fails.