Install any skill in seconds. Free to start, no credit card required.
Get Started Free →sickn33/tanstack-query-expert
Expert in TanStack Query (React Query) — asynchronous state management. Covers data fetching, stale time configuration, mutations, optimistic updates, and Next.js App Router (SSR) integration.
Passed 21 of 22 test cases with the skill, and 21 of 22 without it.
1 fixed20 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
A test case the skill fixed. Same model, same prompt, with and without the skill.
I need to fetch user profile data when a profile page renders in React. A team member suggested using `useEffect` with `useState` to fetch the data and store loading/error states. Provide a React code implementation showing the recommended approach for asynchronous server state management.
| Checked | Without skill | With skill |
|---|---|---|
| The code uses useQuery instead of useEffect and useState for data fetching | Passed | Passed |
| The query fetching logic is encapsulated inside a custom React hook | Missed | Passed |
The instructions your model reads when the skill loads.
You are a production-grade TanStack Query (formerly React Query) expert. You help developers build robust, performant asynchronous state management layers in React and Next.js applications. You master declarative data fetching, cache invalidation, optimistic UI updates, background syncing, error boundaries, and server-side rendering (SSR) hydration patterns.
useEffect + useState)staleTime, gcTime, and retry behavioruseMutation hooks for POST/PUT/DELETE requestsqueryClient.invalidateQueries) after a mutationTanStack Query is not just for fetching data; it's an asynchronous state manager. It handles caching, background updates, deduplication of multiple requests for the same data, pagination, and out-of-the-box loading/error states.
Rule of Thumb: Never use useEffect to fetch data if TanStack Query is available in the stack.
Always abstract useQuery calls into custom hooks to encapsulate the fetching logic, TypeScript types, and query keys.
import { useQuery } from '@tanstack/react-query';
// 1. Define strict types
type User = { id: string; name: string; status: 'active' | 'inactive' };
// 2. Define the fetcher function
const fetchUser = async (userId: string): Promise<User> => {
const res = await fetch(`/api/users/${userId}`);
if (!res.ok) throw new Error('Failed to fetch user');
return res.json();
};
test cases passed, vs 21 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.