home / skills / ehtbanton / claudeskillsrepo / tanstack-query-hook
This skill generates complete TanStack Query v5 hooks for data fetching and mutations in TypeScript projects.
npx playbooks add skill ehtbanton/claudeskillsrepo --skill tanstack-query-hookReview the files below or copy the command above to add this skill to your agents.
---
name: tanstack-query-hook
description: Generate TanStack Query hooks for data fetching and mutations. Triggers on "create tanstack query hook", "generate react query", "useQuery hook", "useMutation hook".
---
# TanStack Query Hook Generator
Generate TanStack Query hooks for data fetching and caching.
## Output Requirements
**File Output:** `use*.ts` hook files
**Format:** Valid TanStack Query v5
**Standards:** TanStack Query 5.x, TypeScript
## When Invoked
Immediately generate complete query and mutation hooks.
## Example Invocations
**Prompt:** "Create TanStack Query hooks for products"
**Output:** Complete `useProducts.ts` with queries and mutations.
This skill generates ready-to-use TanStack Query (v5) hooks in TypeScript for data fetching and mutations. It emits complete use*.ts files that follow TanStack Query patterns and TypeScript typings. Use it to quickly scaffold useQuery and useMutation hooks tailored to your API shape and caching needs.
When invoked, the skill creates a full TypeScript hook file (use<Name>.ts) implementing useQuery and useMutation according to TanStack Query v5. It produces typed query keys, fetcher functions, error handling, cache invalidation, and optional optimistic update scaffolding. Output is formatted for immediate use in a React/TypeScript codebase.
Which TanStack Query version is supported?
The generated hooks target TanStack Query v5 and TypeScript types compatible with that major version.
Can I customize fetch logic or HTTP client?
Yes. The generator outputs a clear fetcher function you can swap to use fetch, axios, or your API client and adapt request/response handling.