react-query-classic-migration
Skill by trpc
Guides migration from the classic @trpc/react-query hooks to @trpc/tanstack-react-query. It covers the upgrade CLI codemod and the manual changes for hooks, invalidation and providers.
Install react-query-classic-migration
Built from the published package, never by AI.
git clone --depth 1 https://github.com/trpc/trpc /tmp/trpc && mkdir -p ~/.claude/skills && cp -r /tmp/trpc/packages/tanstack-react-query/skills/react-query-classic-migration ~/.claude/skills/react-query-classic-migrationRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install react-query-classic-migration in Claude Code
git clone --depth 1 https://github.com/trpc/trpc /tmp/trpc && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/trpc/packages/tanstack-react-query/skills/react-query-classic-migration ~/.gemini/antigravity-cli/skills/react-query-classic-migrationAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install react-query-classic-migration in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill walks through moving a tRPC React app from the classic @trpc/react-query hooks to the @trpc/tanstack-react-query options-factory client. It starts with running the npx @trpc/upgrade codemod and selecting the hooks and provider migrations, then runs a TypeScript check with tsc --noEmit. Each step shows the classic code next to the new code.
The two packages can coexist, so the migration can happen one component at a time. Queries and mutations move from hook calls to queryOptions and mutationOptions, and utils.invalidate becomes queryClient.invalidateQueries with queryFilter. It is for apps that already use the classic @trpc/react-query hooks.
Written from the project's SKILL.md and checked against it.
What it can do
- Run upgrade codemodRuns npx @trpc/upgrade with the hooks and provider migration options.
- Provider setupReplaces createTRPCReact with createTRPCContext and updates the app root provider.
- Query migrationConverts trpc.<route>.useQuery calls to useQuery with queryOptions.
- Mutation migrationConverts useMutation hook calls to useMutation with mutationOptions.
- Invalidation mappingMaps utils.invalidate and related calls to queryClient methods with trpc query filters.
- Typecheck and fixRuns tsc --noEmit and lists common type errors seen after migration.
- Remove classic packageShows how to uninstall @trpc/react-query once all files are migrated.
What you need
- npm and npx to run the upgrade CLI
- An existing app using @trpc/react-query
- TypeScript for the tsc --noEmit check
- Familiarity with the react-query-setup guide
Try asking
- Migrate my tRPC useQuery hooks to the queryOptions API
- Convert utils.post.invalidate calls to queryClient.invalidateQueries
- Replace createTRPCReact with createTRPCContext in my utils file
Good to know
- The npx @trpc/upgrade codemod is a work in progress and may miss complex cases.
- Dynamic query keys, conditional hooks and custom wrappers may need manual changes.
- Always run tsc --noEmit after the codemod and fix remaining errors.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: packages/tanstack-react-query/skills/react-query-classic-migration/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to react-query-classic-migration
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
react-query-classic-migration: common questions
Can I migrate from classic tRPC React hooks gradually?
Yes. The source says @trpc/react-query and @trpc/tanstack-react-query can coexist in the same app. It advises migrating one component at a time.
Does the codemod migrate everything automatically?
No. The source describes the codemod as a work in progress that handles common patterns. Remaining patterns need manual migration and a typecheck.
What replaces utils.invalidate in the new client?
The source uses queryClient.invalidateQueries with trpc.<route>.queryFilter(), where queryClient comes from useQueryClient and trpc from useTRPC.
How do I install react-query-classic-migration?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is react-query-classic-migration free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is react-query-classic-migration safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to react-query-classic-migration?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
