Skip to main content
skill

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.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --skill web-development/tanstack-query-expert
Open on GitHub

What 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-expert

2Skills CLI (Vercel)

npx skills add davila7/claude-code-templates --skill tanstack-query-expert -a claude-code

3Manually: put the files in place

~/.claude/skills/tanstack-query-expert/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tanstack-query-expert/

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.

Similar skills

All skills for Frontend and UI →

From the same set495

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor