type-watch
Watch schema files for changes and automatically regenerate TypeScript types on save
Best use case
type-watch is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Watch schema files for changes and automatically regenerate TypeScript types on save
Teams using type-watch 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/type-watch/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How type-watch Compares
| Feature / Agent | type-watch | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Watch schema files for changes and automatically regenerate TypeScript types on save
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
# type-watch
Use this skill to keep generated TypeScript types in sync with schema files during development using watch mode.
## Starting watch mode
```
s2t watch
```
Watches all source files listed in s2t.yaml. Regenerates the corresponding output when any source changes. Press Ctrl+C to stop.
### Watch specific inputs only
```
s2t watch user-schema app-db
```
### Watch with web dashboard disabled
```
s2t watch --no-web
```
## How watch mode works
1. s2t reads s2t.yaml and resolves all source file paths
2. chokidar watches each source file for change events
3. When a change is detected, s2t debounces for 200ms (waits for burst saves to settle)
4. s2t runs the generator for that input only
5. If the output is identical to the previous run, status is "unchanged" and no file is written
6. SSE event is pushed to the web dashboard showing the result
## Output format during watch
```
[15:52:00.001] watching 3 inputs for changes...
[15:52:14.200] change detected: schemas/user.json
[15:52:14.400] generating user-schema...
[15:52:14.423] user-schema -> src/types/user.ts (23ms) +3 lines
```
- Timestamps are local time
- Duration shown in milliseconds
- Line delta shown as "+N lines" or "-N lines" or "unchanged"
## Auto-watch on start
Set the environment variable to always start watch mode:
```bash
S2T_WATCH=1 s2t
```
Or set in your shell profile/dotenv for the project.
## Web dashboard in watch mode
When watching, the web UI at http://localhost:3500 shows:
- A pulsing green "watching" badge in the header
- Live event feed with change detections and generation results
- Input rows update in real time (status badge flickers to "generating" then resolves)
- A "Stop watch" button to exit watch mode from the browser
## Integration with editors
Watch mode plays well with any editor that saves files on change. No editor plugin needed.
### VS Code - save on focus loss
In `.vscode/settings.json`:
```json
{
"files.autoSave": "onFocusChange"
}
```
### Shell alias for development
```bash
alias dev="pnpm dev & s2t watch"
```
## Debounce behavior
The 200ms debounce means:
- If a schema file is saved multiple times in rapid succession (e.g. format-on-save + your edit), only one generation run fires
- Each distinct source file triggers its own independent debounce timer
## Handling errors in watch mode
If generation fails for an input, s2t:
1. Prints the error to stdout with full detail
2. Updates the input's status to "error" in the web dashboard
3. Continues watching - the next save will retry automatically
Watch mode never exits on error. Fix the schema and save to trigger a retry.
## Stopping watch mode
- Keyboard: Ctrl+C
- Web UI: click "Stop watch" button
- Signal: SIGTERM or SIGINT
On stop, s2t writes a summary line:
```
watch stopped - 14 changes detected, 12 generated, 2 unchanged
```Related Skills
Skill: Uptime Monitoring
## Overview
Skill: Status Page
## Overview
Skill: unit-conversion
## Overview
Skill: recipe-scaler
## Overview
reading-list
Operate the reading-list API to save, manage, tag, search, and export articles.
email-digest
Configure, test, and troubleshoot the reading-list daily email digest delivered via nodemailer.
websocket-realtime
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
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
## Overview
Skill: csv-import
## Overview
Skill: Syntax Highlighting
## Purpose
Skill: Pastebin Core
## Purpose