migrate-api-to-tanstack-query

migrate-api-to-tanstack-query is a skill for Claude Code, Codex from bishopZ/2026-Boilerplate. It costs 32 tokens per session (543 once invoked), scanned A, original, MIT.

A migration guide for using TanStack Query, a library that fetches and caches server data in web applications, with an existing REST API.

In plain words
What is it for?
Use it when adding shared query state, caching and invalidation, typed API helpers, or gradually moving REST calls to TanStack Query.
Why use it?
It replaces scattered data-fetching code while keeping API behavior, login protection, and cookie-based authentication unchanged.

Skill for Claude CodeCodex

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

Good fit Use it when adding shared query state, caching and invalidation, typed API helpers, or gradually moving REST calls to TanStack Query.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bishopz/2026-boilerplate/migrate-api-to-tanstack-query
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 bishopZ/2026-Boilerplate --skill migrate-api-to-tanstack-query
Clone the repo
git clone --depth 1 https://github.com/bishopZ/2026-Boilerplate

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 migrate-api-to-tanstack-query

README.md
[![agentmods](https://agentmods.dev/badge/skills/bishopz/2026-boilerplate/migrate-api-to-tanstack-query/github.svg)](https://agentmods.dev/skills/bishopz/2026-boilerplate/migrate-api-to-tanstack-query)
Your own site
<a href="https://agentmods.dev/skills/bishopz/2026-boilerplate/migrate-api-to-tanstack-query"><img src="https://agentmods.dev/badge/skills/bishopz/2026-boilerplate/migrate-api-to-tanstack-query/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 migrate-api-to-tanstack-query

Your own site · 80×15
<a href="https://agentmods.dev/skills/bishopz/2026-boilerplate/migrate-api-to-tanstack-query"><img src="https://agentmods.dev/badge/skills/bishopz/2026-boilerplate/migrate-api-to-tanstack-query.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 543 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.00032 $0.00543
Opus 5 $0.00016 $0.00271
Sonnet 5 $0.00006 $0.00109
Haiku 4.5 $0.00003 $0.00054

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

Security

Grade A, and why

migrate-api-to-tanstack-query scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/migrate-api-to-tanstack-query/SKILL.md · 64 lines

How it starts

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

Migrate API to TanStack Query

Use this skill when the task is to introduce TanStack Query for REST data fetching/caching without rewriting the backend.

Goal

Move client-side server-state logic from ad hoc calls to TanStack Query while preserving existing API behavior and auth guarantees.

Preconditions

  • Keep API contracts stable while migrating (/api/* endpoints first).
  • For auth/session flows, prefer JSON endpoints (POST /api/session, DELETE /api/session) rather than redirect-based legacy endpoints.
  • Keep route protection and cookie auth behavior unchanged unless explicitly requested.

Files To Update

1) Dependencies and scripts (package.json)

  • Add @tanstack/react-query.
  • Add @tanstack/react-query-devtools only if requested.

2) Query client setup

  • Add a shared query client module under src/client/ (for example: src/client/data/query-client.ts).
  • Wire QueryClientProvider in src/client/main.tsx.
  • Keep provider order stable with Redux, i18n, and Chakra providers.

3) API access layer

  • Create or update an API module under src/client/utilities/ or src/client/data/ with typed fetch helpers.
  • Normalize request/response/error handling in one place.
  • Use resource-oriented functions (createSession, deleteSession, getEncryptionKey) instead of endpoint-shaped function names.

4) Feature migration

  • Replace one feature at a time with useQuery / useMutation.
  • Add targeted cache invalidation where state changes occur.
  • Keep form/UI behavior unchanged while moving data logic.

5) Docs and changelog

  • Update docs/API.md when endpoint usage guidance changes.
  • Update docs/TECHNOLOGY.md if TanStack Query becomes part of the default stack.
  • Add migration notes under CHANGELOG.mdUnreleased.

Validation Checklist

  • Run npm run lint
  • Run npm run type-check
  • Run targeted E2E tests for migrated flows (for example playwright/e2e/auth/login.spec.ts)
  • Verify no direct feature code still calls fetch for the migrated paths

Read the full file on GitHub · 64 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 · 64 lines · 32 tokens per session scan A d1404962c9e7

Subscribe to this mod's changes

migrate-api-to-tanstack-query is a skill published in the GitHub repository bishopZ/2026-Boilerplate (24 stars, last pushed 1mo ago), licensed MIT. It adds 32 tokens to every session and 543 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.