$ recombobulate _
home / tips / generate-a-typed-api-client-sdk-from-your-openapi-spec-with-claude
0

Generate a Typed API Client SDK from Your OpenAPI Spec with Claude

bagwaa @bagwaa · Mar 26, 2026 · Workflows
generate-a-typed-api-client-sdk-from-your-openapi-spec-with-claude

Code-generated API clients from OpenAPI often produce unwieldy, poorly named output — ask Claude to write a handcrafted client that's actually pleasant to use.

claude "Read openapi.yaml and generate a fully typed TypeScript API client in src/lib/api-client.ts. Use the fetch API, include request/response types for every endpoint, group methods by resource (users, posts, orders), handle errors with a custom ApiError class, and support an auth token passed via constructor."

Claude produces a real client — not a sprawling auto-gen dump — with clean method names derived from the operationIds, proper generic return types, and an interceptor pattern for retries and token refresh.

For a React project, ask Claude to wrap it in a set of TanStack Query hooks at the same time:

claude "Now wrap the API client in React Query hooks in src/hooks/api/. Generate useQuery hooks for GET endpoints and useMutation hooks for POST/PUT/DELETE. Include optimistic updates for mutation hooks where the response matches a cached query key."

You can target any language — Python, Go, PHP:

claude "Read openapi.yaml and generate a Python requests-based client with dataclass models for all request/response bodies. Group by tag, use snake_case method names, and raise a typed APIError on non-2xx responses."

A Claude-written SDK feels like it was written by a developer who knows your codebase — not generated by a tool that doesn't.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago