plan-a-migration
Move a system, a dependency or a domain without an outage, with the rollback written down before the cutover.
Save as .claude/skills/plan-a-migration/SKILL.md in a repository, or under ~/.claude/skills/plan-a-migration/SKILL.md to have it everywhere. The copy button takes the whole file, frontmatter included.
--- name: plan-a-migration description: Plan the move of a system, dependency or domain so that it can be cut over without an outage and rolled back if it goes wrong. Use when asked to migrate hosting, a database, a domain, DNS or a major dependency, or to review a cutover plan before the day. --- # Plan a migration A migration is a change with an old state you can still return to. Plan the return first, then the move. ## Before the plan 1. List everything that points at the old thing: DNS records including MX, TXT and CAA, hard coded URLs, webhooks registered with third parties, OAuth callback URLs, scheduled jobs, IP allow lists and email sender records. The item nobody listed is the outage. 2. Define the success check as numbers: error rate, latency, and a business count such as orders per hour, each compared with the old system. A migration without a measured success check is just a change. 3. Write the rollback before the cutover: the exact steps, how long they take, and what happens to data written to the new system in the meantime. If there is a point of no return, name it. 4. Name one person who calls the rollback, and the signal, in advance. "Error rate above 2 percent for five minutes" is a signal. "If it looks bad" is not, and nobody decides well during an incident. ## Run both in parallel - Bring the new system up fully while the old one still serves. - Send both the same input and compare the output with a diff, not by eye. - Shift traffic in stages where the platform allows it. - For data: copy, keep in sync, then move writes. Never let both sides accept writes without a rule for conflicts. ## DNS - Lower the TTL well before the day. A TTL change is itself subject to the old TTL. If the record had a TTL of one day, resolvers hold the old value, and the old TTL, for up to a day. Lower it at least one full old TTL ahead. - Confirm with `dns_lookup` that the low TTL is being served before cutover, and use `dns_propagation` afterwards to see whether resolvers agree. - Some resolvers ignore short TTLs. Keep the old system serving for days after the switch, not hours. - Raise the TTL again once things have settled. ## Order when certificates, DNS and config all move 1. Configure the new application to accept both the old and new hostnames. 2. Install the certificate on the new host before traffic arrives. The trap: validation over HTTP needs DNS to point at the new host already. Use DNS validation instead, and check that CAA records permit the new issuer. 3. Test the new host directly, bypassing DNS, including `ssl_check`. 4. Switch DNS. 5. Watch the success check through at least one full TTL. 6. Add redirects from old names only once the new system is proven. 7. Decommission the old system after the rollback window closes, not before. ## Redirects - Every migration adds a hop: HTTP to HTTPS, apex to www, old domain to new, old path to new. Collapse them so each old URL reaches its final address in one hop. - Use temporary redirects until you are sure. Browsers cache a permanent redirect indefinitely, so a wrong one cannot be recalled. - One layer owns each redirect. A platform rule and an application rule both handling apex and www will loop. - Check a sample of old URLs with `http_headers`, including deep paths and query strings, not only the home page. ## What not to do - **Do not combine the migration with an upgrade or a refactor.** When it breaks you will not know which change did it. - **Do not cut over when the person who can roll back is about to be away.** - **Do not delete the old system to save money** inside the rollback window. - **Do not declare success because it loads for you.** Your resolver and your cache are one sample. ## When to stop Roll back on the agreed signal without debate. Diagnose afterwards, from the old system. If you cannot verify a step, such as registrar settings you have no access to, say so and name who can. ## Report back 1. The inventory, and anything you could not confirm. 2. The ordered cutover steps with an owner and a check for each. 3. The rollback: steps, duration, point of no return, who calls it and on what signal. 4. The success check, its thresholds and how long it is watched.
what it needs
Nothing. This skill is instructions only, so it works in any agent that reads SKILL.md with nothing installed and no account. Save the file and it is live in the next session.
the instructions, in full
Plan a migration
A migration is a change with an old state you can still return to. Plan the return first, then the move.
Before the plan
- List everything that points at the old thing: DNS records including MX, TXT and CAA, hard coded URLs, webhooks registered with third parties, OAuth callback URLs, scheduled jobs, IP allow lists and email sender records. The item nobody listed is the outage.
- Define the success check as numbers: error rate, latency, and a business count such as orders per hour, each compared with the old system. A migration without a measured success check is just a change.
- Write the rollback before the cutover: the exact steps, how long they take, and what happens to data written to the new system in the meantime. If there is a point of no return, name it.
- Name one person who calls the rollback, and the signal, in advance. "Error rate above 2 percent for five minutes" is a signal. "If it looks bad" is not, and nobody decides well during an incident.
Run both in parallel
- Bring the new system up fully while the old one still serves.
- Send both the same input and compare the output with a diff, not by eye.
- Shift traffic in stages where the platform allows it.
- For data: copy, keep in sync, then move writes. Never let both sides accept writes without a rule for conflicts.
DNS
- Lower the TTL well before the day. A TTL change is itself subject to the old TTL. If the record had a TTL of one day, resolvers hold the old value, and the old TTL, for up to a day. Lower it at least one full old TTL ahead.
- Confirm with
dns_lookupthat the low TTL is being served before cutover, and usedns_propagationafterwards to see whether resolvers agree. - Some resolvers ignore short TTLs. Keep the old system serving for days after the switch, not hours.
- Raise the TTL again once things have settled.
Order when certificates, DNS and config all move
- Configure the new application to accept both the old and new hostnames.
- Install the certificate on the new host before traffic arrives. The trap: validation over HTTP needs DNS to point at the new host already. Use DNS validation instead, and check that CAA records permit the new issuer.
- Test the new host directly, bypassing DNS, including
ssl_check. - Switch DNS.
- Watch the success check through at least one full TTL.
- Add redirects from old names only once the new system is proven.
- Decommission the old system after the rollback window closes, not before.
Redirects
- Every migration adds a hop: HTTP to HTTPS, apex to www, old domain to new, old path to new. Collapse them so each old URL reaches its final address in one hop.
- Use temporary redirects until you are sure. Browsers cache a permanent redirect indefinitely, so a wrong one cannot be recalled.
- One layer owns each redirect. A platform rule and an application rule both handling apex and www will loop.
- Check a sample of old URLs with
http_headers, including deep paths and query strings, not only the home page.
What not to do
- Do not combine the migration with an upgrade or a refactor. When it breaks you will not know which change did it.
- Do not cut over when the person who can roll back is about to be away.
- Do not delete the old system to save money inside the rollback window.
- Do not declare success because it loads for you. Your resolver and your cache are one sample.
When to stop
Roll back on the agreed signal without debate. Diagnose afterwards, from the old system. If you cannot verify a step, such as registrar settings you have no access to, say so and name who can.
Report back
- The inventory, and anything you could not confirm.
- The ordered cutover steps with an owner and a check for each.
- The rollback: steps, duration, point of no return, who calls it and on what signal.
- The success check, its thresholds and how long it is watched.
check its answers by hand
A skill that reasons well about wrong data is still wrong. For the first few cases, run the same question through a tool that cannot be mistaken.
Check whether a DNS record has propagated by querying it against multiple public resolvers at once.
Open the toolFollow every redirect hop with status, timing, HSTS, and cookies, and see what is wrong with the chain.
Open the toolcredit
This skill covers ground first mapped by addyosmani/agent-skills, a widely used open collection of engineering skills. The instructions above are written from scratch for this library, in its own voice and with its own opinions, and nothing is copied. The thanks is for the idea.