db-snapshot

Creates schema-only PostgreSQL snapshots with pg_dump for migration rollback.

3|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/gabrielnsmnto/kord-aios --skill db-snapshot-gabrielnsmnto
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: db-snapshot
Source: https://github.com/gabrielnsmnto/kord-aios/tree/main/src/features/builtin-skills/kord-aios/database/db-snapshot
Command: npx skills add https://github.com/gabrielnsmnto/kord-aios --skill db-snapshot-gabrielnsmnto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Database schema changes and migrations carry the risk of irreversible damage, and without a captured baseline there is no reliable way to roll back to a known-good state. ## Core Features & Use Cases - Schema-Only Snapshots: Generates timestamped SQL snapshots using pg_dump with --schema-only, --clean, and --if-exists flags for safe, fast rollback points. - Snapshot Metadata & Verification: Writes a companion .meta file recording label, timestamp, size, and restore instructions, and verifies the snapshot contains tables, functions, and policies. - Retention & Comparison Workflows: Supports snapshot naming conventions, retention cleanup, diffing two snapshots, and pre/post-migration capture. - Use Case: Before applying a migration that adds a user_roles table to a Supabase database, create a labeled pre_migration snapshot so you can restore the exact schema if the migration fails. ## Quick Start Ask the agent to create a database snapshot labeled pre_migration before applying your next schema change.

Frequently Asked Questions about db-snapshot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a PostgreSQL schema snapshot with pg_dump?▼

Run pg_dump with the --schema-only, --clean, --if-exists, --no-owner, and --no-privileges flags against your database URL, redirecting output to a timestamped .sql file. This captures tables, functions, and policies without data for fast rollback.

How do I roll back a database migration in Supabase?▼

Create a schema-only snapshot before applying the migration, then restore it with psql using the snapshot file if the migration fails. The snapshot includes DROP statements via --clean and --if-exists so it can be applied over the changed schema.

What is the difference between a pg_dump snapshot and a Supabase backup?▼

A pg_dump snapshot is a fast, schema-only SQL file stored locally and friendly to Git version control, while Supabase backups are managed full-database copies restored through the dashboard. Use snapshots for migration rollback and schema versioning, and Supabase backups for disaster recovery.

Why does pg_dump fail with a connection error?▼

Connection failures usually mean the SUPABASE_DB_URL environment variable is missing, incorrect, or the network is unreachable. Verify the connection string and credentials, then retry; the workflow retries with exponential backoff up to three attempts.

Should I commit database snapshots to Git?▼

Schema-only snapshots can be versioned in Git to track schema history, but avoid committing snapshots that include data, passwords, or connection strings. In public repositories, consider gitignoring snapshots or sanitizing them first since schema names can reveal business logic.