safe-migrate

Create and apply database migrations with automatic safety checks and backups.

Updated Jul 22, 2025
One-click install
npx skills add https://github.com/creepyblues/kstorybridge-integrated --skill safe-migrate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safe-migrate
Source: https://github.com/creepyblues/kstorybridge-integrated/tree/main/.claude/skills/safe-migrate
Command: npx skills add https://github.com/creepyblues/kstorybridge-integrated --skill safe-migrate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Safely creates and applies database migrations by automatically detecting destructive operations, generating backups, and producing rollback paths to prevent data loss. This ensures that schema changes are performed with guardrails and recoverability.

Core Features & Use Cases

  • Automatic safety checks: detect destructive operations and require backups before application.
  • Backup-first workflow: create table backups and rollback migrations to restore data integrity.
  • Rollback generation: automatically produce corresponding rollback SQL for each migration and guide testing in staging before production.
  • Use Case: When deploying a schema change like adding a column or altering a table, create a migration, analyze risks, backup affected data, apply safely, and have a rollback ready.

Quick Start

Create and run a safe migration from your project root using the safe-migrate workflow.

Frequently Asked Questions about safe-migrate

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

FAQPage Schema
How do I safely apply database migrations without losing data?

To safely apply database migrations, you need automatic safety checks that detect destructive operations and require backups before application. This ensures schema changes are performed with guardrails and recoverability to prevent data loss.

How do database rollbacks work when a migration fails?

Database rollbacks work by automatically producing corresponding rollback SQL for each migration and restoring data from generated backups. This creates a recovery path to restore data integrity if a schema change fails in staging or production.

What is a backup-first workflow for database schema changes?

A backup-first workflow for database schema changes creates table backups before applying any migrations. This approach enforces mandatory safety rules and produces a rollback path to guarantee data integrity during destructive operations.

What's the best way to test destructive SQL migrations before production?

The best way to test destructive SQL migrations before production is to analyze risks, backup affected data, apply safely to staging, and have a rollback ready. This workflow detects destructive operations and guides testing in staging before production deployment.

Can I generate rollback SQL automatically for my database migrations?

Yes, you can generate rollback SQL automatically for database migrations. The system produces corresponding rollback migrations for each schema change and records backups to restore data integrity if the deployment needs to be reversed.