Enforce a Migration Checklist on Every PR
Build a repo skill that makes Devin catch destructive operations, verify rollback safety, and validate schema changes whenever a PR touches database migrations.Create the migration checklist skill
A repository skill is a markdown file you commit to Once this file is committed, Devin sees it as an available skill. Whenever a session touches migration files in this repo, Devin can trigger the checklist automatically — or you can invoke it manually at any point.
.agents/skills/<your-skill>/ in any of your repos. Devin sees all skills across all connected repositories — you can trigger them manually or Devin can choose to trigger them automatically when it detects a relevant situation. This skill tells Devin exactly how to review database migrations before opening or updating a PR — catching the mistakes that code review usually misses.Commit .agents/skills/migration-checklist/migration-checklist.md to your repository:See the skill trigger on a real migration
When Devin works on a task that adds or modifies a migration file, it reads the diff, matches the migration checklist skill, and follows the checklist before opening the PR. Here’s what that looks like in practice:
- Scans the diff — Devin sees a new file in
db/migrate/and activates the migration checklist skill - Flags a destructive operation — The migration removes a
legacy_emailcolumn. Devin adds a PR comment:remove_column :users, :legacy_emailis a destructive operation. Verified: migration includes a data backup step copying values touser_archivesbefore removal. - Adds a missing index — The migration adds
account_idto theinvoicestable but has no index. Devin appendsadd_index :invoices, :account_idto the migration file - Runs rollback — Devin executes
bin/rails db:migrate:rollback STEP=1against the test database. It passes - Regenerates the schema — Devin runs
bin/rails db:schema:dump, detects a diff indb/schema.rb, and includes the updated file in the commit - Runs model tests — All model tests pass. Devin opens the PR with a summary of each check
Adapt the skill for your ORM and stack
The checklist above targets Rails, but the same structure works for any ORM. Ask Devin to rewrite the skill for your stack:
Extend the checklist over time
Every migration incident reveals a gap the checklist didn’t cover. After each one, add a rule — it’s a one-line commit to the skill file.Here are common additions teams make after real incidents:Because the skill file lives in your repo, these rules go through code review — your entire team agrees on what gets checked, and it’s always in sync with your migration tooling.
