tanstack
Skill0 starsChanged 48 days agoMITView on GitHub
Uses TanStack Query, Router, Table, Form, Virtual, or Start in an existing or explicitly selected TanStack project. Use for its query keys, mutations, loaders, URL state, and library APIs; do not introduce the stack for generic React work.
We split this skill into the rules it gives an agent
10 rules. 0 are common, 4 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use the selected TanStack libraries for their specific data and routing contracts.
- Distinctive: line 17
Prefer Query or Router for shared server data.
- Very specific: line 22
Use stable, structured query keys (['todos', { status }]).
- Very specific: line 35
Import queryOptions and useQuery from @tanstack/react-query.
- Very specific: line 67
Treat search params as state — Router validates/serializes them (great for filters, pagination, tabs).
- Distinctive: line 72
Use Start when you need SSR/streaming, server functions, and shared Query hydration between server and client.
- Very specific: line 79
Virtual: use useVirtualizer when measured list or table rendering costs justify windowing.
- Very specific: line 84
Do: server data in Query, URL state in Router search params, UI state in useState.
- Distinctive: line 85
Avoid redundant copies of shared server data.
- Very specific: line 86
Don't omit data dependencies from query keys.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TanStack
Use the selected TanStack libraries for their specific data and routing contracts. Avoid maintaining an accidental second copy of shared server state in component state.
Apply the libraries already chosen by the project. This skill does not require migrating a working framework loader or adding the entire TanStack stack. Form drafts may intentionally start from server data and diverge while the user edits.
The core mental model
- Server state ≠ client state. Data owned by the server (lives in a DB, can change, is shared) belongs in TanStack Query, not
useState. - Reserve
useState/useReducerfor true UI state (open/closed, input draft, selection). - Prefer Query or Router for shared server data. Preserve justified effect-based integrations with appropriate race handling and cleanup.
TanStack Query (server state)
useQueryfor reads; it handles caching, dedup, background refetch, loading/error states.- Use stable, structured query keys (
['todos', { status }]). Keys are the cache identity. - Set
staleTimeintentionally — how long data is "fresh" before background refetch. Default 0 refetches often; raise it for stable data. - Co-locate query options in a factory so keys/fns stay consistent and reusable across components and route loaders.
const todosQuery = (status: string) => queryOptions({
queryKey: ['todos', { status }],
queryFn: ({ signal }) => fetchTodos(status, signal), // pass signal for cancellation
staleTime: 60_000,
});
useQuery(todosQuery(status));Import queryOptions and useQuery from @tanstack/react-query; queryOptions preserves inference for the query function context. Include every data-changing parameter in the key. Inline arrays and query functions are supported: keys are hashed by value, not object identity.
Mutations + optimistic updates
useMutationfor writes. After success, invalidate affected queries to refetch truth.- Optimistic update via
onMutate: cancel in-flight queries, snapshot, write the optimistic value; roll back inonErrorusing the snapshot; reconcile inonSettledby invalidating.
const key = todosQuery(status).queryKey; // the same filtered list used by useQuery
useMutation({
mutationFn: updateTodo,
onMutate: async (next) => {
await qc.cancelQueries({ queryKey: key, exact: true });
const prev = qc.getQueryData(key);
qc.setQueryData(key, (old) => old === undefined ? old : applyOptimistic(old, next));
return { prev };
},
onError: (_e, _next, ctx) => {
if (ctx?.prev !== undefined) qc.setQueryData(key, ctx.prev);
},
onSettled: () => qc.invalidateQueries({ queryKey: ['todos'] }), // reconcile
});This snapshot pattern assumes mutations to that list are serialized and the key remains fixed for the mutation's lifetime. Concurrent writes need mutation-aware reconciliation or optimistic UI derived from pending variables; restoring an old snapshot can erase a newer update. Make applyOptimistic respect the list's filter and leave uncached lists to refetch.
- Prefetch on intent (hover/route enter) with
queryClient.prefetchQueryto kill waterfalls. - React 19 note:
useOptimistic+ Actions give transient optimistic UI for a single form/mutation; Query'sonMutateupdates the shared cache so every component reading that key reflects it. Use Query's approach when the optimistic value must persist across components/navigation.
TanStack Router (routing + data)
- File/code-based routes are fully type-safe: typed params, search params, and links.
- Treat search params as state — Router validates/serializes them (great for filters, pagination, tabs). Don't duplicate them in
useState. - Load data in route loaders and integrate with Query (
ensureQueryData) so navigation prefetches and avoids component-mount waterfalls.
TanStack Start (SSR/full-stack)
- Use Start when you need SSR/streaming, server functions, and shared Query hydration between server and client.
- Prefetch in loaders on the server, dehydrate, and hydrate on the client so the first paint has data and no refetch flash.
- For pure SPA (no SSR needs), Router + Query alone is enough.
TanStack Table / Form / Virtual
- Table: headless — you own markup/styling; it manages sorting/filtering/pagination/grouping. Keep
columnsreferentially stable (define outside render oruseMemo). - Virtual: use
useVirtualizerwhen measured list or table rendering costs justify windowing. Preserve keyboard focus and accessible navigation. - Form: type-safe, headless form state + validation (pairs with a schema lib). Avoids re-rendering the whole form on each keystroke.
Do / Don't
- Do: server data in Query, URL state in Router search params, UI state in
useState. - Avoid redundant copies of shared server data; form drafts and external integrations may intentionally diverge from the cache.
- Don't omit data dependencies from query keys. Keep Table
columnsanddatastable where required; QueryqueryFndoes not need memoization solely to prevent refetches.
Reference
- TanStack docs: Query keys, Query options, Query mutations, Router, Start, Table, Form, Virtual.
- TkDodo's blog "Practical React Query" (the canonical Query best-practices series).
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- compozy/compozy★ 2.8ksame name
- pedronauck/skills★ 641same name
- tenequm/skills★ 40same name
- FelipeAngeli/skills★ 2same name
- barisariburnu/skills-collection★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use app-renderer-systems, refactoring-analysis and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
pedronauckSkillapp-renderer-systems
Create, extend, or debug frontend domain modules organized under systems/. Covers adapters, Query hooks, local state, and public exports; excludes generic components and backend implementation.
Also in 3 projects that use this
pedronauckSkillrefactoring-analysis
Audit code quality and architectural health or plan refactoring using Fowler code smells and techniques; write prioritized findings to docs/_refacs/. Excludes formatting, performance, and security audits.
Also in 3 projects that use this
jander99Skilltypescript-advanced
Design, implement, refactor, and debug advanced TypeScript patterns including generics, utility types, mapped types, conditional types, type guards, discriminated unions, and strict mode configuration. Use when writing type-safe code, fixing type errors, or improving type inference.
Also in 3 projects that use this
crafter-stationSkilltech-logos
Install official tech brand logos from the Elements registry. Use when user needs logos for tech companies (Clerk, Vercel, GitHub, etc.), AI providers (OpenAI, Anthropic, Claude), social platforms, or any brand assets. Triggers on "logo", "brand", "icon for [company]", "add [company] logo", placeholder logo detection, or when building landing pages, auth UIs, or integrations showcases.
Also in 3 projects that use this
azlekovSkilltailwindcss
This skill should be used when the user asks to "style with Tailwind", "add CSS", "configure theme", "use @theme", "add custom colors", "implement dark mode", "use container queries", "add responsive design", "use OKLCH colors", or discusses styling, theming, or visual design. Always use the latest Tailwind CSS version and modern patterns.
Also in 3 projects that use this
Kastalien-ResearchSkilleffect-ts
Comprehensive guide for Effect-TS, the functional TypeScript library. Use when building Effect applications, especially MCP servers. Covers correct APIs, common misconceptions, and MCP-specific patterns.
Also in 3 projects that use this
In this repository21 other files it gives its agents.
- ask-dont-assumeSkill
- browser-devtoolsSkill
- cachingSkill
- code-qualitySkill
- cssSkill
- database-guardrailsSkill
- gitSkill
- htmlSkill
- javascriptSkill
- low-level-web-renderingSkill
- react-best-practicesSkill
- react-three-fiberSkill
- securitySkill
- service-workerSkill
- vgpuSkill
- wasm-rustSkill
- web-design-guidelinesSkill
- webglSkill
- webgpuSkill
- web-performanceSkill
- webview2-winuiSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

