react-query-best-practices
Installation
SKILL.md
React Query Best Practices
Rules for @tanstack/react-query v4 and v5, checked against the library source
(5.107.1 and 4.44.0), docs and changelog, and based on TkDodo's blog series. Each rule lives in
rules/<id>.md with incorrect and correct code.
Pin the version first
Read the installed version from the lockfile entry for @tanstack/react-query
(the package.json range can lie). Then:
- Apply the rules whose
versionsfrontmatter includes that major. - Skip a rule whose
sinceis above the installed version. - Inside a rule, use the code block labelled for that version. Unlabelled code is valid for every version the rule lists.
- Only the v3 package
react-querypresent → these rules don't apply.