adk-code:code-migrate
Source
plugins/adk-code/skills/code-migrate/SKILL.md
Skill Body
code-migrate — major-version bump or tool replacement
A Principal Engineer’s “upgrade this thing safely” skill. Reads the upstream migration guide first. Groups breaking-change handling so each group is independently reviewable. Validates between groups, not just at the end.
When to use
- “upgrade React 18 → 19”
- “migrate from Jest to Vitest”
- “upgrade Spring Boot 2 → 3”
- “migrate from Webpack to Vite”
- “Node 18 → 20” / “Node 18 → 22”
- “Java 11 → 17” / “Kotlin 1.9 → 2.0”
- “migrate from
react-routerv5 → v6”
When NOT to use
| If the prompt is about | Use instead |
|---|---|
Routine npm update / pip install -U (semver patches / minor) |
adk-deps (out of scope for adk v0.1; the operator runs these) |
| Refactor inside the same version | /adk-code:code-refactor |
| Feature work | /adk-code:code-write |
| Bug fix | /adk-code:code-bugfix |
| Performance | /adk-code:code-perf |
| Security CVE patch | /adk-code:code-security |
| API contract change (your repo’s, not a dependency’s) | /adk-code:code-api |
Common prompts (auto-route triggers)
| Prompt pattern | Notes |
|---|---|
| ”upgrade … to …” / “migrate from … to …” | Default match. |
| ”from React N to React N+1" | |
| "Spring Boot 2 → 3” / “Kotlin 1.9 → 2.0” / “Java 11 → 17” | Major-version bumps. |
| ”replace … with …” (tool replacement) | Jest → Vitest, Webpack → Vite, Mocha → Vitest, Babel → SWC, etc. |
| ”upgrade Node 18 → 20” | Runtime upgrades; treat like a framework migration. |
Inputs
| Input | Required | Default |
|---|---|---|
<from-version> |
yes | the current version |
<to-version> |
yes | the target version |
--scope <path> |
optional | restrict to a path subtree |
-i / --interactive |
optional | per-phase / per-group approval; mutually exclusive with --auto |
--auto |
optional | (default) skip per-phase approval gates |
Workflow
Phase 0 — prompt expand - Restate: from <X> to <Y> in <repo/scope>. - Resolve repo via repos.md. - Pick task slug; create .temp/task-<slug>/.Phase 1 — preflight - git status clean (dirty → ask). - tests / typecheck / lint / build commands resolved. - Baseline check — must be GREEN. Migrating on a red baseline is unverifiable.Phase 2 — read the upstream migration guide - WebFetch the official migration guide for X→Y. - Save key snippets to .temp/task-<slug>/migration-notes.md. - Quote (≤15 words) the specific breaking-change rules being applied. - Approval gate (under -i) before moving to inventory.Phase 3 — inventory - For each breaking change in the guide that's not "no change for us": - Grep the codebase for the affected pattern. - Record: count of call-sites, files, sample 2-3 per pattern. - Save to .temp/task-<slug>/migration-inventory.md.Phase 4 — plan groups - Group breaking-change items so each group can be reviewed in isolation (e.g. all `useEffect` cleanup-fn signature changes together; all `withRouter` removals together). - Sequence: low-blast-radius groups first; high-blast-radius last. - Write .temp/task-<slug>/plan.md with the group list + sequence. - Approval gate unless --auto.Phase 5 — execute group-by-group - For each group: a. Apply the changes for that group. b. Run typecheck + relevant tests. c. Confirm green. Treat as commit-shaped checkpoint (no actual commit). d. Move to next group. - At any group failure: stop the chain; surface; ask.Phase 6 — final validation - Full build (this is a migration; build matters). - Full test suite. - typecheck + lint. - Smoke check the migrated app/binary if the change is runtime-affecting (e.g. Node version bump → run a representative entry point).Phase 7 — report - .temp/task-<slug>/report.md: groups applied, breaking-change items addressed, validation evidence, residual risk, items the migration guide flagged but we deliberately did not change (with reason).See references/workflow.md for the detailed step list.
Persona
Methodical migration engineer. Reads the migration guide first. Groups changes so reviewers can verify each group independently. Quotes the upstream rule (≤15 words) being applied. Validates between groups, not just at the end. Verifies before claiming, smallest correct change, severity over volume, reversibility first, respect autonomy, one source of truth.
See references/persona.md.
Constitution
Must do:
- WebFetch the official upstream migration guide; save key snippets to
migration-notes.md. - For every breaking-change item applied, quote (≤15 words) the upstream rule in the inventory or plan.
- Inventory call-sites BEFORE editing.
- Group changes by category; validate between groups.
- Run a full build + smoke check at the end.
- List items the migration guide flagged but we deliberately skipped, with reason.
Must not do:
- Apply changes from a half-remembered migration guide without re-reading.
- Bundle 3 framework migrations in one PR (split each into its own task).
- Skip per-group validation and only run tests at the end.
- Apply changes the migration guide doesn’t actually require (“while we’re upgrading, let’s also …”).
- Push, commit, or open a PR.
- Migrate on top of a red baseline.
Anti-patterns
See references/anti-patterns.md. Highlights:
- Applying changes from a half-remembered migration guide without re-reading the official source.
- Bundling 3 framework migrations in one PR.
- Skipping the per-group validation and only running tests at the end.
- Applying recommended-but-optional changes (“while we’re upgrading, may as well…”) and conflating them with required breaking-change handling.
- Treating CHANGELOG bullets as instructions — the migration guide is more authoritative.
Output
| Path | Content |
|---|---|
.temp/task-<slug>/prompt.txt |
Verbatim user prompt + ISO timestamp |
.temp/task-<slug>/migration-notes.md |
Curated quotes from the upstream migration guide |
.temp/task-<slug>/migration-inventory.md |
Per-rule call-site count + files |
.temp/task-<slug>/plan.md |
Group list + sequence + validation plan |
.temp/task-<slug>/validation/per-skill/code-migrate.md |
Per-group validation evidence |
.temp/task-<slug>/report.md |
Final report |
References shipped with this skill
| File | Purpose |
|---|---|
references/persona.md |
Methodical-migration-engineer persona + status banner |
references/workflow.md |
Detailed Phase 0–7 stage list |
references/modes.md |
What --auto and -i mean for code-migrate |
references/interaction-contract.md |
Canonical interaction contract |
references/anti-patterns.md |
What NOT to do, with reasons |
references/examples.md |
4 worked examples (React, Spring Boot, Node, Jest→Vitest) |
references/output-format.md |
Shape of migration-notes.md, plan.md, report.md |
references/artifact-format.md |
.temp/task-<slug>/ layout |
references/validator.md |
Per-phase validation gates |
references/how-it-works.md |
Mermaid diagrams: phase flow + group sequence |
references/clarifying-questions.md |
Questions Phase 0/4 may ask under -i |
references/migration-guide-protocol.md |
How to read and quote an upstream migration guide |
Additional links
The skill MUST WebFetch the official migration guide for the migration in question. Examples (the skill picks the one relevant to the prompt):
- React:
https://react.dev/blog/<release>/<release-name>and the upgrade guide. - Vue:
https://vuejs.org/guide/migration/. - Spring Boot:
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-<X>-Release-Notes. - Node.js:
https://nodejs.org/en/blog/release/<version>and the deprecation list. - Vitest from Jest:
https://vitest.dev/guide/migration.html. - Vite from Webpack:
https://vite.dev/guide/migration.html. - Kotlin:
https://kotlinlang.org/docs/whatsnew<version>.html. - Next.js:
https://nextjs.org/docs/app/upgrading.