Detect dangerous operations in database migrations before deployment
You are the db-migration-check skill. When invoked, you analyze database migration files to detect dangerous operations that could cause downtime, data loss, or performance issues.
Invoke this skill when:
Do NOT invoke when:
When invoked:
Use the Bash tool to run the pre-built migration check script:
python3 .claude/skills/db-migration-check/check.py
This script will:
bazinga/artifacts/{SESSION_ID}/skills/db_migration_check.jsonUse the Read tool to read:
bazinga/artifacts/{SESSION_ID}/skills/db_migration_check.json
Extract key information:
status - dangerous_operations_detected/safe/errordangerous_operations - Array of blocking issueswarnings - Medium-risk operationssafe_migrations - Approved operationsrecommendations - Safe alternativesReturn a concise summary to the calling agent:
Database Migration Check:
- Database: {database_type}
- Framework: {framework}
- Migrations analyzed: {count}
ā ļø DANGEROUS OPERATIONS: {count}
- CRITICAL ({count}): {list}
- HIGH ({count}): {list}
Safe migrations: {count}
Top recommendations:
1. {recommendation}
2. {recommendation}
Details saved to: bazinga/artifacts/{SESSION_ID}/skills/db_migration_check.json
Scenario: Dangerous Migration Detected
Input: Tech Lead reviewing migration adding indexed column with default
Expected output:
Database Migration Check:
- Database: postgresql
- Framework: alembic
- Migrations analyzed: 3
ā ļø DANGEROUS OPERATIONS: 2
- CRITICAL (1): ADD COLUMN with DEFAULT locks table (migration_001.py:15)
- HIGH (1): CREATE INDEX without CONCURRENTLY blocks writes (migration_002.py:23)
Safe migrations: 1
Top recommendations:
1. For ADD COLUMN: Add as NULL first, backfill in batches, then add DEFAULT
2. For CREATE INDEX: Use CREATE INDEX CONCURRENTLY to avoid locks
Details saved to: bazinga/artifacts/{SESSION_ID}/skills/db_migration_check.json
Scenario: All Migrations Safe
Input: Tech Lead reviewing well-written migrations
Expected output:
Database Migration Check:
- Database: postgresql
- Framework: django
- Migrations analyzed: 2
ā
No dangerous operations detected
Safe migrations: 2
- migration_001.py: ADD COLUMN (nullable, no default)
- migration_002.py: CREATE INDEX CONCURRENTLY
All migrations follow zero-downtime best practices.
Details saved to: bazinga/artifacts/{SESSION_ID}/skills/db_migration_check.json
If no migrations found:
If database type unknown:
If migration files unreadable: