← ClaudeAtlas

openapi-codegenlisted

OpenAPI client code generation. Covers openapi-typescript, openapi-generator-cli, swagger-typescript-api, and trpc-openapi. Use for generating type-safe API clients. USE WHEN: user mentions "OpenAPI codegen", "generate API client", "openapi-typescript", "swagger-typescript-api", "openapi-generator", asks about "generate types from OpenAPI", "type-safe API client", "OpenAPI client generation" DO NOT USE FOR: Writing OpenAPI specs - use `openapi` instead; GraphQL codegen - use `graphql-codegen` instead; tRPC - use `trpc` instead; Manual API client code
claude-dev-suite/claude-dev-suite · ★ 33 · AI & Automation · score 80
Install: claude install-skill claude-dev-suite/claude-dev-suite
# OpenAPI Code Generation Core Knowledge > **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `openapi-codegen` for comprehensive documentation. ## openapi-typescript (Types Only) Generates TypeScript types from OpenAPI schemas. Lightweight, no runtime. ```bash # Installation npm install -D openapi-typescript # Generate types npx openapi-typescript ./openapi.yaml -o ./src/types/api.ts npx openapi-typescript https://api.example.com/openapi.json -o ./src/types/api.ts ``` ### Generated Types Usage ```typescript import type { paths, components } from './types/api'; // Schema types type User = components['schemas']['User']; type CreateUserDto = components['schemas']['CreateUserDto']; // Request/Response types type CreateUserRequest = paths['/users']['post']['requestBody']['content']['application/json']; type UserResponse = paths['/users/{id}']['get']['responses']['200']['content']['application/json']; type UsersListResponse = paths['/users']['get']['responses']['200']['content']['application/json']; // Path parameters type UserPathParams = paths['/users/{id}']['get']['parameters']['path']; ``` ### With openapi-fetch ```typescript import createClient from 'openapi-fetch'; import type { paths } from './types/api'; const client = createClient<paths>({ baseUrl: 'https://api.example.com', }); // Fully typed requests const { data, error } = await client.GET('/users/{id}', { params: { path: { id: '123' } }, }); const { data } = await client.POST(