tanstack-query-hook
Generate TanStack Query hooks for data fetching and mutations. Triggers on "create tanstack query hook", "generate react query", "useQuery hook", "useMutation hook".
When & Why to Use This Skill
This Claude skill automates the creation of production-ready TanStack Query (React Query) v5 hooks, significantly reducing boilerplate code for frontend developers. By generating type-safe TypeScript hooks for both data fetching (queries) and state updates (mutations), it ensures best practices in data synchronization and caching are followed consistently across your project.
Use Cases
- Rapidly scaffolding data fetching layers for new React components by generating complete useQuery and useMutation hooks from API specifications.
- Migrating legacy fetch or axios logic to TanStack Query v5 to leverage advanced caching, background updating, and stale-time management.
- Ensuring strict TypeScript typing for API responses and request payloads across a frontend codebase to prevent runtime errors.
- Standardizing the implementation of mutation side effects, such as cache invalidation and optimistic updates, within a development team.
| 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.