kotlin-multiplatform

pluginagentmarketplace's avatarfrom pluginagentmarketplace

Kotlin Multiplatform - shared code, expect/actual, iOS integration

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 31, 2025

When & Why to Use This Skill

This Claude skill streamlines Kotlin Multiplatform (KMP) development by providing automated templates for shared codebases, managing the expect/actual declaration pattern, and facilitating seamless iOS integration. It helps developers architect robust cross-platform applications by maintaining a single source of truth for business logic while handling platform-specific implementations efficiently.

Use Cases

  • Project Scaffolding: Quickly setting up the Gradle build configuration for KMP projects, including Android and iOS (X64, Arm64) target definitions.
  • Platform-Specific Implementation: Implementing the expect/actual pattern for hardware-level features like Secure Storage, Camera access, or Bluetooth across Android and iOS.
  • Shared Networking Layer: Configuring cross-platform dependencies such as Ktor to handle API requests within the common source set.
  • iOS Integration & Debugging: Resolving framework linking issues and ensuring the shared Kotlin module is correctly exposed as a framework for Xcode consumption.
namekotlin-multiplatform
descriptionKotlin Multiplatform - shared code, expect/actual, iOS integration
version"1.0.0"
sasmp_version"1.3.0"
bonded_agent04-kotlin-multiplatform
bond_typePRIMARY_BOND
timeout_ms30000
max_attempts3
backoffexponential
initial_delay_ms1000
- nameplatforms
typearray
validation"^(setup|shared|expect_actual|ios)$"
default["android", "ios"]
levelinfo
events[skill_invoked, target_loaded, error_occurred]

Kotlin Multiplatform Skill

Build cross-platform applications with shared Kotlin code.

Topics Covered

Project Setup

kotlin {
    androidTarget()
    listOf(iosX64(), iosArm64(), iosSimulatorArm64()).forEach {
        it.binaries.framework { baseName = "Shared"; isStatic = true }
    }
    sourceSets {
        commonMain.dependencies {
            implementation("io.ktor:ktor-client-core:2.3.8")
        }
        androidMain.dependencies { implementation("io.ktor:ktor-client-okhttp:2.3.8") }
        iosMain.dependencies { implementation("io.ktor:ktor-client-darwin:2.3.8") }
    }
}

expect/actual

// commonMain
expect class SecureStorage { fun get(key: String): String? }

// androidMain
actual class SecureStorage { actual fun get(key: String) = prefs.getString(key, null) }

// iosMain
actual class SecureStorage { actual fun get(key: String) = KeychainWrapper.get(key) }

Troubleshooting

Issue Resolution
"No actual for expect" Add implementation in platform source set
iOS framework not found Run linkDebugFrameworkIos task

Usage

Skill("kotlin-multiplatform")