kmp-boundaries

Designs Kotlin Multiplatform boundaries between shared commonMain code and platform-specific implementations.

Updated Jul 1, 2026
One-click install
npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill kmp-boundaries-w0lzard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kmp-boundaries
Source: https://github.com/w0lzard/Wolzard-s-Marketplace/tree/main/plugins/personal-skills/skills/kmp-boundaries
Command: npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill kmp-boundaries-w0lzard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Kotlin Multiplatform projects struggle with deciding how shared code should reach platform APIs — choosing between expect/actual, common interfaces with DI, or separate platform screens — and often end up with monolithic Platform objects, leaky abstractions, and untestable actuals. ## Core Features & Use Cases - Boundary Shape Selection: Decision tables for choosing expect/actual functions, common interfaces with platform bindings, expect leaf composables, or fully separate platform screens based on testability, DI, and lifecycle needs. - Capability Granularity Rules: Guidance for splitting platform services (clipboard, share, haptics, biometrics, notifications) into small fakeable interfaces instead of one giant Platform object, with Activity-ownership rules for Android UI actions. - Source-Set Hierarchy & AGP 9 Constraints: Covers skikoMain/appleMain intermediate source sets, the new com.android.kotlin.multiplatform.library plugin limits (no BuildConfig, no variants, no NDK), and Compose Multiplatform interop patterns. - Use Case: When common code needs to trigger the system share sheet, this Skill guides you to define a semantic ShareSheet interface in commonMain, bind an Activity-scoped AndroidShareSheet via Hilt, and keep business rules in a common ShareUseCase testable with a fake. ## Quick Start Ask the AI to design a Kotlin Multiplatform boundary for accessing the device clipboard and haptics from shared commonMain code.

Frequently Asked Questions about kmp-boundaries

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

FAQPage Schema
How do I choose between expect/actual and a common interface in Kotlin Multiplatform?

Use expect/actual for compile-time specialization of a single pure function, value, or leaf composable. Switch to a common interface with platform bindings when you need test fakes, injected dependencies, runtime selection, or lifecycle ownership such as an Activity.

When should I use expect class vs interface in KMP?

Prefer a common interface bound per platform in almost all cases, since expect class is hard to fake, hard to extend, and requires a platform runtime in tests. Reserve expect declarations for pure functions, constants, and typealiases.

Does AGP 9 support BuildConfig in Kotlin Multiplatform libraries?

No. The com.android.kotlin.multiplatform.library plugin in AGP 9 removes BuildConfig, build variants, and NDK support. Use BuildKonfig or inject an AppConfiguration interface per platform for compile-time constants.

Why is using applicationContext with FLAG_ACTIVITY_NEW_TASK a mistake in KMP?

Launching UI from a generic Context hides the fact that the operation requires a foreground Activity and breaks lifecycle correctness. The platform binding should be Activity-owned, constructed in an activity-scoped DI module such as Hilt's ActivityComponent.

How do I expose Kotlin Flow and suspend functions to Swift in KMP?

Use SKIE, which automatically bridges suspend functions to Swift async and Flow to AsyncSequence, and converts sealed classes to exhaustive Swift enums via onEnum(of:). KMP-NativeCoroutines is the annotation-based alternative for existing projects.

When should I create an intermediate source set like skikoMain?

Create an intermediate source set only when at least two platforms can genuinely share an actual implementation, such as desktop, iOS, and web sharing Skia-based rendering. Do not add hierarchy speculatively for a single platform.