install
source · Clone the upstream repo
git clone https://github.com/Intense-Visions/harness-engineering
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/Intense-Visions/harness-engineering "$T" && mkdir -p ~/.claude/skills && cp -r "$T/agents/skills/codex/tanstack-devtools" ~/.claude/skills/intense-visions-harness-engineering-tanstack-devtools-ac0add && rm -rf "$T"
manifest:
agents/skills/codex/tanstack-devtools/SKILL.mdsource content
TanStack Query DevTools
Inspect cache state, query status, and network activity using the React Query DevTools panel
When to Use
- Debugging why a query is refetching unexpectedly
- Inspecting cache entries to verify data shape and freshness
- Verifying that mutations correctly invalidate the expected queries
- Checking query key structures and deduplication behavior
- Understanding
,staleTime
, and observer counts for performance tuninggcTime
Instructions
- Install
as a dev dependency — never ship it to production accidentally.@tanstack/react-query-devtools - Import and render
inside your<ReactQueryDevtools>
— it mounts a floating panel in the browser.QueryClientProvider - Use
(default) to keep the panel collapsed at startup — it opens on demand via the TanStack logo button.initialIsOpen={false} - Use
to move the toggle button away from UI elements:buttonPosition
,'top-left'
,'top-right'
,'bottom-left'
.'bottom-right' - Guard with a process.env check or use dynamic import to ensure DevTools code is never bundled in production builds.
- Use the query panel's "Refetch" button to manually trigger a refetch — useful for testing refetch behavior without network changes.
- Click a query entry to see its key, status (
,fresh
,stale
,fetching
),paused
,staleTime
, observer count, and cached data.gcTime
// app/providers.tsx — QueryClientProvider with DevTools 'use client'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { useState } from 'react'; export function QueryProvider({ children }: { children: React.ReactNode }) { const [queryClient] = useState(() => new QueryClient({ defaultOptions: { queries: { staleTime: 60 * 1000 }, }, })); return ( <QueryClientProvider client={queryClient}> {children} {/* DevTools only loads in development — tree-shaken in production */} <ReactQueryDevtools initialIsOpen={false} buttonPosition="bottom-right" /> </QueryClientProvider> ); } // Alternative: dynamic import to guarantee no production bundle impact import dynamic from 'next/dynamic'; const ReactQueryDevtools = process.env.NODE_ENV === 'development' ? dynamic(() => import('@tanstack/react-query-devtools').then(mod => ({ default: mod.ReactQueryDevtools, })) ) : () => null;
Details
The React Query DevTools panel has three main areas:
Query panel (left sidebar): Lists all cached queries with color-coded status indicators. Green = fresh, yellow = stale, gray = inactive, blue = fetching, red = error. The number in parentheses is the observer count — how many components are currently subscribed to that query.
Query details (right panel): Clicking a query shows its full key, current status,
staleTime, gcTime, last updated timestamp, observer count, and the raw cached data in an expandable JSON tree. This is the primary tool for debugging key mismatches and stale data issues.
Actions: Each query entry has actions:
Refetch (triggers an immediate background refetch), Invalidate (marks stale and refetches active), Reset (removes cached data), and Remove (evicts from cache). These allow debugging cache behavior without modifying code.
Status meanings:
: data is withinfresh
— will not refetch on mountstaleTime
:stale
expired — will refetch on next mount or window focusstaleTime
: active network request in progressfetching
: query is paused (offline or network issue)paused
: no components are subscribed — GC timer is runninginactive
: last fetch failederror
Observer count: An observer count of
0 means no component is mounted that uses this query — the GC timer is running. Once it hits 0 and gcTime expires, the entry is removed. Multiple observers on the same query means multiple components share one cache entry.
Production safety:
@tanstack/react-query-devtools is automatically excluded from production builds when using Next.js or Vite's tree-shaking if imported conditionally. The process.env.NODE_ENV === 'development' guard ensures zero bundle impact.
Source
https://tanstack.com/query/latest/docs/framework/react/devtools
Process
- Read the instructions and examples in this document.
- Apply the patterns to your implementation, adapting to your specific context.
- Verify your implementation against the details and edge cases listed above.
Harness Integration
- Type: knowledge — this skill is a reference document, not a procedural workflow.
- No tools or state — consumed as context by other skills and agents.
Success Criteria
- The patterns described in this document are applied correctly in the implementation.
- Edge cases and anti-patterns listed in this document are avoided.