From developer-workflow
Migrates Android modules to Kotlin Multiplatform (KMP) for iOS sharing: assesses feasibility, audits dependencies, sets up source sets (commonMain/androidMain), upgrades Kotlin to 2.x, exposes iOS frameworks.
npx claudepluginhub kirich1409/krozov-ai-tools --plugin developer-workflowThis skill uses the workspace's default tool permissions.
**Core principle:** Assess what can move to common → audit dependency compatibility → isolate module → migrate sources to the right source sets → verify on all targets → clean up Android-only artifacts.
Guides safe migration of technologies in existing Android/Kotlin projects: RxJava→coroutines, XML→Compose, library swaps (Glide→Coil, Retrofit→Ktor), Java→Kotlin, Gradle DSL upgrades.
Ports iOS/Swift features to Android/Kotlin by analyzing iOS code for behavior, data structures, logic, then implementing idiomatic equivalents matching target codebase patterns. Use for feature porting or platform parity.
Automates DI framework migrations in Kotlin/Android/KMP projects to Koin 4.x Compiler Plugin from Hilt, Dagger, Toothpick, Kodein, Koin upgrades, DSL to Safe DSL/Annotations.
Share bugs, ideas, or general feedback.
Core principle: Assess what can move to common → audit dependency compatibility → isolate module → migrate sources to the right source sets → verify on all targets → clean up Android-only artifacts.
KMP migration is a structural change. Code in commonMain must compile without any Android SDK — the Kotlin compiler enforces this strictly. Never start moving sources before the dependency audit is done.
digraph kmp_migration {
rankdir=TB;
node [shape=box];
assess [label="ASSESS\nIdentify module · target platforms\ndependency audit · isolation check"];
confirm [label="CONFIRM\nScope · dependency decisions\nwait for user approval"];
snapshot [label="SNAPSHOT\nCapture current behavior\n(tests / checklist)"];
isolate [label="ISOLATE MODULE\n(if not already isolated)"];
setup [label="KMP PLUGIN SETUP\nApply multiplatform plugin\nDeclare targets"];
migrate [label="MIGRATE SOURCES\nAll → androidMain first\nPromote to commonMain one-by-one"];
split_deps [label="SPLIT DEPENDENCIES\ncommonMain / androidMain"];
verify [label="VERIFY\nAll targets compile\nTests green on all targets"];
cleanup [label="CLEANUP\nRemove Android-only artifacts\nFinal build"];
done [label="Done", shape=doublecircle];
assess -> confirm;
confirm -> snapshot;
snapshot -> isolate;
isolate -> setup;
setup -> migrate;
migrate -> split_deps;
split_deps -> verify;
verify -> cleanup;
cleanup -> done;
}
Read the module(s). Understand what it does and whether it's already isolated. Confirm target platforms before anything else — they determine every subsequent decision:
| Target combination | Typical use case |
|---|---|
| Android + iOS | Share business logic with an iOS app |
| Android + JVM | Share with a backend/server module |
| Android + iOS + JVM | Full KMP — maximum sharing |
| Android + iOS + Desktop | Compose Multiplatform UI |
Extraction to a dedicated Gradle module is a hard prerequisite. Code cannot partially live in commonMain.
Strongly recommend Kotlin 2.x for new KMP work. Always run maven-mcp:latest-version org.jetbrains.kotlin:kotlin-gradle-plugin to find the current latest stable version.
| Current version | Recommendation |
|---|---|
| Latest Kotlin 2.x | Proceed |
| Older Kotlin 2.x | Upgrade to latest 2.x in same PR |
| Kotlin 1.9.x | Upgrade to latest 2.x before KMP work |
| Kotlin 1.8.x or older | Upgrade first as a separate PR |
For every dependency, verify KMP support. Use maven-mcp tools — fastest way to verify:
maven-mcp:latest-version — check KMP metadatamaven-mcp:dependency-changes — assess what changed between versionsmaven-mcp:check-deps — scan all deps at onceImportant: androidx.* is NOT automatically Android-only. Many publish KMP artifacts — always verify.
Categorize each dependency:
| Category | Meaning | Action |
|---|---|---|
| KMP-compatible now | Current version works in commonMain | Move to commonMain.dependencies |
| KMP available, minor update | Newer minor version adds KMP | Bump version, move |
| KMP only in breaking major | Requires major version with API changes | Nested migration — assess effort separately |
| No KMP support | No KMP artifact exists | Find KMP alternative, keep in androidMain, or drop |
Present the compatibility matrix to the user. For each problematic dependency, offer options: migrate first (separate PR), include in same plan, keep in androidMain, or replace with KMP alternative.
Based on the audit, propose 1–3 options (recommended first, dismiss unfit strategies with reasons).
Save to docs/plans/kmp-migration/YYYY-MM-DD-<module-name>.md. Generate a checklist if scope involves >1 file group. Wait for user approval before Phase 2.
Found a bug? Stop → describe to user → ask: fix now / separate task / leave as-is. Never silently fix or ignore.
Produce a behavior-spec.md for each module. Write characterization tests in commonTest where possible. All tests must pass before Phase 3.
references/migration-steps.md for Gradle config, iOS framework setupandroidMain first, then promote to commonMain one-by-one. See references/migration-steps.md for what-belongs-where table, expect/actual patterns, common platform concernsreferences/migration-steps.md for placement rulescompileCommonMainKotlinMetadata, compileDebugKotlinAndroid, assemble after each stepSee references/migration-steps.md for detailed verify commands and cleanup procedures.
behavior-spec.md line by line — present to userdependencies {} blocks, dead code — present list to user./gradlew build — must be greenimport android.* in commonMain./gradlew build green| Red Flag | What It Means |
|---|---|
| "I'll deal with incompatible dependencies later" | Dependency audit must complete before touching sources |
| "The module isn't isolated but I'll migrate in place" | Module isolation is a hard prerequisite |
| "I'll add tests after the migration" | Snapshot must be green before Phase 3 |
| "It compiled on Android, it's probably fine in commonMain" | Run compileCommonMainKotlinMetadata — commonMain is stricter |
| "These old androidMain files are clearly unused" | Present removal list to user first |
| "I noticed a bug, I'll fix it quickly" | Stop, describe to user, get explicit direction |
Using kotlinOptions / compilations.all in Kotlin 2.x | Deprecated — use compilerOptions { } DSL |
| "It's androidx.* so it stays in androidMain" | Wrong — check KMP metadata first with maven-mcp |
| "Implementations always stay in androidMain" | Only if their dependencies are Android-only; if deps are KMP-compatible, the impl can go to commonMain |
| Skipping target platform confirmation | Target platforms determine every subsequent decision |