react-query
Skill0 starsChanged 4 months agoMITView on GitHub
Guidelines for using React Query for data fetching, caching, and server state synchronization in React applications
2 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- Mindrally/skillsedited, first seen Oct 8, 2026
- udecode/better-convextheir own version, first seen Oct 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- Mindrally/skills★ 27521% same
Wrote their own version · 1
- udecode/better-convex★ 452same 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.
In this repository63 other files it gives its agents.
- .claude/skills/nestjs-best-practices/AGENTS.mdAGENTS.md
- accessibility-a11ySkill
- architecture-blueprint-generatorSkill
- backend-delivery-loopSkill
- backend-designSkill
- backend-dev-guidelinesSkill
- backend-testingSkill
- backend-to-frontend-handoff-docsSkill
- building-componentsSkill
- bullmq-specialistSkill
- canvas-designSkill
- code-patternsSkill
- components-composition-patternsSkill
- conventional-commitSkill
- core-web-vitalsSkill
- create-svgSkill
- css-architectureSkill
- cypress-authorSkill
- cypress-docsSkill
- cypress-explainSkill
- delivery-loop-retroSkill
- diagnoseSkill
- fastify-best-practicesSkill
- figma-code-connectSkill
- frontend-delivery-loopSkill
- frontend-fundamentalsSkill
- fullstack-delivery-loopSkill
- grill-meSkill
- hunt-race-conditionSkill
- impeccableSkill
- mermaid-diagramsSkill
- nestjs-best-practicesSkill
- nextjs-best-practicesSkill
- nextjs-performanceSkill
- nodejs-backend-patternsSkill
- owasp-security-reviewSkill
- performance-hunterSkill
- playwright-best-practicesSkill
- postgresql-code-reviewSkill
- postgresql-optimizationSkill
- postmanSkill
- prisma-postgresSkill
- pro-state-machineSkill
- race-conditionSkill
- react-best-practicesSkill
- react-performanceSkill
- redis-coreSkill
- redis-query-engineSkill
- redis-securitySkill
- refactorSkill
- review-panelSkill
- run-delivery-chainSkill
- spec-drivenSkill
- sql-optimizationSkill
- system-designSkill
- testing-strategySkill
- tune-skills-and-agentsSkill
- ui-ux-pro-maxSkill
- vercel-react-view-transitionsSkill
- viteSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 10 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use React Query for all data fetching and caching
- Very specific: line 10
Use React Context and useReducer for managing client-side global state
- Distinctive: line 11
Avoid excessive API calls through proper caching strategies
- Distinctive: line 12
Always handle loading states and errors properly
- Distinctive: line 38
Use React Query DevTools to inspect cache and track query status
- Distinctive: line 40
Always handle errors properly with user-friendly messages and retry options
- Distinctive: line 42
Avoid deeply nesting queries - flatten when possible for better performance
- Distinctive: line 43
Use local state for component-specific data, global state for shared data
- Very specific: line 48
Do not use useEffect for data fetching
- Very specific: line 49
Do not store server data in useState
- Distinctive: line 50
Do not forget loading and error state handling
- Distinctive: line 51
Do not create queries without proper cache invalidation strategies
- Very specific: line 52
Do not skip the enabled option for conditional queries
- Distinctive: line 53
Do not ignore TypeScript types for query responses
≈ “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
Core Principles
- Use React Query for all data fetching and caching
- Leverage React Query's built-in state management instead of
useStatefor server data - Use React Context and
useReducerfor managing client-side global state - Avoid excessive API calls through proper caching strategies
- Always handle loading states and errors properly
Topics by Concern
| Concern | Reference |
| Client setup & file layout | references/setup.md |
| Reading data | references/queries.md |
| Writing data | references/mutations.md |
| Server vs. client state | references/state-management.md |
| Caching speed & re-renders | references/performance.md |
| Failure handling & recovery | references/error-handling.md |
References
Each file is loaded on demand — read one only when the task needs that depth (progressive disclosure).
references/setup.md— feature-based project structure plus the one-timeQueryClient/QueryClientProviderconfiguration (staleTime, cacheTime, retry, DevTools) · read when scaffolding React Query in a project or tuning client defaults.references/queries.md— query hooks: basic typed query, service-thrown user-friendly errors, dependent (enabled) queries, paginated (keepPreviousData) queries, anduseInfiniteQuery· read when fetching/reading any server data.references/mutations.md— mutation hooks: basic mutation with cache invalidation, and the four-callback optimistic-update pattern (onMutate/onError/onSettled) · read when creating, updating, or deleting server data.references/state-management.md— the server-state vs. client-state split, integrating React Query alongside Context/Reducer or Zustand · read when deciding where a piece of state lives or wiring React Query into existing global state.references/performance.md— structured query-key factories,selectfor selective subscriptions, and prefetching on user intent · read when invalidation is imprecise, components re-render too often, or navigation feels slow.references/error-handling.md— globalQueryClientonErrordefaults andQueryErrorResetBoundary+ error boundaries with retry · read when standardizing error behavior or adding render-time error recovery.
Key Conventions
- Use React Query DevTools to inspect cache and track query status
- Group react-query hooks within feature-specific directories (feature-based organization)
- Always handle errors properly with user-friendly messages and retry options
- Fetch only required data - use API parameters to reduce data transfer
- Avoid deeply nesting queries - flatten when possible for better performance
- Use local state for component-specific data, global state for shared data
- Leverage React Query's built-in caching and state management capabilities
Anti-Patterns to Avoid
- Do not use
useEffectfor data fetching - Do not store server data in
useState - Do not forget loading and error state handling
- Do not create queries without proper cache invalidation strategies
- Do not skip the
enabledoption for conditional queries - Do not ignore TypeScript types for query responses
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

