Migrate

From InugamiDev/ultrathink-oss · View interactive version

Migrate is an AI agent skill from the GitHub repository InugamiDev/ultrathink-oss. Migration orchestrator that safely plans, executes, and verifies codebase or infrastructure migrations with rollback capabilities.

How to use this skill

Skill file

Migrate

Purpose

Migrate is the orchestrator for all types of migrations: framework upgrades, language version bumps, architecture shifts, database schema changes, dependency replacements, and technology swaps. It treats every migration as a high-risk operation and applies a disciplined process: plan thoroughly, back up everything, execute incrementally, verify at each step, and always have a rollback plan.

Migrations are inherently dangerous because they touch many files, change fundamental assumptions, and can introduce subtle regressions that only surface later. Migrate exists to make this process as safe and systematic as possible.

Workflow

Phase 1: Assess & Plan

  1. Parse the migration scope -- Understand what's being migrated from and to. Identify all affected areas.
  2. Invoke scout -- Scan the codebase to build a complete inventory of what needs to change:
  1. Invoke research -- Look up the migration path:
  1. Invoke sequential-thinking -- Reason through the migration order:
  1. Invoke plan -- Create a phased migration plan:
  1. Invoke plan-validate -- Verify the plan is complete and feasible.
  2. Invoke mermaid (if complex) -- Visualize the migration dependency graph.
  3. Present the plan -- Show the user the full migration plan. This is a mandatory checkpoint -- no migration proceeds without explicit user approval.

Phase 2: Backup

  1. Invoke git-workflow -- Create a migration branch from the current state.
  2. Create a pre-migration snapshot -- Tag the current state so rollback is always one command away.
  3. Document the current state -- Record:

Phase 3: Execute (Per Phase)

For each phase in the migration plan:

  1. Execute the changes -- Apply the transformations for this phase:
  1. Invoke test -- Run relevant tests after each phase:
  1. Handle failures -- If tests fail:
  1. Invoke commit-crafter -- Commit the phase with a descriptive message like migrate(phase-2): convert REST routes to GraphQL resolvers.
  2. Phase checkpoint -- Report phase completion, test results, and any concerns before proceeding.

Phase 4: Verify

  1. Run full test suite -- After all phases complete, run every test.
  2. Invoke code-review -- Review the entire migration diff:
  1. Invoke optimize (if applicable) -- If the migration was a framework upgrade, check that performance hasn't regressed.
  2. Invoke scout -- Re-scan for any remaining references to the old pattern. Flag anything left behind.

Phase 5: Rollback Plan

  1. Document the rollback procedure -- Create explicit rollback instructions:
  1. Test the rollback (if high-risk) -- For critical migrations, actually test that the rollback works on a branch.

Phase 6: Complete

  1. Invoke docs-writer -- Update documentation to reflect the new state.
  2. Invoke plan-archive -- Archive the migration plan for future reference.
  3. Present migration summary -- Report:

Migration Types

Framework Upgrade

Example: Next.js 14 -> Next.js 15
Phases:
  1. Update dependencies + config
  2. Migrate deprecated APIs
  3. Update routing patterns
  4. Update data fetching patterns
  5. Full test + review

Language Version Bump

Example: Node.js 18 -> Node.js 22
Phases:
  1. Update engine constraints
  2. Replace deprecated APIs
  3. Adopt new language features (optional)
  4. Update CI/CD node version
  5. Full test + review

Technology Swap

Example: Styled-components -> Tailwind CSS
Phases:
  1. Install Tailwind, configure
  2. Convert shared/base components
  3. Convert feature components
  4. Convert page-level components
  5. Remove styled-components
  6. Full test + visual review

Database Migration

Example: MySQL -> PostgreSQL
Phases:
  1. Set up PostgreSQL, schema migration
  2. Update ORM config + queries
  3. Data migration scripts
  4. Update connection handling
  5. Parallel run + data verification
  6. Cutover

Architecture Shift

Example: Monolith -> Microservices
Phases:
  1. Identify service boundaries
  2. Extract shared libraries
  3. Extract first service
  4. Set up inter-service communication
  5. Extract remaining services
  6. Remove monolith routing

Decision Points

| Condition | Action |

|-----------|--------|

| Official migration guide exists | Follow it, supplement with codemod |

| Codemod available | Use it for bulk changes, review output |

| Migration affects database | Require explicit backup + rollback test |

| Test suite is insufficient | Write migration-specific tests before migrating |

| Phase fails after 3 fix attempts | Halt, report, ask user for direction |

| Migration is < 10 files | Simplify to single-phase execution |

| Migration is > 100 files | Mandatory multi-phase with checkpoints |

Usage

Use Migrate for any change that transforms the project from one state to another at a foundational level. This is distinct from refactor (which restructures without changing technology) and cook (which adds features).

Best for:

Not ideal for:

Examples

Example 1: Framework upgrade

User: /migrate Upgrade from React 18 to React 19

Migrate workflow:
1. scout -> Find all React imports, hook usage, deprecated patterns
2. research -> React 19 migration guide, breaking changes list
3. plan -> 4 phases: deps, compiler setup, API updates, new features
4. Backup -> Tag pre-migration, create branch
5. Phase 1 -> Update react, react-dom, types
6. Phase 2 -> Set up React compiler, remove useMemo/useCallback where safe
7. Phase 3 -> Update deprecated APIs (forwardRef removal, etc.)
8. Phase 4 -> Adopt new patterns (use(), Actions)
9. Verify -> Full test suite, code-review, scout for remnants
10. Rollback plan -> Document revert steps

Example 2: ORM migration

User: /migrate Move from Prisma to Drizzle ORM

Migrate workflow:
1. scout -> Inventory all Prisma models, queries, migrations
2. research -> Drizzle schema syntax, query API differences
3. plan -> 5 phases: schema, queries, migrations, middleware, cleanup
4. Backup -> Tag pre-migration
5. Phase 1 -> Convert Prisma schema to Drizzle schema
6. Phase 2 -> Rewrite queries (findMany -> select, etc.)
7. Phase 3 -> Set up Drizzle migration system
8. Phase 4 -> Update middleware and utilities
9. Phase 5 -> Remove Prisma, clean up
10. Verify -> Full test suite, data integrity checks

Guardrails

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.