Skip to main content
command

supabase-schema-sync — Claude Code command: what it does

Synchronizes local database files with a remote Supabase project via MCP. It detects structural differences and generates migration scripts.

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

What supabase-schema-sync does

The command inspects local database definitions and compares them against your Supabase project. It automatically scans local schema.sql files, the migrations directory, configuration files, and uncommitted Git changes in .sql or .ts files. Passing specific flags lets you pull changes, push updates, compare schemas, or run integrity checks.

You need a configured Supabase MCP server. During validation, the command reviews foreign key constraints, checks for breaking changes, and generates rollback procedures. It also supports a dry-run mode before alterations touch your database.

What it helps with

  • compare local SQL files against a remote Supabase instance
  • generate database migration scripts with rollback procedures
  • validate foreign key constraints and query compatibility
  • pull remote schema updates into the local project directory

Example prompts for the agent

  • Run /supabase-schema-sync --diff to inspect schema differences.
  • Execute /supabase-schema-sync --validate before modifying the database.
  • Use /supabase-schema-sync --pull to download the latest schema.

How to install supabase-schema-sync

1claude-code-templates

npx claude-code-templates@latest --command database/supabase-schema-sync

2Manually: put the files in place

.claude/commands/supabase-schema-sync.md

Call it with /supabase-schema-sync. For all projects use ~/.claude/commands/

Questions about supabase-schema-sync

How to install supabase-schema-sync in Claude Code?

Run npx claude-code-templates@latest --command database/supabase-schema-sync or save the template file to .claude/commands/supabase-schema-sync.md.

What does supabase-schema-sync do?

It connects to Supabase via an MCP server to detect differences between local files and remote tables, then prepares migrations.

What arguments can you pass to the command?

You can use --pull, --push, --diff, or --validate to select the synchronization step you want to perform.

Source text

supabase-schema-sync.md · MIT
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: "[action] | --pull | --push | --diff | --validate"
description: Synchronize database schema with Supabase using MCP integration
---

# Supabase Schema Sync

Synchronize database schema between local and Supabase with comprehensive validation: **$ARGUMENTS**

## Current Supabase Context

- MCP connection: Supabase MCP server with read-only access configured
- Local schema: !`find . -name "schema.sql" -o -name "migrations" -type d | head -3` local database files
- Project config: !`find . -name "supabase" -type d -o -name ".env*" | grep -v node_modules | head -3` configuration files
- Git status: !`git status --porcelain | grep -E "\\.sql$|\\.ts$" | head -5` database-related changes

## Task

Execute comprehensive schema synchronization with Supabase integration:

**Sync Action**: Use $ARGUMENTS to specify pull from remote, push to remote, diff comparison, or schema validation

**Schema Synchronization Framework**:
1. **MCP Integration** - Connect to Supabase via MCP server, authenticate with project credentials, validate connection status
2. **Schema Analysis** - Compare local vs remote schema, identify structural differences, analyze migration requirements, assess breaking changes
3. **Sync Operations** - Execute pull/push operations, apply schema migrations, handle conflict resolution, validate data integrity
4. **Validation Process** - Verify schema consistency, validate foreign key constraints, check index performance, test query compatibility
5. **Migration Management** - Generate migration scripts, track version history, implement rollback procedures, optimize execution order
6. **Safety Checks** - Backup critical data, validate permissions, check production impact, implement dry-run mode

**Advanced Features**: Automated conflict resolution, schema version control, performance impact analysis, team collaboration workflows, CI/CD integration.

**Quality Assurance**: Schema validation, data integrity checks, performance optimization, rollback readiness, team synchronization.

**Output**: Complete schema sync with validation reports, migration scripts, conflict resolution, and team collaboration updates.

© 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