Migration Specialist agent
The Migration Specialist agent writes migrations, codemods and upgrade steps with rollback notes. It runs in Dependency Refresh and Data Migration.
The Migration Specialist agent moves code and data from one shape to another. It authors database migrations, codemods for large mechanical code changes, and step-by-step upgrade instructions, each with notes on how to roll back.
Where it runs
| Workflow | Step |
|---|---|
| Dependency Refresh | Upgrade |
| Data Migration | Migration |
In Dependency Refresh it turns the Dependency Auditor's findings into an upgrade. In Data Migration it writes the migration for the schema the Database Engineer designed, before the Tester, the Security Auditor and the Reviewer check it.
Inputs
- The session task.
- A read-only snapshot of relevant files from the project's repository: manifests, existing migrations, and the code that uses the affected packages or tables.
- The previous step: the dependency audit, or the schema design.
Outputs
A written migration plan with the code it needs:
- For dependency upgrades: the version changes, the code edits each breaking change needs, and the order to do them in.
- For data migrations: the migration itself, how existing rows are backfilled, and what to do if it fails halfway.
- Rollback notes for every step, including the points after which rollback is no longer possible.
The session's code pass writes the files, the project's tests run against the result in the verify step, and the findings pass reviews the diff.
Example run
Illustrative example, not a recorded session. In Data Migration, the Database Engineer has designed a new not-null status column on an orders table with millions of rows. The Migration Specialist splits the work into three migrations: add the column as nullable with a default, backfill it in batches, then add the not-null constraint. It notes that the first two can be rolled back by dropping the column, and that the third should only run after the backfill is confirmed complete. The Tester lists checks for each stage.
Limits
- It does not run migrations or connect to your database. It cannot see row counts or live locks.
- It follows the conventions it sees in the snapshot. A project with migrations in an unusual place may need that pointed out in the task.
- Never edit a migration that has already run in production. Ask for a new one instead.
- Rollback notes are advice. Test them in a non-production environment.
Frequently asked questions
Does the Migration Specialist agent run migrations against my database?
No. It writes the migration as code in your repository. Running it is up to your own deploy process after the change is approved.
What does a rollback note contain?
How to undo the step, and when undoing is not possible, such as after a column has been dropped. It is written so you can decide before you run anything.