1
    SQL Migration Safety Doctor

    SQL Migration Safety Doctor

    by JustHandled Labs

    Catch the dangerous migration before it locks or wrecks your production database. Scans SQL migration files for destructive and risky operations: DROP and TRUNCATE, drops without IF EXISTS, lossy column-type changes, NOT NULL added without a default, DELETE or UPDATE with no WHERE, non-concurrent index builds, dropped constraints, renames, and data backfills mixed into schema changes. Each finding is ranked by severity with a safer rewrite. Postgres, MySQL, and SQLite.

    Updated Jun 2026
    Security scanned
    Works with Claude Code

    $12

    · or 60 credits

    30-day refund guarantee

    Secure checkout via Stripe

    Included in download

    • Prevent production downtime caused by long-running table locks
    • Identify destructive DROP and TRUNCATE statements before execution
    • terminal, file_read automation included
    • Ready for Works with Claude Code
    • Instant install

    Sample input

    Check the new migration in migrations/20231024_add_user_index.sql for any safety issues.

    Sample output

    ⚠️ High Risk: Non-Concurrent Index

    • File: migrations/20231024_add_user_index.sql
    • Line: 4
    • Evidence: CREATE INDEX idx_user_email ON users(email);
    • Impact: Will lock the users table for writes.
    • Remediation: Use CREATE INDEX CONCURRENTLY in a separate transaction.

    About This Skill

    What it does

    The SQL Migration Safety Doctor is a specialized security and stability auditor for database migrations. It scans SQL files for destructive operations, heavy lock risks, and data integrity gaps before they ever hit your production environment. By identifying risky patterns like WHERE-less updates, lossy column changes, and non-concurrent index creation, it acts as a gatekeeper for your data layer.

    Why use this skill

    Prompting a generic AI for SQL reviews often misses subtle database-specific locking behaviors or platform-specific risks (like Postgres table locks). This skill uses a dedicated Python-based heuristic scanner combined with a rigorous audit checklist to provide evidence-based findings. It categorizes risks by severity—Critical to Info—and provides battle-tested remediation snippets to fix issues immediately.

    Supported tools and workflows

    • SQL Dialects: Optimized for Postgres, MySQL, and standard SQL patterns.
    • Framework Agnostic: Works with migrations from Rails, Django, Prisma, Flyway, Liquibase, or raw SQL files.
    • DevOps Integration: Ideal for pre-commit hooks or CI/CD pipeline simulations.

    Output format

    You receive a structured report detailing confirmed findings with file/line citations, a manual review checklist for complex logic, and specific SQL snippets to remediate the identified risks safely.

    ,sample_input:

    Use Cases

    • Prevent production downtime caused by long-running table locks
    • Identify destructive DROP and TRUNCATE statements before execution
    • Detect lossy column type changes that could lead to data corruption
    • Ensure all UPDATE and DELETE statements include safe WHERE clauses

    Reviews

    No reviews yet - be the first to share your experience.

    Only users who have downloaded or purchased this skill can leave a review.

    Security Scanned

    Passed automated security review

    Permissions

    Terminal / Shell
    Read Files

    File Scopes

    sql-migration-safety-doctor/**
    **/migrations/**/*.sql
    **/*.sql

    Read-only inspection first. The bundled scanner reads matching .sql files and prints markdown or JSON findings. It installs nothing, transmits nothing, modifies nothing, and never connects to a database. Any write, install, deploy, or live-account action requires explicit user confirmation.

    Works with Claude Code, Codex CLI, Cursor, OpenCode/OpenClaw, Gemini CLI, and other agents that load SKILL.md folders. The bundled scanner uses the Python 3 standard library only and degrades to manual checklist mode when Python or matching files are unavailable.

    Creator

    JustHandled Labs creates focused agent skills and workflow packs for Claude, Codex, Cursor, and AI-assisted builders. Each tool is designed around a real repeatable task: cleaner commits, better PRs, stronger handoffs, safer repo hygiene, clearer documentation, and less copy-paste chaos. The goal is not generic AI productivity. The goal is specific workflows that are easier to run, review, and repeat. Maintained by H.J. Westerfield, with a background in communications, editing, project coordination, customer support, and practical AI systems. JustHandled Labs builds tools for people who want useful automation without theatrical complexity.

    Frequently Asked Questions

    More Premium Skills

    $12