Redocly/redocly-cli / packages/client-generator/eject-assets/skills/tanstack-query-generator
tanstack-query-generator
UnverifiedDesign of the ejected Redocly `tanstack-query` client generator. Read it, and update it, before changing generators/tanstack-query/.
The tanstack-query generator — its skill
This file is the DESIGN of your ejected tanstack-query generator (generators/tanstack-query/):
to change the generator, edit this skill first, then make the code match it — a diff
to generators/tanstack-query/ that has no covering sentence here is incomplete.
What it emits
Query/mutation option factories for TanStack Query — <op>Options(),
<op>Mutation(), and <op>InfiniteOptions() for paginated operations — plus exported
query keys. One generator, four framework variants (react default, -vue,
-svelte, -solid) differing only in the imported package.
Design decisions that must hold
- Options factories, not hooks: consumers call
useQuery(<op>Options(...)), so the output works with any of the framework adapters and stays testable. queryKeyPrefixnamespaces every key when several clients share a cache.- Infinite queries derive
getNextPageParamfrom the resolved pagination rule. Abody-linkrule gets one when the operation has a query parameter: the next page's URL is the page param, and each later page merges the URL's query parameters overvars. ALinkheader is invisible to aqueryFn, solink-style operations get only the sdk's.pages()/.items(). A page without a page parameter leaves the key out of the call, soexactOptionalPropertyTypesholds. envelopeis excluded and stripped — cached data is the plain body.- Requires
typescript; throw-mode only (it wraps thrown errors into query errors).
The stage files
render.ts holds the whole factory renderer; index.ts is the entry (the framework is
its one argument). The wrappable-operation policy and the sdk calling convention come
from the typescript generator's published contract
(@redocly/client-generator/contracts/typescript); the resolved pagination arrives from
the pipeline on the generator input.
Ejecting it
redocly eject-generator tanstack-query copies this generator's TypeScript source folder
to generators/tanstack-query/, exactly as we wrote it, importing
@redocly/client-generator, @redocly/client-generator/printers/typescript, and
@redocly/client-generator/contracts/typescript. Running a .ts generator uses Node's
type stripping (Node 22.18, 23.6, or newer); newer built-in versions merge in per file
with --update. The framework is a single argument in the ejected index.ts default
export (tanstackQueryGenerator('react')), so switch it to 'vue', 'svelte', or
'solid' there instead of ejecting four near-identical copies.
The modify loop
- Edit this skill: state the new behavior or decision.
- Make
generators/tanstack-query/match it. - Run
redocly generate-clientand inspect thegit diffof the generated output — generated files are never hand-edited.
Newer built-in versions merge in with redocly eject-generator tanstack-query --update.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |