TanStack Query Expert - CLAUDE.md Rules for Claude Code
Transform Claude into a TanStack Query specialist with deep knowledge of query keys, caching, mutations, optimistic updates, and server-state synchronization.
Open the source and read safety notes before installing.
Privacy notes
- Query functions may call authenticated APIs; avoid logging tokens or user PII from query results.
Schema details
- Install type
- copy
- Troubleshooting
- No
Full copyable content
You are an expert TanStack Query developer focused on predictable server-state caching.
## Query keys and fetching
- Structure query keys from most general to most specific (e.g. `['todos', { status }]`)
- Colocate `queryFn` with the key shape; keep fetch logic in dedicated API modules
- Set `staleTime` and `gcTime` intentionally per data freshness requirements
## Mutations and cache updates
- Use `useMutation` with `onSuccess` to invalidate or update related query keys
- Prefer `queryClient.setQueryData` for optimistic updates with rollback on error
- Invalidate the narrowest key scope that covers affected views
## Loading and error UX
- Distinguish `isPending`, `isFetching`, and `isError` in UI states
- Use `placeholderData` or `initialData` to avoid layout shift where appropriate
- Surface retry actions via `refetch` rather than remounting components
## Performance
- Prefetch on hover or route transition for likely next queries
- Avoid duplicate queries by sharing keys across components
- Use `select` to derive subsets and reduce unnecessary re-rendersAbout this resource
Use these rules when building or reviewing TanStack Query server-state layers.
Source citations
Add this badge to your README
Show that TanStack Query Expert - CLAUDE.md Rules for Claude Code is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/rules/tanstack-query-expert)How it compares
TanStack Query Expert - CLAUDE.md Rules for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | TanStack Query Expert - CLAUDE.md Rules for Claude Code Transform Claude into a TanStack Query specialist with deep knowledge of query keys, caching, mutations, optimistic updates, and server-state synchronization. Open dossier | React Expert - CLAUDE.md Rules for Claude Code Transform Claude into a framework-agnostic React core specialist focused on the built-in Hooks, the Rules of Hooks, and component fundamentals from the official React docs Open dossier | React Next.js Expert - CLAUDE.md Rules for Claude Code Next.js App Router production-architecture specialist focused on the server/client boundary, the explicit caching model, route handlers, and Node-vs-Edge runtime tradeoffs — decisions, not component tips Open dossier | Redis Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Redis specialist with deep knowledge of data structures, caching patterns, TTL strategy, pipelining, and production operations. Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety · Privacy ✓ | Safety · Privacy ✓ | Safety ✓ Privacy ✓ | Safety · Privacy ✓ |
| Category | rules | rules | rules | rules |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | jaso0n0818 | JSONbored | JSONbored | jaso0n0818 |
| Added | 2026-06-19 | 2025-09-15 | 2025-09-15 | 2026-06-16 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | — missing | — missing | ✓These are advisory CLAUDE.md rules for Next.js App Router architecture; they guide code structure and make no changes to infrastructure. Review generated server/client boundaries and data fetching before shipping. | — missing |
| Privacy notes | ✓Query functions may call authenticated APIs; avoid logging tokens or user PII from query results. | ✓Guidance covers React state and effects; keep API keys, tokens, and secrets out of client-side React code and bundles, since anything in the client is exposed to users. | ✓This rule guides Next.js architecture decisions on your own codebase. It explicitly warns against leaking server-only modules and secrets into Client Components, and does not collect or transmit any data itself. | ✓Rules reference Redis AUTH passwords and TLS certificates; store them in environment variables or a secrets manager, never in committed config files or client connection strings in source control. |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | — | — | — | — |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.