tanstack-query-setup

tanstack-query-setup is a skill for Claude Code, Codex from patricio0312rev/skillset. It costs 57 tokens per session (3,960 once invoked), scanned A, a copy of tanstack-query-setup, MIT.

A setup guide for TanStack Query, a React library that manages data fetched from servers. It covers cached results, updates, changes to server data, optimistic changes, and loading more pages.

In plain words
What is it for?
Use it to configure queries and mutations, cache API responses, refresh data in the background, build optimistic interfaces, and implement infinite scrolling.
Why use it?
It reduces the repeated work of tracking fetched data, stale results, background refreshes, mutations, and pagination. Optimistic updates can show an expected change before the server confirms it.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to configure queries and mutations, cache API responses, refresh data in the background, build optimistic interfaces, and implement infinite scrolling.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/patricio0312rev/skillset/tanstack-query-setup
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add patricio0312rev/skillset --skill tanstack-query-setup
Clone the repo
git clone --depth 1 https://github.com/patricio0312rev/skillset

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tanstack-query-setup

README.md
[![agentmods](https://agentmods.dev/badge/skills/patricio0312rev/skillset/tanstack-query-setup/github.svg)](https://agentmods.dev/skills/patricio0312rev/skillset/tanstack-query-setup)
Your own site
<a href="https://agentmods.dev/skills/patricio0312rev/skillset/tanstack-query-setup"><img src="https://agentmods.dev/badge/skills/patricio0312rev/skillset/tanstack-query-setup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tanstack-query-setup

Your own site · 80×15
<a href="https://agentmods.dev/skills/patricio0312rev/skillset/tanstack-query-setup"><img src="https://agentmods.dev/badge/skills/patricio0312rev/skillset/tanstack-query-setup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,960 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.03960
Opus 5 $0.00028 $0.01980
Sonnet 5 $0.00011 $0.00792
Haiku 4.5 $0.00006 $0.00396

Measured 9d ago against content hash 86487d9f7558, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

tanstack-query-setup scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(url);
Origin

This is a copy

100% identical to tanstack-query-setup — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

templates/frontend/tanstack-query-setup/SKILL.md · 672 lines

How it starts

The opening of the file, as written. The whole thing — 672 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TanStack Query Setup

Manage server state with powerful caching, background updates, and optimistic UI.

Core Workflow

  1. Install and configure: Set up QueryClient
  2. Create queries: Define data fetching hooks
  3. Add mutations: Handle data modifications
  4. Enable caching: Configure stale times
  5. Implement optimistic updates: Instant UI feedback
  6. Add infinite queries: Pagination and infinite scroll

Installation

npm install @tanstack/react-query @tanstack/react-query-devtools

Provider Setup

Next.js App Router

// app/providers.tsx
'use client';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { useState } from 'react';

export function Providers({ children }: { children: React.ReactNode }) {
  const [queryClient] = useState(
    () =>
      new QueryClient({
        defaultOptions: {
          queries: {
            staleTime: 60 * 1000, // 1 minute
            gcTime: 5 * 60 * 1000, // 5 minutes (formerly cacheTime)
            retry: 1,
            refetchOnWindowFocus: false,
          },
        },
      })
  );

  return (
    <QueryClientProvider client={queryClient}>
      {children}
      <ReactQueryDevtools initialIsOpen={false} />
    </QueryClientProvider>
  );
}
// app/layout.tsx
import { Providers } from './providers';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}

Basic Queries

Simple Query

// hooks/useUsers.ts
import { useQuery } from '@tanstack/react-query';

interface User {
  id: string;
  name: string;
  email: string;
}

async function fetchUsers(): Promise<User[]> {
  const response = await fetch('/api/users');
  if (!response.ok) {
    throw new Error('Failed to fetch users');
  }
  return response.json();
}

export function useUsers() {
  return useQuery({
    queryKey: ['users'],
    queryFn: fetchUsers,
  });
}

// Usage
function UsersList() {
  const { data: users, isLoading, error } = useUsers();

  if (isLoading) return <Spinner />;
  if (error) return <Error message={error.message} />;

  return (
    <ul>
      {users?.map((user) => (
        <li key={user.id}>{user.name}</li>
      ))}
    </ul>
  );
}

Read the full file on GitHub · 672 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 672 lines · 57 tokens per session scan A 86487d9f7558

Subscribe to this mod's changes

tanstack-query-setup is a skill published in the GitHub repository patricio0312rev/skillset (6 stars, last pushed 8mo ago), licensed MIT. It adds 57 tokens to every session and 3,960 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It is 100% identical to tanstack-query-setup, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

nextjs-pages-router

Set up tRPC in Next.js Pages Router with createNextApiHandler, createTRPCNext, withTRPC HOC, SSR via ssr option and ssrPrepass, SSG via createServerSideHelpers with getStaticProps, and server-side helpers for getServerSideProps prefetching.

trpc/trpc · 67 tokens

with-tanstack-query

Compose Angular Query with signal-owned Table filtering, sorting, and pagination state using reactive query options, manual row-model boundaries, direct query data, server counts, and valid injection context.

TanStack/table · 42 tokens

auth-web-cloudbase

CloudBase Web Authentication Quick Guide for frontend integration after auth-tool has already been checked. Provides concise and practical Web authentication solutions with multiple login methods and complete user management.

TencentCloudBase/CloudBase-AI-Toolkit · 38 tokens

service-digital-engagement-channel-configure

Configures and deploys enhanced chat Messaging Channels for Messaging for In-App and Web (MIAW). Use when the user needs to create, deploy, and activate a messaging channel configured with Omni-Channel Flow, Omni-Channel Queue, User, or Agentforce Service Agent routing. Generates MessagingChannel metadata, deploys it…

forcedotcom/sf-skills · 173 tokens

pinme-llm

Use this skill when a PinMe project (Worker TypeScript) needs to call OpenRouter-backed LLM APIs, including models, chat/completions, streaming, or OpenRouter web search. Guides AI to generate correct Worker TS code.

glitternetwork/pinme · 54 tokens

om-system-extension

Extend installed Open Mercato modules through UMES enrichers, interceptors, mutation guards, widgets, menus, entity extensions, events, component/page replacements, and overrides. Use for "extend core", "add field/column/action", "hide page", "intercept API", "UMES", or "rozszerz moduł".

open-mercato/open-mercato · 73 tokens