Best use case
TanStack is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
## Overview
Teams using TanStack should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/tanstack/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How TanStack Compares
| Feature / Agent | TanStack | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
## Overview
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# TanStack
## Overview
The TanStack ecosystem provides type-safe client libraries for React: Query for declarative data fetching and caching, Router for fully typed routing with search parameters, Table for headless data tables with sorting/filtering/pagination, and Virtual for rendering large lists efficiently.
## Instructions
- When fetching data, use `useQuery()` with hierarchical query keys (e.g., `["users", userId, "posts"]`) and configure `staleTime` based on freshness needs (0 for real-time, 5 minutes for dashboards, Infinity for static data).
- When performing mutations, use `useMutation()` with `onSuccess` for cache invalidation via `queryClient.invalidateQueries()`, and `onMutate` for optimistic updates with rollback.
- When building tables, use TanStack Table's headless approach with typed column definitions, and combine with `@tanstack/react-virtual` for datasets with 10,000+ rows.
- When routing, use TanStack Router for fully typed route parameters and search params with Zod validation, file-based routes with automatic type generation, and route-level data loading.
- When handling pagination, use `useInfiniteQuery()` for infinite scroll or cursor-based patterns, and server-side pagination in TanStack Table.
- When prefetching, use `queryClient.prefetchQuery()` for anticipated navigation and `useSuspenseQuery()` for React Suspense integration.
- When virtualizing lists, use `@tanstack/react-virtual` with `estimateSize` for scroll position prediction and support for dynamic, variable-height items.
## Examples
### Example 1: Build a data dashboard with Query and Table
**User request:** "Create a dashboard with server-paginated data table and real-time stats"
**Actions:**
1. Set up TanStack Query with appropriate `staleTime` and refetch intervals for stats
2. Define TanStack Table with typed columns, server-side sorting and pagination
3. Implement filter controls with column filters and global search
4. Add optimistic updates for inline row editing with mutation rollback
**Output:** A dashboard with efficient data fetching, server-managed table pagination, and instant edit feedback.
### Example 2: Add type-safe routing with data prefetching
**User request:** "Set up TanStack Router with typed search parameters and data preloading"
**Actions:**
1. Define routes with typed parameters and Zod-validated search params
2. Add route loaders for data fetching with built-in caching
3. Configure `<Link>` components with type-checked params and search params
4. Enable prefetching on hover for instant navigation
**Output:** A fully typed routing layer where invalid params cause TypeScript errors at compile time.
## Guidelines
- Use query key factories for consistent cache keys: `const userKeys = { all: ["users"], detail: (id) => ["users", id] }`.
- Set `staleTime` based on data freshness needs: 0 for real-time, 5 minutes for dashboards, Infinity for static data.
- Always define `onError` for mutations; silent failures confuse users.
- Use `placeholderData` instead of `initialData` for loading states; placeholder does not write to cache.
- Use TanStack Table with `@tanstack/react-virtual` for large datasets; do not render thousands of DOM nodes.
- Keep query functions pure: they receive `queryKey` and return data with no side effects.
- Use `queryClient.invalidateQueries()` after mutations instead of manual cache updates for simplicity.Related Skills
tanstack-integration
Find opportunities to improve web application code using TanStack libraries (Query, Table, Form, Router, etc.). Avoid man-with-hammer syndrome by applying TanStack after vanilla implementation works.
pitfalls-tanstack-query
TanStack Query v5 patterns and common pitfalls. Use when implementing data fetching, cache invalidation, or debugging stale data issues. Triggers on: useQuery, useMutation, queryKey, invalidate, TanStack, React Query.
TanStack Table
## Overview
Daily Logs
Record the user's daily activities, progress, decisions, and learnings in a structured, chronological format.
Socratic Method: The Dialectic Engine
This skill transforms Claude into a Socratic agent — a cognitive partner who guides
Sokratische Methode: Die Dialektik-Maschine
Dieser Skill verwandelt Claude in einen sokratischen Agenten — einen kognitiven Partner, der Nutzende durch systematisches Fragen zur Wissensentdeckung führt, anstatt direkt zu instruieren.
College Football Data (CFB)
Before writing queries, consult `references/api-reference.md` for endpoints, conference IDs, team IDs, and data shapes.
College Basketball Data (CBB)
Before writing queries, consult `references/api-reference.md` for endpoints, conference IDs, team IDs, and data shapes.
Betting Analysis
Before writing queries, consult `references/api-reference.md` for odds formats, command parameters, and key concepts.
Research Proposal Generator
Generate high-quality academic research proposals for PhD applications following Nature Reviews-style academic writing conventions.
Paper Slide Deck Generator
Transform academic papers and content into professional slide deck images with automatic figure extraction.
Medical Imaging AI Literature Review Skill
Write comprehensive literature reviews following a systematic 7-phase workflow.