Agent skill
migration
Create reversible database migrations with rollback scripts. Use when modifying database schemas.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/migration
SKILL.md
Migration Skill
Purpose
Create safe, reversible database migrations.
Migration Template
Use: templates/migration-template.sql
-- Migration: [description]
-- Created: [date]
-- Author: [name]
-- ==================== UP ====================
BEGIN;
-- Your migration here
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(255) NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT NOW()
);
COMMIT;
-- ==================== DOWN ====================
BEGIN;
DROP TABLE IF EXISTS users;
COMMIT;
Pre-Migration Checklist
Use: checklists/pre-migration.md
- Down migration works
- Tested on production-like data
- Performance impact assessed
- Backup plan documented
- Deployment timing considered
Migration Types
Safe Migrations
- Add table
- Add nullable column
- Add index (CONCURRENTLY)
- Add foreign key (without validation)
Risky Migrations
- Drop table (verify no references)
- Drop column (verify no usage)
- Rename column (may break app)
- Change column type (may lose data)
Dangerous Migrations
- Truncate table
- Drop database
- Remove constraints
Large Table Migrations
For tables with >1M rows:
- Create new structure
- Backfill in batches
- Add constraints
- Switch over
- Clean up old structure
Rollback Strategy
- Test down migration before running up
- Document manual rollback steps
- Have production backup
- Consider feature flags for code changes
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?