react-query-migrate-v5
Skill2 starsChanged 3 days agoMITView on GitHub
Upgrade a repo's TanStack Query for React to the latest v5 release, from v4 or from an older v5 minor, fixing every breaking change and deprecation.
In this repository11 other files it gives its agents.
- skills/feature-workflow/AGENTS.mdAGENTS.md
- skills/react-query-best-practices/AGENTS.mdAGENTS.md
- smc-crt-analysisAGENTS.md
- skills/validate-pr/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- babysit-prSkill
- feature-workflowSkill
- qa-verifySkill
- react-query-best-practicesSkill
- smc-crt-analysisSkill
- validate-prSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Start a branch from a clean tree.
- Very specific: line 53
Run remove-overloads first, since it normalizes call shapes for the rest, then rename-properties, is-loading, keep-previous-data and …
- Very specific: line 72
Run the sweep with the version installed before step 3.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Migrate React Query to v5
Carry one repo's @tanstack/react-query to the latest 5.x release and leave it
compiling, linted and tested. The sibling
react-query-best-practices skill
holds every fix as a rule with before → after code: migration-* rules cover
v4 → v5, upgrade-* rules cover changes inside v5. This skill sequences them.
Argument: an optional target version. Default: the latest 5.x on npm
(npm view @tanstack/react-query@5 version).
1. Detect
- Installed version: the lockfile entry for
@tanstack/react-query, not thepackage.jsonrange. Only the v3 packagereact-querypresent → report that v3 → v4 comes first and stop. - Path: from 4.x, run every step. From 5.x, skip step 4.
- Floors (
upgrade-toolchain-floors,migration-misc-breaking-changes): React^18 || ^19, TypeScript and browser minimums. A floor that fails → report it and stop: raising React or TypeScript is the human's call.
Done when the from/to versions and the path are written down and every floor passes.
2. Baseline
Start a branch from a clean tree. Run the repo's typecheck, lint and tests
(commands from AGENTS.md / CLAUDE.md, else package.json scripts) and save
the failures to .context/react-query-migrate/baseline.txt as pre-existing.
Done when the baseline file exists.
3. Bump packages
Bump every TanStack Query package the repo uses (react-query,
react-query-devtools, eslint-plugin-query, the persist client and
persisters) to the target version in one install.
Done when the lockfile resolves each of them to the target.
4. Codemods (from 4.x only)
Run remove-overloads first, since it normalizes call shapes for the rest,
then rename-properties, is-loading, keep-previous-data and
rename-hydrate, each followed by the repo's formatter:
npx jscodeshift@latest ./src --extensions=ts,tsx --parser=tsx \
--transform=./node_modules/@tanstack/react-query/build/codemods/v5/<name>/<name>.cjsReleases before 5.103.3 keep the codemods under build/codemods/src/v5/: use
that path when the first one is missing. Use --extensions=js,jsx without
--parser=tsx for JavaScript sources. Every
usage a codemod logs as skipped goes on the step 5 worklist with its file (and
line, when the log gives one).
Done when all five ran and their skipped usages are on the worklist.
5. Sweep
Run the sweep with the version installed before step 3. It picks the rules
in scope for that version and lists every hit as file:line:
node <this skill's dir>/sweep.mjs <from-version> .For each rule with hits, read the rule and apply its fix to every hit and worklist entry. Re-run the sweep after each rule.
Done when the sweep reports 0 hits for every row, or each remaining hit is listed with the reason it stays.
6. Validate
Re-run typecheck, lint and tests. Any failure missing from the baseline goes back through step 5.
Done when the only failures left are the baseline ones.
7. Report
- From → to versions, the codemods run, and the files changed per rule.
- Behaviour to check by hand. Some changes compile cleanly and still shift runtime behaviour. List each rule on the sweep's last line ("Runtime rules in scope") with the files it touched.
- Remaining hits with their reasons, and baseline failures left as found.
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.

