schema-generate

Generate TypeScript types from JSON Schema, OpenAPI specs, and SQLite databases using the s2t CLI

7 stars

Best use case

schema-generate is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generate TypeScript types from JSON Schema, OpenAPI specs, and SQLite databases using the s2t CLI

Teams using schema-generate should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/schema-generate/SKILL.md --create-dirs "https://raw.githubusercontent.com/heldernoid/agentic-build-templates/main/projects/developer-tools/schema-to-types/skills/schema-generate/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/schema-generate/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How schema-generate Compares

Feature / Agentschema-generateStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generate TypeScript types from JSON Schema, OpenAPI specs, and SQLite databases using the s2t CLI

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# schema-generate

Use this skill when you need to generate or regenerate TypeScript type definitions from schema sources.

## Commands

### Generate all inputs
```
s2t generate
```
Runs all configured inputs and writes output files. Exits 0 if all succeed, 1 if any fail.

### Generate specific inputs
```
s2t generate user-schema openapi-spec
```
Runs only the listed input IDs. Useful in CI to regenerate after a schema change.

### Check what would be generated (list)
```
s2t list
```
Shows all inputs with their current status (success/unchanged/error) and output paths.

## s2t.yaml format

```yaml
inputs:
  - id: user-schema
    type: json-schema        # json-schema | openapi | sqlite
    source: schemas/user.json
    output: src/types/user.ts

  - id: openapi-spec
    type: openapi
    source: openapi.yaml
    output: src/types/api.ts

  - id: app-db
    type: sqlite
    source: ./app.db
    output: src/types/db.ts
```

### Input types

- `json-schema` - JSON Schema draft-07 processed via json-schema-to-typescript
- `openapi` - OpenAPI 3.x or Swagger 2.x parsed via @apidevtools/swagger-parser, component schemas converted to TS interfaces
- `sqlite` - SQLite database inspected via PRAGMA table_info; each table becomes a `Db<TableName>` interface

## Output file conventions

- JSON Schema: interfaces use the schema `title` if present, otherwise the definition key
- OpenAPI: schemas section becomes interfaces; path parameter and query parameter types also generated
- SQLite: each table gets a `Db<PascalCase>` interface; columns map INTEGER -> number, TEXT -> string, REAL -> number, BLOB -> Buffer, NULL -> null

## Exit codes

| Code | Meaning |
|------|---------|
| 0 | All inputs generated or unchanged |
| 1 | One or more inputs failed |

## Environment variables

| Variable | Default | Description |
|----------|---------|-------------|
| S2T_PORT | 3500 | Web UI port |
| S2T_WATCH | 0 | Set to 1 to auto-start watch mode |
| S2T_WEB_ENABLED | 1 | Set to 0 to disable web dashboard |

## Web dashboard

Start with web UI:
```
s2t generate          # generates then exits
s2t serve             # starts web dashboard only (port 3500)
```

The web UI at http://localhost:3500 shows all inputs with status badges, output previews, diff views, and generation history.

## Common patterns

### CI - fail if types are out of date
```bash
s2t generate
git diff --exit-code src/types/
```

### After changing a schema file
```bash
s2t generate user-schema
# or let watch mode handle it automatically
```

### Inspect generated output
```bash
cat src/types/user.ts
# or view in web dashboard: http://localhost:3500
```

### View diff between last two runs
```bash
s2t diff user-schema
```

Related Skills

sql-schema-parser skill

7
from heldernoid/agentic-build-templates

## When to use

faker-schema skill

7
from heldernoid/agentic-build-templates

## When to use

manage-schemas

7
from heldernoid/agentic-build-templates

Create, update, and delete JSON Schema definitions in config-validator. Use when you need to add a new schema for a config file type, update a schema after adding required fields, list available schemas, or remove an obsolete schema. Triggers include "add schema", "create validation schema", "update schema", "list schemas", "delete schema", "manage validation rules", or any task involving the JSON Schema definitions used by config-validator.

Skill: Uptime Monitoring

7
from heldernoid/agentic-build-templates

## Overview

Skill: Status Page

7
from heldernoid/agentic-build-templates

## Overview

Skill: unit-conversion

7
from heldernoid/agentic-build-templates

## Overview

Skill: recipe-scaler

7
from heldernoid/agentic-build-templates

## Overview

reading-list

7
from heldernoid/agentic-build-templates

Operate the reading-list API to save, manage, tag, search, and export articles.

email-digest

7
from heldernoid/agentic-build-templates

Configure, test, and troubleshoot the reading-list daily email digest delivered via nodemailer.

websocket-realtime

7
from heldernoid/agentic-build-templates

Use the WebSocket connection in poll-builder to receive live vote updates. Use when you need to stream real-time poll results, monitor a poll for new votes, or build a live dashboard. Triggers include "live results", "real-time updates", "stream votes", "watch poll", or "WebSocket".

poll-builder

7
from heldernoid/agentic-build-templates

Self-hosted poll creation tool with real-time results. Use when you need to create a poll, check vote counts, close a poll, export results, or get the shareable link for a poll. Triggers include "create poll", "vote", "poll results", "survey", "collect votes", "share poll", or any task involving polling or voting.

Skill: personal-finance

7
from heldernoid/agentic-build-templates

## Overview