Automated Database Migration Safety Review for Claude Code
You get a structured risk assessment of your SQL migration scripts to prevent production downtime, data loss, and long-running table locks.
Agent prompt for Claude
Prompt
mkdir -p .agents/skills/automated-database-migration-safety-review-for-claude-code && curl -sL "https://prompts-gpt.com/prompts/automated-database-migration-safety-review-for-claude-code/raw" -o .agents/skills/automated-database-migration-safety-review-for-claude-code/SKILL.md---
name: automated-database-migration-safety-review-for-claude-code
description: "You get a structured risk assessment of your SQL migration scripts to prevent production downtime, data loss, and long-running table locks."
---
# Automated Database Migration Safety Review for Claude Code
You get a structured risk assessment of your SQL migration scripts to prevent production downtime, data loss, and long-running table locks.
## Prompt
```
Act as a Senior Database Reliability Engineer. Your job is to review a provided SQL migration script for production safety before execution. Before analyzing, ask these 3 questions: 1. Which database engine (e.g., PostgreSQL, MySQL 8.0) are you using? 2. What is the approximate record count of the target table? 3. Is the migration intended for a zero-downtime deployment? After the user answers, provide a risk assessment. Rules: 1. Identify specific commands that trigger table locks or full table rewrites. 2. Flag missing backward compatibility for existing application code. 3. Suggest batch sizes for data backfills to avoid transaction log exhaustion. 4. Propose a rollback strategy for each change. Output format: ## Migration Risk Assessment | Risk Level | SQL Statement | Potential Impact | Mitigation Strategy | ## Critical Hazards | Bulleted list of locking risks ## Rollback Plan | Step-by-step recovery commands. This is not professional database administration advice; consult your lead DBA or infrastructure architect before running destructive migrations on production systems.
```
## Usage Notes
Use this in Claude Code or the Claude web interface when preparing database migrations. Paste your raw SQL script immediately after the prompt sends its questions. It works best for SQL files targeting production environments where downtime is unacceptable.
Act as a Senior Database Reliability Engineer. Your job is to review a provided SQL migration script for production safety before execution. Before analyzing, ask these 3 questions: 1. Which database engine (e.g., PostgreSQL, MySQL 8.0) are you using? 2. What is the approximate record count of the target table? 3. Is the migration intended for a zero-downtime deployment? After the user answers, provide a risk assessment. Rules: 1. Identify specific commands that trigger table locks or full table rewrites. 2. Flag missing backward compatibility for existing application code. 3. Suggest batch sizes for data backfills to avoid transaction log exhaustion. 4. Propose a rollback strategy for each change. Output format: ## Migration Risk Assessment | Risk Level | SQL Statement | Potential Impact | Mitigation Strategy | ## Critical Hazards | Bulleted list of locking risks ## Rollback Plan | Step-by-step recovery commands. This is not professional database administration advice; consult your lead DBA or infrastructure architect before running destructive migrations on production systems.Example output
Tips and common edits
Why this works
- Forces a risk-first perspective by requiring engine and scale context.
- Categorizes findings into actionable tables and clear hazard lists.
- Mandates a rollback strategy to ensure recovery paths exist before execution.
Use this in Claude Code or the Claude web interface when preparing database migrations. Paste your raw SQL script immediately after the prompt sends its questions. It works best for SQL files targeting production environments where downtime is unacceptable.
Common edits
- Adjust the batch size recommendations if your specific database has tight transaction log limits.
- Add specific compliance checks if your organization requires audit logging for all schema changes.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Plan Zero-Downtime Database Migration and Backfill
Get a step-by-step technical plan for migrating database schemas without downtime, including data backfill logic and verification steps.
Debug SQL query errors and incorrect row counts
Find syntax errors, incorrect joins, and silent null filter bugs in database queries. Use it when a query returns syntax errors or unexpected row counts.
Design Cursor-Based Pagination Logic for High-Volume APIs
Get a complete implementation plan for cursor-based pagination including SQL queries, cursor encoding logic, and strategies for handling record deletions.
Find and Fix Data Quality Issues with Ready-to-Run SQL Checks
Paste your schema and get SQL queries that catch duplicates, NULLs, orphaned foreign keys and out-of-range values, each with what a bad result means and a fix.
Design a clean rollback plan for risky launches
Establish unambiguous abort triggers, rollback sequences, and data safeguards before shipping. Designed for engineering managers and product leads.
Audit Error Boundaries and Telemetry Coverage in Code
This prompt audits your codebase for missing error boundaries, unhandled promise rejections, and incomplete telemetry traces to ensure production stability.
- Create Automated Verification Loops for Long-Running Coding Agents
- Create MCP Tool Configuration for Claude Code
- Create Selective Pre-Commit Hooks for Claude Code
- Draft Reproducible Bug Reports from Error Stack Traces
- Generate Database Migration and Rollback Specs for Coding Agents
- Triage Dead-Letter Queue Logs for Failed AI Agents