data-migration
Skill4 starsChanged 4 months agoMITView on GitHub
Changes a schema or moves data in production without downtime or loss — column changes, backfills, table splits, and system-to-system moves. Use this whenever the user is writing a migration, altering a table, backfilling data, renaming a column, or moving data between systems. Treat it as required reading before any migration runs against a database with real data. For designing the schema, use data-modeling.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- fmind/dottheir own version, first seen Oct 5, 2026
- muon-m2/magento2-toolstheir own version, first seen Oct 4, 2026
- philtzjp/skillstheir own version, first seen Sep 30, 2026
- Cure-Consulting-Group/ProductEngineeringSkillstheir own version, first seen Sep 28, 2026
- geoffsdesk/portagetheir own version, first seen May 8, 2026
- vigneshbarani24/sap-superpowerstheir own version, first seen Apr 22, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- korchard333/claude-power-platform-community★ 49same name
- fmind/dot★ 10same name
- vigneshbarani24/sap-superpowers★ 9same name
- muon-m2/magento2-tools★ 4same name
- Cure-Consulting-Group/ProductEngineeringSkills★ 3same name
- philtzjp/skills★ 2same name
- geoffsdesk/portage★ 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 repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-deploymentSkill
- agent-designSkill
- agent-evaluationSkill
- agent-hardeningSkill
- agent-implementationSkill
- agent-observabilitySkill
- agent-scopingSkill
- api-designSkill
- code-templatingSkill
- dependency-upgradeSkill
- error-handlingSkill
- feature-implementationSkill
- project-scaffoldingSkill
- refactoringSkill
- data-analysisSkill
- data-modelingSkill
- sql-queriesSkill
- ci-pipelinesSkill
- containerizationSkill
- deployment-strategiesSkill
- infrastructure-as-codeSkill
- debuggingSkill
- issue-investigationSkill
- issue-triageSkill
- log-analysisSkill
- network-troubleshootingSkill
- performance-profilingSkill
- api-documentationSkill
- commit-messagesSkill
- diagrammingSkill
- markdown-docsSkill
- plain-languageSkill
- pr-descriptionsSkill
- release-notesSkill
- browser-testingSkill
- integration-testingSkill
- load-testingSkill
- test-dataSkill
- test-driven-developmentSkill
- unit-testingSkill
- deep-researchSkill
- feed-digestSkill
- summarizationSkill
- accessibility-reviewSkill
- code-analysisSkill
- code-lintingSkill
- code-reviewSkill
- auth-designSkill
- dependency-auditSkill
- secrets-managementSkill
- security-analysisSkill
- threat-modelingSkill
- capacity-planningSkill
- disaster-recoverySkill
- incident-responseSkill
- monitoring-setupSkill
- root-cause-analysisSkill
- runbooksSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
7
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 17
If a migration has neither, it needs a maintenance window and a rehearsal.
- Distinctive: line 23
Add the new structure
- Distinctive: line 26
Remove the old structure — later, as its own change
- Distinctive: line 47
Done when: no single step breaks the currently running code.
- Distinctive: line 69
Never backfill inside the schema migration.
- Distinctive: line 72
Instead, a separate resumable script:
- Distinctive: line 83
Test against a restored production-sized copy, not a dev database with a hundred rows.
“Common” is measured: kept by at least 6 in 10 of the 6 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
Migrations are the most irreversible thing most engineers do routinely. Code can be rolled back; a dropped column cannot, and a botched backfill can corrupt data in ways no deploy fixes.
Two properties make a migration safe, and both must hold:
- Backwards compatible: the currently deployed code works before and after it runs
- Reversible, or backed up: you can get back, or you have a copy you have tested restoring
If a migration has neither, it needs a maintenance window and a rehearsal.
1. Never combine schema change with data change
Separate migrations, separate deploys:
- Add the new structure
- Backfill it
- Switch the code to use it
- Remove the old structure — later, as its own change
Combining these makes rollback impossible: reverting the code leaves the data half-moved, and reverting the data loses whatever the new code wrote.
Done when: each step is independently deployable and revertible.
2. Use expand-then-contract for anything breaking
Renaming a column is not a rename in production. It is:
- Expand — add
new_name, nullable - Dual-write — deploy code writing both; reads still use the old
- Backfill — populate
new_namefor existing rows, in batches - Switch reads — deploy code reading the new column
- Stop writing the old
- Contract — drop
old_name, well after everything is stable
Slow and boring, and it is the only way to do it without a window. Each step is individually safe to roll back.
Done when: no single step breaks the currently running code.
3. Know which operations take locks
The operation that takes an exclusive lock on a large table stops all writes for its duration. This is the most common cause of migration incidents, and the details are engine-specific — check yours.
Common traps in Postgres:
- Adding an index without
CONCURRENTLYblocks writes for the build - Adding a column with a volatile default rewrites the table on older versions
- Changing a column type usually rewrites
- Adding a foreign key takes a lock on both tables while validating — add
NOT VALID, then validate separately - A migration waiting behind a long transaction queues everything behind it, so a "fast" migration can still cause an outage
Done when: you know the lock each statement takes and how long it holds on production-sized data.
4. Backfill in batches, outside the migration
Never backfill inside the schema migration. It holds a transaction open for the whole run, and a failure halfway rolls back everything with no progress kept.
Instead, a separate resumable script:
- Batch: a few thousand rows at a time, with a pause between
- Idempotent: safe to re-run from any point. Track progress by key range, not by offset
- Throttled: watch replication lag and back off. Saturating the primary during a backfill is its own incident
- Observable: log progress so you know whether an eight-hour job is on track
Done when: the backfill can be stopped and resumed without losing work or double-applying.
5. Rehearse on real data volume
Test against a restored production-sized copy, not a dev database with a hundred rows. A migration that takes 40ms on 100 rows can take 40 minutes on 40 million, and duration is the whole question.
Measure the actual runtime, and confirm the rollback works — a down-migration that has never been run is a hope, not a plan.
Done when: you know the real duration and have executed the rollback once.
6. Have the plan written before you run it
- A tested backup, taken immediately before. Tested means you have restored from it
- The abort criteria: what you are watching, and at what value you stop
- The rollback, and explicitly what it does not undo
- Who is watching, and for how long after
- Timing: low traffic, and not before a weekend or a holiday
Done when: someone else could execute the plan from the document.
Moving between systems
For system-to-system moves, the same principles plus:
- Reconcile, do not assume. Row counts, checksums, and spot-checked records. "The job finished" is not verification
- Dual-write during transition, with the old system authoritative until reconciliation passes
- Keep the source read-only and intact until you are certain. The cheapest insurance available
- Handle the delta: records that change during the migration are where data is lost
Report
State what ran, how long it took, what you verified afterwards, and what is now irreversible. Explicitly list the temporary states left behind — dual-write code, unused old columns — with owners, or they become permanent.
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.

