Skip to main content
command

supabase-type-generator — Claude Code command: TypeScript types

A slash command that turns your Supabase schema into TypeScript types and keeps them in sync. Useful when the database moves ahead of the types in your project.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command database/supabase-type-generator
Open on GitHub

What supabase-type-generator does

The command reads your database schema through the Supabase MCP integration, maps table structures and relationships, and writes TypeScript interfaces from them. It also produces utility types and type guards, wires up import paths and type exports so editor autocompletion picks the definitions up on its own.

Scope comes from the argument: every table, one named table, function signatures, enum definitions, or view types. The frontmatter lists allowed-tools as Read, Write, Edit, Bash, which is how it inspects project files, writes new ones and runs a build to confirm nothing broke.

Your schema has to be reachable through the Supabase MCP integration, otherwise there is nothing to read. After generation the command checks the types against your application and flags breaking changes when the schema shifts.

What it helps with

  • generate TypeScript types from Supabase tables
  • refresh types after a schema migration
  • pull function signatures and enum definitions into TypeScript
  • catch a schema change that would break the build
  • set up type exports and editor autocompletion

Example prompts for the agent

  • Generate TypeScript types from the Supabase schema for all tables
  • Regenerate types for the orders table only
  • Generate types for Supabase functions and enums

How to install supabase-type-generator

1claude-code-templates

npx claude-code-templates@latest --command database/supabase-type-generator

2Manually: put the files in place

.claude/commands/supabase-type-generator.md

Call it with /supabase-type-generator. For all projects use ~/.claude/commands/

Questions about supabase-type-generator

How do I install supabase-type-generator in Claude Code?

Run npx claude-code-templates@latest --command database/supabase-type-generator, then the file .claude/commands/supabase-type-generator.md lands in your project and the command is ready.

What does supabase-type-generator do?

It generates TypeScript types from a Supabase schema: table interfaces, utility types, type guards, function signatures and enums. It then validates compatibility with your app and watches for schema changes.

What does the command need to run?

Access to the database schema through the Supabase MCP integration, since that is where the table structures and relationships come from.

Source text

supabase-type-generator.md · MIT
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: "[generation-scope] | --all-tables | --specific-table | --functions | --enums | --views"
description: Generate TypeScript types from Supabase schema with automatic synchronization and validation
---

# Supabase Type Generator

Generate comprehensive TypeScript types from Supabase schema with automatic synchronization: **$ARGUMENTS**

## Current Type Context

- Supabase schema: Database schema accessible via MCP integration
- Type definitions: !`find . -name "types" -type d -o -name "*.d.ts" | head -5` existing TypeScript definitions
- Application usage: !`find . -name "*.ts" -o -name "*.tsx" | xargs grep -l "Database\|Table\|Row" 2>/dev/null | head -3` type usage patterns
- Build configuration: !`find . -name "tsconfig.json" -o -name "*.config.ts" | head -3` TypeScript setup

## Task

Execute comprehensive type generation with schema synchronization and application integration:

**Generation Scope**: Use $ARGUMENTS to generate all table types, specific table types, function signatures, enum definitions, or view types

**Type Generation Framework**:
1. **Schema Analysis** - Extract database schema via MCP, analyze table structures, identify relationships, map data types to TypeScript
2. **Type Generation** - Generate table interfaces, create utility types, implement type guards, optimize type definitions
3. **Integration Setup** - Configure import paths, setup type exports, implement auto-completion, integrate with build process
4. **Validation Process** - Validate generated types, test type compatibility, verify application integration, check build success
5. **Synchronization** - Monitor schema changes, auto-regenerate types, validate breaking changes, notify development team
6. **Developer Experience** - Implement IDE integration, provide type hints, create usage examples, optimize development workflow

**Advanced Features**: Automatic type updates, breaking change detection, custom type transformations, documentation generation, IDE plugin integration.

**Quality Assurance**: Type accuracy validation, application compatibility testing, performance impact assessment, developer feedback integration.

**Output**: Complete TypeScript type definitions with schema synchronization, application integration, validation procedures, and developer documentation.

© davila7 · MIT · davila7/claude-code-templates

Similar slash commands

All slash commands for Data and databases →

From the same set205

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor