/saschb2b-skills:codegen-apifrom saschb2b-skills
Sets up typesafe API code generation for REST (OpenAPI via hey-api) and GraphQL (graphql-codegen, gql.tada), preferring framework-agnostic options factories over generated hooks.
Ships in saschb2b-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate options, not hooks. Generate documents, not per-query types.
Both ecosystems converged in 2024-2025. REST and GraphQL codegens stopped emitting framework-specific hooks (useGetPet, useFilmsQuery) and started emitting framework-agnostic primitives that plug into the data-fetching library's existing hooks. Do not reach for legacy codegen plugins that emit hooks or per-query prop types.
This is the most common failure mode in LLM-generated API wiring: the bulk of training corpora reflects the pre-shift hooks pattern, so the default output reaches for @graphql-codegen/typescript-react-apollo, typescript-react-query, or openapi-typescript-codegen hook generators.
| API source | Data fetching | Pick |
|---|---|---|
| OpenAPI / REST | TanStack Query (any framework) | @hey-api/openapi-ts with @tanstack/react-query plugin |
| GraphQL | Apollo Client or urql | graphql-codegen client preset, default documentMode (AST) |
| GraphQL | TanStack Query (custom fetch) | graphql-codegen client preset with documentMode: "string" |
| GraphQL, small schema, no build step | any | gql.tada (zero-codegen, TS inference) |
| OpenAPI / REST, existing Orval setup | TanStack Query | Stay on Orval until queryOptions ships. Do not migrate without cause. |
Avoid: @graphql-codegen/typescript-react-apollo, @graphql-codegen/typescript-react-query, openapi-typescript-codegen hook generators. Deprecated or community-stale.
Hey API (REST → TanStack Query):
// openapi-ts.config.ts
import { defineConfig } from "@hey-api/openapi-ts";
export default defineConfig({
input: "./openapi.yaml",
output: "src/client",
plugins: ["@hey-api/typescript", "@hey-api/sdk", "@tanstack/react-query"],
});
Add to package.json: "codegen:api": "openapi-ts".
graphql-codegen client preset (Apollo / urql):
// codegen.ts
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: "https://api.example.com/graphql",
documents: ["src/**/*.{ts,tsx}", "!src/gql/**/*"],
ignoreNoDocuments: true,
generates: {
"./src/gql/": {
preset: "client",
config: { enumsAsTypes: true },
presetConfig: { fragmentMasking: { unmaskFunctionName: "getFragmentData" } },
},
},
};
export default config;
graphql-codegen client preset (TanStack Query): same as above plus config.documentMode: "string" so the codegen emits TypedDocumentString for a custom execute wrapper.
CRITICAL.
documentMode: "string"paired with Apollo or urql makes all query results type asany. Those clients want the AST default. Only use"string"with TanStack Query plus a custom fetch wrapper.
gql.tada:
// tsconfig.json
{
"compilerOptions": {
"plugins": [{
"name": "gql.tada/ts-plugin",
"schema": "./schema.graphql",
"tadaOutputLocation": "./src/graphql-env.d.ts"
}]
}
}
No codegen script. Types update with TypeScript.
// REST (hey-api)
const { data } = useQuery({
...getPetByIdOptions({ path: { petId } }),
staleTime: 5000,
});
// GraphQL (codegen, Apollo / urql)
const { data } = useQuery(AllFilmsQuery);
// GraphQL (codegen, TanStack)
const { data } = useQuery({
queryKey: ["allPeople"],
queryFn: () => execute(PeopleQuery),
});
Do not wrap these in custom useFilmCard or useGetPet hooks. The generated primitive is already the right level of abstraction. Hook wrappers only existed historically to carry types; fragment masking now does that better.
If the component tree has more than one layer, do not generate per-query prop types and do not build hook wrappers per component. Use fragment masking: each component declares its own data via a fragment, parents cannot see fields they did not request. Full three-layer example, ownership table, and the gql.tada equivalent (readFragment) in fragments.md.
For a single page that fetches data and renders it directly with no child components, the inferred useQuery type is fine. Do not add fragments to a flat component.
Both hey-api and graphql-codegen can emit Zod schemas at system boundaries:
plugins: ["@hey-api/typescript", "@hey-api/sdk", "@tanstack/react-query", "zod"]
Useful where the data cannot be trusted (third-party APIs, user uploads).
Codegen watch mode breaks ESLint's TypeScript cache. The popular VS Code GraphQL extension does not autocomplete inside graphql(). Fixes in dx-pitfalls.md.
Based on Typesafe API Code Generation for React in 2026. Deeper detail in fragments.md and dx-pitfalls.md.
CARD.manifest.json (opens in a new tab)CARD.md (opens in a new tab)CARD.md.sigstore (opens in a new tab)CARD.svg (opens in a new tab)permissions.yaml (opens in a new tab)references/dx-pitfalls.md (opens in a new tab)references/fragments.md (opens in a new tab)references/index.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (saschb2b/skills) — no native marketplace selected
npx claudepluginhub p/saschb2b-saschb2b-skills26 skills in this plugin
/android-composeModern Android development with Jetpack Compose as the default UI toolkit and Material 3 Expressive as the default design direction, a dated snapshot. Covers Compose fundamentals (composables, modifiers, state hoisting, side effects, lazy lists, strong skipping, recomposition), Material 3 and Expressive theming and components (MaterialExpressiveTheme, MotionScheme, button groups, split buttons, FAB menu, floating toolbars, wavy progress indicators, shape morphing, dynamic color), architecture (ViewModel, StateFlow, collectAsStateWithLifecycle, Hilt), type-safe Navigation Compose and Navigation 3, data (Room, DataStore, Retrofit, Ktor, Coil), the Gradle Kotlin DSL build with version catalogs and KSP, testing, performance, and View interop. Use when building Android UI in Compose, theming with Material 3 or Expressive, wiring architecture or navigation, configuring the build, or debugging Compose issues. Check the project's versions first; re-verify version facts against the official Android and AndroidX docs./ask-uxForce UX questioning before any UI work, refactor, or redesign. Use when the user asks to design, redesign, restyle, polish, "fix", or "make nicer" a screen, component, page, or flow. Also use when the user describes a problem in UI terms ("the button is hard to find", "this form is confusing", "this page is ugly") and is about to reach for a visual fix, since most UI-shaped complaints have UX-shaped causes./audit-actionsAudit a repository's GitHub Actions workflows for unsafe pull_request_target usage that can lead to supply chain compromise. Use when the user asks to audit workflows, review CI/CD security, check pwn request risk, harden Actions, or after a supply chain incident in a dependency. Also use proactively when reviewing any PR that touches .github/workflows/./autopilotWork autonomously on a project without waiting for direction. On command, survey the codebase, pick one high-value low-risk improvement, do it, verify it, commit it, then pick the next, looping like a self-directed intern. Use when the user hands off open-endedly ("work on your own", "keep improving this", "find something worth doing", "don't wait for me", "go autonomous", "run for a while", "be a passionate intern", "do whatever you think is valuable") or invokes /autopilot, and you have to choose the work yourself rather than wait for instructions or feedback./breadcrumbsHeal codebase understanding gaps exposed during implementation, debugging, or investigation. Use when tracing reveals misleading names, repeated backtracking, disconnected navigation paths, hidden contracts, surprising dependencies, stale documentation, unclear errors, undocumented constraints, false leads, or avoidable complexity. Make the smallest durable improvement at the source through clearer code, types, validation, tests, errors, comments, or existing documentation. Also use when a task was harder to grasp than it should have been or you think "that should have been documented." Do not create a breadcrumb trail, investigation log, freshness system, or separate knowledge store./comment-stinkyDetect code-comment smells in any language, explain the cost of each, and propose the rewrite. Built against the failure mode where a comment narrates the edit that produced it (now, no longer, previously, instead of the old X) rather than the standing reason the code has its shape, because the reader only ever has the file, never the diff. Six pillars and 37 categories cover change narration and diff residue, redundancy (restating the code, signature echo, banner ceremony), missing intent (magic constants, workarounds, swallowed errors, unstated invariants), truth and decay (stale and lying comments, dead anchors), placement and form (a comment that wants to be a name, a test, or a doc comment, unowned TODOs), and voice. Ships a four-question write gate and a taxonomy of the nine comments worth writing. Apply implicitly whenever you write or edit a comment or docstring, and when asked to comment, document, audit, or clean up comments in a codebase, diff, file, or snippet. Defers prose register to no-slop.Other plugins' skills for the same job