tanstack-query-docs
Skill2 starsChanged 16 days agoMITView on GitHub
Referencia completa de TanStack Query v5 para data fetching en Next.js 16 con React. Úsala SIEMPRE que trabajes con: useQuery, useMutation, useInfiniteQuery, QueryClient, QueryClientProvider, cache invalidation, prefetching en Server Components, Suspense queries, optimistic updates, deduplication de requests, retry logic, background refetch, o cuando debas decidir entre Server Component fetch y TanStack Query. También activa para: configuración de staleTime/gcTime, integración con Server Actions, o errores relacionados con hidratación y SSR.
In this repository31 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- private-template/CLAUDE.mdCLAUDE.md
- backend-quality-gateSkill
- blindarSkill
- brechasSkill
- crear-appSkill
- desarrollo-por-etapasSkill
- docker-docsSkill
- elegir-metodoSkill
- erp-saas-coreSkill
- fullstackSkill
- graphifySkill
- http-query-docsSkill
- mapa-bloqueSkill
- memory-bank-contextSkill
- mem-searchSkill
- microserviciosSkill
- minio-docsSkill
- nestjs-docsSkill
- nestjs-security-hardeningSkill
- nextjs-docsSkill
- prisma7-docsSkill
- prompt-masterSkill
- react-docsSkill
- redis-docsSkill
- skills-bundleSkill
- tailwind-docsSkill
- testing-actionsSkill
- typescript-docsSkill
- ui-ux-polishSkill
- zustand-docsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 67
v5 breaking change: no usar status === 'loading' → usar isLoading o isPending
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TanStack Query v5 — Referencia Completa
Documentación oficial (Context7)
Para la doc oficial y actualizada de TanStack Query v5, consulta el MCP Context7 (resolve-library-id → query-docs) antes de generar código con APIs que no domines al 100%. Si contradice esta skill en una regla del estándar, gana la skill; si es un detalle de API, gana Context7.
Cuándo usar TanStack Query vs Server Component fetch
Server Component fetch (sin TanStack Query)
✅ Datos que no cambian sin interacción del usuario
✅ Initial page load, SEO critical data
✅ No necesitas mostrar loading states en cliente
TanStack Query (en Client Components)
✅ Datos que se actualizan en respuesta a acciones del usuario
✅ Polling, background refetch, optimistic updates
✅ Cache compartido entre componentes
✅ Infinite scroll / paginationPatrones esenciales v5
// Query básica
const { data, isLoading, error } = useQuery({
queryKey: ["users", filters],
queryFn: () => fetchUsers(filters),
staleTime: 5 * 60 * 1000, // 5 minutos
});
// Mutation con invalidación
const mutation = useMutation({
mutationFn: createUser,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["users"] });
},
});
// Prefetch en Server Component (Next.js 16)
const queryClient = new QueryClient();
await queryClient.prefetchQuery({
queryKey: ["users"],
queryFn: fetchUsers,
});
// Pasar dehydratedState al cliente via HydrationBoundaryReglas no negociables
queryKeysiempre como array y debe incluir todos los parámetros que afecten el resultadostaleTimeexplícito en cada query — default 0 genera demasiadas peticiones- No llamar al mismo endpoint desde Server Component Y useQuery en el mismo render
- Invalidar por prefijo cuando sea posible:
{ queryKey: ['users'] }invalida todos los keys que empiecen con'users' - v5 breaking change: no usar
status === 'loading'→ usarisLoadingoisPending
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.

