React Query Best Practices
CheckedHelps with React, querying, best practices as part of building frontend UIs and user experiences workflows.
Install on your platform
Showing Claude Code. One command installs this skill into any of the agents below.
- 1
Run this in your project
terminal$ npx skills add arraydude/agent-skills --skill react-query-best-practices -a claude-code Uses the open-source
skillsCLI and needs Node.js. Add-gto install it for your user instead of this project.
What we know about this skill
Publisher
arraydude
Taken from the source listing. We haven't verified who controls this account.
Install target
Live repository
Not pinned. Installing fetches whatever the repository holds at the time you run the command.
Automated safety checks
This skill passed all 6 checks. We read its files at one commit and looked for the things that make a skill dangerous to run — not for whether it works.
Declares what it does: passed
SKILL.md parses and declares a name and a description.
SKILL.md exists, its frontmatter parses, and it declares a name and a description.
No undeclared network calls: passed
Makes no network calls.
Every host the skill dials — from its scripts, its config endpoints or the commands it tells the agent to run — is either well-known package and API infrastructure or declared in its own frontmatter. Links in documentation are not counted.
No obfuscated payloads: passed
No encoded or obfuscated payloads.
No base64, hex or compressed blob is decoded and then executed, and no encoded shell commands.
No credential access: passed
Reads no keys, tokens, keychains or credential files.
Neither the code nor the SKILL.md instructions read SSH keys, cloud credentials, keychains, token stores, browser cookie databases or dotfiles that hold secrets.
No pipe-to-shell installers: passed
No pipe-to-shell or download-and-run installers.
No `curl … | sh` pattern, in the code or in the instructions, that runs code fetched at run time.
Pinned to a commit: passed
Scanned arraydude/agent-skills at 9abd1b817b.
The exact upstream commit SHA that was scanned is recorded, so the result refers to specific bytes.
- Commit
- 9abd1b817b
- Scanned
- 40 files, 2,920 lines
About this skill
What it does
This skill provides a comprehensive guide to React Query v4 (TanStack Query) based on TkDodo's blog series. It offers 24 prioritized rules across seven categories, covering topics like query keys, mutations, caching strategies, WebSocket integration, and TypeScript usage. The goal is to help developers build efficient and maintainable frontend UIs using React Query best practices.
When to use it
- When implementing new queries or mutations in a React application.
- When integrating WebSockets with React Query for real-time data updates.
- To establish effective query invalidation patterns after data modifications.
- For debugging unexpected behavior within your React Query implementation.
- When optimizing the render performance of components using React Query.
Key capabilities
- Prioritized Rules: Provides 24 rules categorized by impact (Critical, High, Medium).
- Query Key Management: Guidance on creating consistent and effective query keys (
query-keys-as-dependencies,query-key-factory). - Mutation Handling: Best practices for mutations and updates including invalidation and optimistic updates (
mutation-invalidation,mutation-optimistic-updates). - Caching Strategies: Advice on managing the React Query cache effectively (
cache-). - WebSocket Integration: Patterns for integrating WebSockets with React Query.
- TypeScript Support: Guidance on using React Query with TypeScript.
Example prompts
- "What are some best practices for creating query keys in React Query?"
- "How should I handle mutations and ensure queries are invalidated afterwards?"
- "Can you explain the difference between
placeholderandinitialdata in a React Query query?" - "I'm integrating WebSockets with React Query, what patterns should I follow?"
Tips & gotchas
- React Query Version: This skill is specifically tailored for React Query v4. Patterns may differ in version 5.
- Prioritization: Focus on the "Critical" and "High" priority rules first to maximize impact.
- Rule Prefixes: Rules are categorized using prefixes like
query-,mutation-,cache-for easy identification (e.g.,query-keys-as-dependencies).