blockmatic/basilic-skills221 installs
openapi-ts-v0
Generate TypeScript clients from OpenAPI specs using @hey-api/openapi-ts — type-safe API clients. Use when generating TypeScript clients from OpenAPI specifications for frontend or API consumers.
How do I install this agent skill?
npx skills add https://github.com/blockmatic/basilic-skills --skill openapi-ts-v0Is this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides instructions and templates for using @hey-api/openapi-ts to generate type-safe TypeScript clients from OpenAPI specifications. It follows industry best practices for configuration, type-safety, and integration with React Query. No security issues were detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Skill: openapi-ts
Scope
- Applies to: Generating TypeScript clients from OpenAPI 3.0 specifications using
@hey-api/openapi-ts - Does NOT cover: Writing OpenAPI specs, API server implementation (see fastify)
Assumptions
@hey-api/openapi-tsv0+- OpenAPI 3.0 specification format
- TypeScript v5+ with strict mode
- Default output is types and client only; React Query hooks are handwritten in consuming apps
Principles
- Generate clients from OpenAPI specs (single source of truth)
- Client methods are fully typed from OpenAPI spec
- Error responses are typed from OpenAPI error schemas
- Use
createClientfactory for client instantiation - Configure output format and schema type in config file
- Zod schemas and generated React Query plugins are optional add-ons
Constraints
MUST
- Use
openapi-ts.config.tsfor configuration - Generate clients before using in code
- Handle
response.errorfor typed error responses
SHOULD
- Use Prettier formatting (
output.format: 'prettier') - Generate TypeScript enums (
types.enums: 'typescript') - Write TanStack Query hooks by hand against the generated client
- Add Zod schemas (
schemas.type: 'zod') only when runtime validation is required - Add generated React Query plugin only when the project opts into it
AVOID
- Manually editing generated code
- Using generated clients without error handling
- Mixing generated and manual client code
Interactions
- Consumes OpenAPI specs generated by fastify
- Works with next for API client usage
- Integrates with TanStack Query (see React Query Integration)
Patterns
Configuration Pattern
// 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',
},
})
Client Usage Pattern
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 for complete example.
References
- React Query Integration - Using generated clients with TanStack Query
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/blockmatic/basilic-skills/openapi-ts-v0">View openapi-ts-v0 on skillZs</a>