This skill generates type-safe TypeScript API clients from OpenAPI specs using @hey-api/openapi-ts with Zod validation.
npx playbooks add skill blockmatic-icebox/basilic-old --skill openapi-ts-v0
@hey-api/openapi-ts@hey-api/openapi-ts v0+createClient factory for client instantiationopenapi-ts.config.ts for configurationresponse.error for typed error responsesschemas.type: 'zod') for runtime validationoutput.format: 'prettier')types.enums: 'typescript')// openapi-ts.config.ts
import { defineConfig } from '@hey-api/openapi-ts'
export default defineConfig({
input: './openapi.json',
output: {
path: './src/gen',
format: 'prettier',
},
types: {
enums: 'typescript',
},
schemas: {
type: 'zod',
},
})
import { createClient } from './gen/client'
const client = createClient({
baseUrl: 'https://api.example.com',
})
const response = await client.GET('/users/{id}', {
params: { path: { id: '123' } },
})
if (response.error) {
// Handle typed error
return
}
// response.data is typed from OpenAPI spec
See [Config Template](templates/openapi-ts.config.ts) for complete example.
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.