review-migration
Skill26 starsChanged 4 months agoMITView on GitHub
Use when planning or reviewing a production Rails migration. Never mix schema change and backfill. Trigger words: migration, add column, index, backfill, zero-downtime.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- waqarqasim/portable-agent-skillstheir own version, first seen Oct 13, 2026
- OpenAEV-Platform/openaevtheir own version, first seen Oct 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- OpenAEV-Platform/openaev★ 1.8ksame name
- waqarqasim/portable-agent-skills★ 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 repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- apply-code-conventionsSkill
- apply-stack-conventionsSkill
- code-reviewSkill
- create-engine-installerSkill
- create-engineSkill
- document-engineSkill
- extract-engineSkill
- generate-api-collectionSkill
- implement-authorizationSkill
- implement-background-jobSkill
- implement-graphqlSkill
- implement-hotwireSkill
- load-contextSkill
- optimize-performanceSkill
- plan-testsSkill
- rails-featureSkill
- rails-maintenanceSkill
- rails-reviewSkill
- refactor-codeSkill
- release-engineSkill
- review-architectureSkill
- review-engineSkill
- security-checkSkill
- seed-databaseSkill
- setup-environmentSkill
- test-engineSkill
- test-serviceSkill
- upgrade-engineSkill
- version-apiSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Use this skill when schema changes must be safe in real environments.
- Distinctive: line 31
Check lock behavior for indexes, constraints, defaults, and rewrites.
- Very specific: line 35
If the project uses strong_migrations, follow it.
- Distinctive: line 95
Add new typed column as nullable.
- Distinctive: line 98
Read from new column after parity checks pass.
- Distinctive: line 99
Stop writing old column, then drop it in a later deploy.
- Distinctive: line 105
Ensure backwards compatibility steps are included.
- Very specific: line 106
Always include explicit phased patterns for column renames, type changes, and unique constraints.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Review Migration
Use this skill when schema changes must be safe in real environments.
HARD-GATE
DO NOT combine schema change and data backfill in one migration.
DO NOT add NOT NULL on a column that hasn't been fully backfilled.
DO NOT drop columns before all code references are removed.Core Process
- Identify the database and table-size risk.
- Separate schema changes from data backfills.
- Check lock behavior for indexes, constraints, defaults, and rewrites.
- Plan deployment order between app code and migration code.
- Plan rollback or forward-fix strategy.
If the project uses strong_migrations, follow it. If it does not, apply the same safety rules manually.
Safe Patterns and Common Mistakes
| Operation | Safe Pattern | Common Mistake | Why It Fails |
| Add column | Nullable first, backfill later, enforce NOT NULL last | add_column :t, :col, :string, null: false, default: "x" on large table | Table rewrite + lock (PG < 11) |
| Add index (large table) | algorithm: :concurrently (PG) / :inplace (MySQL) + disable_ddl_transaction! | add_index :users, :email without algorithm: :concurrently | Share lock blocks writes |
| Backfill data | Batch job outside migration transaction, throttle to reduce replication lag | User.update_all(...) inside migration | Transaction lock held for full duration |
| Rename column | Add new, copy data, migrate callers, drop old | Rename column directly | Breaks running app during deploy |
| Add NOT NULL | After backfill confirms all rows have values | Enforce NOT NULL before backfill completes | Fails or locks on rows missing values |
| Add foreign key | After cleaning orphaned records | Add FK without cleaning orphans | Constraint violation at migration time |
| Remove column | Remove code references first, deploy, then drop column | Drop column while code still reads it | unknown attribute errors at runtime |
For every step, state the expected lock or table-rewrite risk explicitly; if negligible, say why.
Deploy code that tolerates both old and new schemas during transitions.
Code Examples
Concurrent index (Rails / PostgreSQL):
class AddIndexOnUsersEmail < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
add_index :users, :email, algorithm: :concurrently
end
end
disable_ddl_transaction!is required — concurrent index creation cannot run inside a transaction.
Nullable-first column with deferred NOT NULL (Rails):
# Step 1 — Deploy: add nullable column
class AddConfirmedAtToUsers < ActiveRecord::Migration[7.1]
def change
add_column :users, :confirmed_at, :datetime
end
end
# Step 2 — Backfill outside migration (background job or script)
User.in_batches(of: 1_000) do |batch|
batch.update_all(confirmed_at: Time.current)
sleep(0.05) # throttle to reduce replication lag
end
# Step 3 — Deploy: enforce NOT NULL only after all rows are filled
class ChangeConfirmedAtNotNull < ActiveRecord::Migration[7.1]
def change
change_column_null :users, :confirmed_at, false
end
endType change rollout (5-step):
- Add new typed column as nullable.
- Dual-write old and new columns from application code.
- Backfill in batches outside the migration transaction.
- Read from new column after parity checks pass.
- Stop writing old column, then drop it in a later deploy.
Output Style
- List risks first.
- For each risk include: Migration step, likely failure mode, explicit lock/table-rewrite risk, safer rollout, rollback or forward-fix note.
- Ensure backwards compatibility steps are included.
- Always include explicit phased patterns for column renames, type changes, and unique constraints. If one does not apply, mark it
Not applicableand explain why. - Language — Must be in English unless explicitly requested otherwise.
Integration
| Skill | When to chain |
| code-review | When reviewing PRs that include migrations |
| implement-background-job | For backfill jobs that run after schema change |
| security-check | When migrations expose or move sensitive data |
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.

