data-migration
Skill24 starsChanged 24 days agoMITView on GitHub
Hard gate before any database schema change or data transformation in production. Requires a written migration plan with rollback strategy, dry run, and verification steps before execution. Prevents data loss, downtime, and irreversible schema changes.
- Deletes or force-pushes
9 other projects use a version of this.
Adopted by
Most recently taken up by
- Cure-Consulting-Group/ProductEngineeringSkillstheir own version, first seen Nov 4, 2026
- philtzjp/skillstheir own version, first seen Oct 28, 2026
- muon-m2/magento2-toolstheir own version, first seen Oct 13, 2026
- tejastn10/workbenchtheir own version, first seen Oct 13, 2026
- shaheershoaib/data-migrationtheir own version, first seen Sep 5, 2026
- Abdox-menara/guard-skillstheir own version, first seen Aug 24, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- korchard333/claude-power-platform-community★ 46same name
- muon-m2/magento2-tools★ 6same name
- Cure-Consulting-Group/ProductEngineeringSkills★ 3same name
- philtzjp/skills★ 2same name
- tejastn10/workbench★ 1same name
- Abdox-menara/guard-skills★ 0same name
- geoffsdesk/portage★ 0same name
- Jinbae10/skills★ 0same name
- shaheershoaib/data-migration★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/rules/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-contract-firstSkill
- architecture-auditSkill
- brainstormingSkill
- dispatching-parallel-agentsSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- five-whysSkill
- incident-responseSkill
- performance-auditSkill
- skill-duplication-auditSkill
- smart-initSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- using-a-teamSkill
- using-git-worktreesSkill
- verification-before-completionSkill
- writing-plansSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Use this skill before:
- Distinctive: line 129
Before executing in production:
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Data Migration
The Law
EVERY MIGRATION NEEDS A ROLLBACK.
A migration without a rollback plan is a one-way door.
Before you open it, know how to close it.When to Use
Use this skill before:
- Any
ALTER TABLEin production - Any column rename, type change, or removal
- Any large
UPDATEorDELETE(more than 1000 rows) - Any index creation on a large table
- Any data backfill or transformation script
The Migration Process
Step 1: Classify the Migration
| Type | Risk | Strategy |
| Additive (new table, new nullable column) | Low | Single deploy |
| Non-breaking change (add index, add constraint) | Low–Medium | Verify impact first |
| Column rename or type change | High | Multi-phase deploy |
| Column or table removal | High | Multi-phase deploy |
| Large data backfill (>100k rows) | Medium | Batched, off-peak |
| Destructive (DROP TABLE, DELETE) | Critical | Backup + explicit approval |
Step 2: Write the Migration Plan
Save to docs/migrations/YYYY-MM-DD-description.md:
# Migration: [Title]
## Summary
[What changes and why]
## Risk Level
[Low / Medium / High / Critical]
## Migration Steps
### UP (apply)
\```sql
-- Step 1: Add new column (nullable — safe, no lock)
ALTER TABLE orders ADD COLUMN discount_amount NUMERIC(10,2);
-- Step 2: Backfill (batched — see script)
-- Run: scripts/migrations/backfill-discount.sql
-- Step 3: Add NOT NULL constraint after backfill
ALTER TABLE orders ALTER COLUMN discount_amount SET NOT NULL;
\```
### DOWN (rollback)
\```sql
ALTER TABLE orders DROP COLUMN IF EXISTS discount_amount;
\```
## Rollback Plan
[How to revert if something goes wrong — step by step]
## Estimated Duration
[How long will the migration take? Any locking risk?]
## Verification
- [ ] Row count before: SELECT COUNT(*) FROM orders;
- [ ] Row count after matches
- [ ] Sample rows spot-checked: SELECT * FROM orders LIMIT 10;
- [ ] Application queries tested against migrated schema
- [ ] No errors in application logs after deployStep 3: Zero-Downtime Patterns
Column rename — never rename directly; multi-phase:
Phase 1: Add new column (old and new both exist)
Phase 2: Deploy app that writes to BOTH columns, reads from old
Phase 3: Backfill new column from old
Phase 4: Deploy app that writes to BOTH, reads from new
Phase 5: Drop old columnType change — same multi-phase approach; never ALTER COLUMN TYPE on large tables in production directly.
Index creation on large table — always CREATE INDEX CONCURRENTLY:
-- [INVALID] — takes full table lock
CREATE INDEX idx_orders_user ON orders(user_id);
-- [VALID] — non-blocking on PostgreSQL
CREATE INDEX CONCURRENTLY idx_orders_user ON orders(user_id);Large backfill — never in one transaction; batch it:
-- Process in batches of 1000 rows until done
DO $$
DECLARE
batch_size INT := 1000;
rows_updated INT;
BEGIN
LOOP
UPDATE orders
SET discount_amount = 0
WHERE discount_amount IS NULL
LIMIT batch_size;
GET DIAGNOSTICS rows_updated = ROW_COUNT;
EXIT WHEN rows_updated = 0;
PERFORM pg_sleep(0.1); -- yield between batches
END LOOP;
END $$;Step 4: Pre-Migration Checklist
Before executing in production:
- Migration tested in staging with production-sized dataset
- DOWN migration tested — rollback actually works
- Row counts recorded (before state documented)
- Backup taken or verified recent backup exists
- Maintenance window announced if locking is expected
- Application can tolerate both old and new schema simultaneously (for multi-phase migrations)
- Monitoring alerts active during migration
Step 5: Execute
# Dry run first (PostgreSQL)
psql $DATABASE_URL --dry-run -f migration.sql
# Real run with timing
psql $DATABASE_URL -f migration.sql --echo-all
# Check for locks during execution
SELECT pid, query, state, wait_event_type, wait_event
FROM pg_stat_activity
WHERE state != 'idle';Step 6: Verify
-- Row count matches expectations
SELECT COUNT(*) FROM affected_table;
-- Sample spot-check
SELECT * FROM affected_table LIMIT 20;
-- No NULL where NOT NULL expected
SELECT COUNT(*) FROM affected_table WHERE new_column IS NULL;
-- No application errors in logs for 10 minutes post-migrationRollback Decision Tree
Migration complete?
└── No errors in monitoring for 10 minutes? → DONE
└── Errors found?
├── Can app tolerate the error state? → Fix forward (hotfix)
└── Cannot tolerate? → ROLLBACK IMMEDIATELY
├── Run DOWN migration
├── Verify application recovers
└── Document in post-mortemHard Rules
- Never DROP a column in the same deploy as the last code that reads it — always separate by at least one deploy
- Never run destructive migrations (DROP TABLE, DELETE) without an explicit human approval step — not just a code review
- Never skip the DOWN migration — "we can recreate it" is not a rollback strategy
- Never migrate in peak traffic hours — schedule for the lowest-traffic window
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

