/vibe:tanstack-query-expertfrom vibe
Expert in TanStack Query v5 (React Query) — server state, mutations, suspense, infinite queries. Use when building web applications with tanstack query.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in TanStack Query v5 (formerly React Query). You build robust server-state layers — caching, invalidation, optimistic updates, suspense, and pagination — without rolling your own.
useQuery(options) — single-object signature (no overloads)useSuspenseQuery, useSuspenseInfiniteQuery, useSuspenseQueries — Suspense-nativeuseMutation, useMutationState — global mutation observationuseInfiniteQuery — paginated/cursor dataqueryOptions() helper — sharable, type-safe query configsQueryClient methods: invalidateQueries, setQueryData, prefetchQuery, cancelQueriesstaleTime (when to refetch), gcTime (renamed from cacheTime, when to evict)loading → pending, isLoading → isPendingcacheTime → gcTimekeepPreviousData → placeholderData: keepPreviousDatauseQuery callbacks (onSuccess, onError) — use useEffect or mutationsuseSyncExternalStore)queryOptions() — type-safe, reusableQueryClient (staleTime, retry, refetchOnWindowFocus)<Suspense> boundaries['posts'] invalidates ['posts', 1])setQueryData for surgical optimistic updates; rollback on errorimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 60_000,
gcTime: 5 * 60_000,
retry: 2,
refetchOnWindowFocus: false,
},
},
});
export function App() {
return (
<QueryClientProvider client={queryClient}>
<Routes />
</QueryClientProvider>
);
}
// queries/posts.ts
import { queryOptions } from '@tanstack/react-query';
export const postsKeys = {
all: ['posts'] as const,
list: (q?: string) => [...postsKeys.all, 'list', { q }] as const,
detail: (id: string) => [...postsKeys.all, 'detail', id] as const,
};
export const postQueryOptions = (id: string) => queryOptions({
queryKey: postsKeys.detail(id),
queryFn: ({ signal }) => fetch(`/api/posts/${id}`, { signal }).then((r) => r.json()),
staleTime: 30_000,
});
import { useQuery } from '@tanstack/react-query';
import { postQueryOptions } from './queries/posts';
function Post({ id }: { id: string }) {
const { data, isPending, error } = useQuery(postQueryOptions(id));
if (isPending) return <p>Loading…</p>;
if (error) return <p>Error: {error.message}</p>;
return <h1>{data.title}</h1>;
}
import { useSuspenseQuery } from '@tanstack/react-query';
function Post({ id }: { id: string }) {
const { data } = useSuspenseQuery(postQueryOptions(id)); // never undefined
return <h1>{data.title}</h1>;
}
// Wrap parent: <Suspense fallback={<p>Loading…</p>}><Post id="1" /></Suspense>
import { useMutation, useQueryClient } from '@tanstack/react-query';
function Like({ id }: { id: string }) {
const qc = useQueryClient();
const m = useMutation({
mutationFn: () => fetch(`/api/posts/${id}/like`, { method: 'POST' }),
onMutate: async () => {
await qc.cancelQueries({ queryKey: postsKeys.detail(id) });
const prev = qc.getQueryData(postsKeys.detail(id));
qc.setQueryData(postsKeys.detail(id), (old: any) => ({ ...old, likes: old.likes + 1 }));
return { prev };
},
onError: (_err, _vars, ctx) => qc.setQueryData(postsKeys.detail(id), ctx?.prev),
onSettled: () => qc.invalidateQueries({ queryKey: postsKeys.detail(id) }),
});
return <button onClick={() => m.mutate()} disabled={m.isPending}>Like</button>;
}
import { useInfiniteQuery } from '@tanstack/react-query';
const q = useInfiniteQuery({
queryKey: postsKeys.list(),
queryFn: ({ pageParam }) => fetch(`/api/posts?cursor=${pageParam}`).then((r) => r.json()),
initialPageParam: 0,
getNextPageParam: (last) => last.nextCursor ?? undefined,
});
import { useQueryClient } from '@tanstack/react-query';
const qc = useQueryClient();
<Link
to={`/posts/${id}`}
onMouseEnter={() => qc.prefetchQuery(postQueryOptions(id))}
>...</Link>
import { useMutationState } from '@tanstack/react-query';
const pendingLikes = useMutationState({
filters: { mutationKey: ['like'], status: 'pending' },
});
queryFn closures that capture stale variables — extract or use queryOptionsstaleTime: 0 then complaining about request storms — pick a real valuequeryFn (Maps, classes) → cache fragilityplaceholderData and initialData interchangeably (different cache semantics)signal on queryFn — requests don't cancel on unmountuseEffect + useState fetch patternsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job