# Generate TypeScript from OpenAPI Specs

API teams need TypeScript models that stay aligned with OpenAPI contracts. This skill converts OpenAPI 3.0 specs into interfaces, endpoint types, and runtime guards.

## Install

```bash
npx skillstore add softaworks/openapi-to-typescript
```

## Metadata

- Status: approved
- Slug: softaworks-openapi-to-typescript
- Skillstore revision: r1
- Version status: missing
- Tree hash: 03c5cbcda337de3caf614bb739c7941593452bf2f637c03eb08f489eb92fa654
- Author: softaworks
- GitHub username: softaworks
- License: MIT
- Repository: https://github.com/softaworks/agent-toolkit/tree/main/skills/openapi-to-typescript/
- Ref: f93e9bb0daca99badb6a7e574b97737155d57cb3
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/softaworks-openapi-to-typescript
- Manifest: https://skillstore.pages.dev/api/skills/softaworks-openapi-to-typescript/manifest

## Capabilities

- Validates required OpenAPI 3.0 fields before generation.
- Maps primitive, formatted, array, enum, union, and intersection schemas to TypeScript types.
- Generates interfaces from components/schemas with required and optional fields.
- Creates request and response types from documented API paths.
- Generates runtime type guards and a shared API error type.

## Use Cases

- Frontend API Integration: Convert backend OpenAPI specs into TypeScript contracts for UI data fetching and response handling.
- Shared Service Contracts: Publish generated request and response types for teams that consume internal APIs.
- Response Validation in Tests: Use generated type guards to validate API responses in automated test workflows.

## Prompt Templates

### Generate Basic Types

```
Generate TypeScript interfaces from ./openapi.json and save them to types/api.ts. Report validation errors before writing files.
```

### Use a Custom Output Path

```
Convert ./specs/service.yaml into TypeScript request, response, and schema types. Save the result to src/generated/api-types.ts.
```

### Compare Regenerated Types

```
Regenerate types from ./openapi.yaml, compare the result with src/types/api.ts, and summarize any breaking type changes.
```

### Handle Complex Schemas

```
Convert ./api/openapi.yaml and review oneOf, allOf, enums, arrays, and unresolved references. Flag areas needing manual review.
```

## Limitations

- Supports OpenAPI 3.0.x, not Swagger 2.0 or OpenAPI 3.1.
- Uses referenced schema names directly instead of fully inlining every $ref.
- Complex allOf and circular reference cases may need manual review.
- Generates types and guards, not a full API client implementation.

## Best Practices

- Validate the OpenAPI spec before generation to fix contract errors early.
- Regenerate types whenever the source API specification changes.
- Review warnings for unknown types, circular references, and complex allOf schemas.

## Anti Patterns

- Do not edit generated files manually when the source spec can be updated.
- Do not treat generated type guards as complete business-rule validation.
- Do not ignore unresolved references or unknown types in generated output.

## Security Audit

- Audited at: 2026-07-07T05:25:52.52\+00:00
- Summary: All 58 static findings were adjudicated as false positives. The external command alerts came from Markdown backticks, inline identifiers, JSON examples, and TypeScript examples rather than executable shell or Ruby code. The system reconnaissance alerts matched type-checking examples and OpenAPI validation text, and no prompt-injection or exfiltration intent was found.

## Stats

- Views: 269
- Downloads: 9
- Favorites: 0
- Popularity score: 0
