kotlin-multiplatform

Document Kotlin Multiplatform abstraction boundaries across commonMain and platform source sets.

Updated Feb 16, 2026
One-click install
npx skills add https://github.com/esteban389/workout --skill kotlin-multiplatform-esteban389
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-multiplatform
Source: https://github.com/esteban389/workout/tree/main/.agents/skills/kotlin-multiplatform
Command: npx skills add https://github.com/esteban389/workout --skill kotlin-multiplatform-esteban389

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

The Kotlin Multiplatform platform abstraction guide helps engineering teams decide what code to share across commonMain and platform-specific source sets, ensuring correct module boundaries and stable cross-platform behavior.

Core Features & Use Cases

  • Abstraction decision tree to determine commonMain vs androidMain/jvmMain/iosMain
  • Real-world patterns and examples (crypto, JSON parsing, navigation, and platform-specific UI decisions)
  • Migration guidance and guardrails for multi-platform maintenance and future web/wasm readiness

Quick Start

Follow the Abstraction Decision Tree to determine the correct source set for a given module and begin refactoring accordingly.

Frequently Asked Questions about kotlin-multiplatform

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide what code to share in commonMain vs platform-specific source sets for Kotlin Multiplatform?

To decide what code to share in Kotlin Multiplatform, use an abstraction decision tree to evaluate module boundaries and determine whether logic belongs in commonMain or androidMain/jvmMain/iosMain based on platform dependencies.

What is the correct way to use expect/actual declarations for Kotlin Multiplatform architecture?

Expect/actual declarations in Kotlin Multiplatform architecture define expected APIs in commonMain and provide actual implementations in platform source sets like iosMain or jvmMain, ensuring stable cross-platform behavior for shared modules.

Does Kotlin Multiplatform support sharing crypto, JSON parsing, and IO logic across Android, iOS, and Desktop JVM?

Yes, Kotlin Multiplatform supports sharing crypto, JSON parsing, and IO logic across Android, iOS, and Desktop JVM by applying correct jvmAndroid patterns and abstraction boundaries to maintain stable cross-platform behavior.

What's the best way to migrate existing platform-specific code to a Kotlin Multiplatform project?

The best way to migrate to a Kotlin Multiplatform project is following provided migration guidance and guardrails, using the abstraction decision tree to refactor platform-specific modules into correct commonMain and platform source sets.

When should I not use commonMain for a module in Kotlin Multiplatform?

You should not use commonMain for a Kotlin Multiplatform module when the logic requires direct access to platform-specific APIs for UI or native capabilities, meaning it must reside in iosMain, androidMain, or jvmMain instead.

How do I prepare Kotlin Multiplatform source sets for future web and wasm targets?

Prepare Kotlin Multiplatform source sets for future web and wasm targets by following migration strategies and abstraction guardrails that ensure shared commonMain code remains platform-agnostic and ready for new compilation targets.