generate-types-from-supabase — Claude Code command: types from DB
generate-types-from-supabase analyzes Supabase schema and generates TypeScript types for DTOs and Command Models. Cuts down manual type definition work by deriving structures from your database.
AGPL-3.0 ★ 267 updated 2026-02-20
.claude/commands/generate-types-from-supabase.mdWhat generate-types-from-supabase does
The command reads your database model definitions and produces typed Data Transfer Objects and command structures. It examines entity schemas, isolates relevant fields, applies TypeScript transformations (Pick, Omit, Partial), and binds each DTO back to the original table definition.
Works in steps: studies model structure, builds DTOs with correct types, validates connections between commands and entities. Output goes to src/types.ts ready to use.
Requires the database schema to be available as @database.types.ts. Keeps types in sync with Supabase changes and enforces strict typing across your API layer.
What it helps with
- Generate DTO types matching Supabase table schemas
- Create Command Models tied to database entities
- Prevent drift between type definitions and actual data structures
- Apply type transformations for Create, Update, and Read operations
Example prompts for the agent
- Generate DTOs for all tables from the database schema
- Create Create and Update Command Models from entity definitions
- Analyze
@database.types.tsand write types tosrc/types.ts
How to install generate-types-from-supabase
Manually: put the files in place
.claude/commands/generate-types-from-supabase.mdCall it with /generate-types-from-supabase. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/generate-types-from-supabase.mdCall it with /prompts:generate-types-from-supabase. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/generate-types-from-supabase.prompt.mdManually: put the files in place
.gemini/commands/generate-types-from-supabase.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about generate-types-from-supabase
How do I install generate-types-from-supabase in Claude Code?
Copy .claude/commands/generate-types-from-supabase.md to your project's .claude/commands/ directory. The command becomes available in Claude Code immediately after.
What does generate-types-from-supabase do?
Reads Supabase type definitions, extracts fields for DTOs, and builds typed command models that reference source entities through TypeScript type utilities.
What do I need for the command to work?
Database schema must be accessible as @database.types.ts. You need TypeScript familiarity and understanding of your Supabase table structure.