# openapi-to-typescript

This skill turns an OpenAPI 3.0 file into TypeScript interfaces and type guards. Use it when API schemas need corresponding types in your codebase.

- skill · `type=skill` · Claude Code · 50 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/openapi-to-typescript
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/openapi-to-typescript

## What it does

The skill reads an OpenAPI file in JSON or YAML, checks its structure, then uses `components/schemas` and `paths` to build TypeScript output. Generated types cover schemas as well as endpoint parameters and responses. Required properties stay required; optional ones receive `?`. Enums and `$ref` links are handled too.

The document must identify an OpenAPI 3.0.x version and contain `paths`; `components.schemas` is needed when the spec defines types. Validation failures stop generation, so a spec from another version will not pass this check. The output also includes an `ApiError` interface and a guard for it. The skill asks where to write the result, with `types/api.ts` in the current directory as its suggested path.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --skill development/openapi-to-typescript
```

2. **Skills CLI (Vercel)**
```bash
npx skills add davila7/claude-code-templates --skill openapi-to-typescript -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/openapi-to-typescript/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/openapi-to-typescript/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/openapi-to-typescript/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/openapi-to-typescript/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davila7/claude-code-templates openapi-to-typescript
```

2. **Manually: put the files in place**
- File: `.github/skills/openapi-to-typescript/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/development/openapi-to-typescript
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/openapi-to-typescript/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/openapi-to-typescript

## When to use it
- generate TypeScript interfaces from OpenAPI schemas
- model API request parameters and responses
- add runtime checks for required fields
- represent enums and `$ref` links as TypeScript types

## Example prompts
- Generate TypeScript types from the `api.yaml` specification.
- Turn `openapi.json` into interfaces and guards for its API endpoints.
- Check this OpenAPI 3.0 file and save the result as `types/api.ts`.

## Similar
- [mcp-builder](https://affpapa.org/en/nevibecode/skills/mcp-builder.md) — skill · 130949 installs
- [claude-api](https://affpapa.org/en/nevibecode/skills/claude-api.md) — skill · 74198 installs
- [lark-im](https://affpapa.org/en/nevibecode/skills/lark-im.md) — skill · 472900 installs
- [lark-event](https://affpapa.org/en/nevibecode/skills/lark-event.md) — skill · 466800 installs
- [caveman-discover](https://affpapa.org/en/nevibecode/skills/caveman-discover.md) — skill · 104400 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 804 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
