kmp-boundaries

Designs Kotlin Multiplatform boundaries between common code and platform APIs using expect/actual or interfaces.

1|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/chmonya-inc/dnd-manager --skill kmp-boundaries-chmonya-inc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmp-boundaries
Source: https://github.com/chmonya-inc/dnd-manager/tree/main/.agents/skills/kmp-boundaries
Command: npx skills add https://github.com/chmonya-inc/dnd-manager --skill kmp-boundaries-chmonya-inc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Kotlin Multiplatform projects often leak platform types like Context or UIViewController into commonMain, or accumulate domain logic inside actual implementations, making shared code untestable and hard to extend. This Skill provides decision rules for choosing the right boundary shape between shared and platform code. ## Core Features & Use Cases - Boundary Shape Selection: Decide between 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: Split platform services (clipboard, share, haptics, biometrics, notifications) into small fakeable interfaces instead of one monolithic Platform object. - Source-Set & AGP 9 Guidance: Covers skikoMain/appleMain intermediate source sets and AGP 9 KMP library constraints such as missing BuildConfig, no build variants, and no NDK. - Use Case: When adding a share feature to a KMP app, use this Skill to define a semantic ShareSheet interface in commonMain, bind an Activity-owned AndroidShareSheet in androidMain, and fake it in common JVM tests. ## Quick Start Ask the AI to design the KMP boundary for a platform capability such as clipboard access or a native map view in your Compose Multiplatform project.

Frequently Asked Questions about kmp-boundaries

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

FAQPage Schema
When should I use expect/actual vs a common interface in Kotlin Multiplatform?▼

Use expect/actual for pure functions, constants, typealiases, or single leaf composables. Use a common interface with platform bindings when you need test fakes, dependency injection, lifecycle ownership, or runtime selection between implementations.

How do I structure platform services like clipboard and share in KMP?▼

Split each capability into its own small interface such as Clipboard, ShareSheet, Haptics, and Biometrics rather than one Platform god object. Each interface gets its own platform binding and is independently fakeable in common tests.

Can commonMain code reference Android Context or UIViewController?▼

No, commonMain APIs must be semantic and free of platform types like Context, Activity, or UIViewController. Platform details belong inside the actual implementations, and Android UI bindings should hold an Activity rather than applicationContext.

When should I create intermediate source sets like skikoMain or appleMain?▼

Create an intermediate source set only when at least two platforms genuinely share an actual implementation, such as desktop and iOS sharing Skia-based code. Do not add hierarchy for code that is only almost identical across platforms.

What changes does AGP 9 bring to KMP library modules?▼

AGP 9 removes BuildConfig, build variants, NDK support, and kapt from KMP library modules, and forbids combining com.android.application with kotlin.multiplatform. The Android entry point must live in a separate androidApp module, and Compose resources need androidResources enabled explicitly.

Why is using applicationContext with FLAG_ACTIVITY_NEW_TASK a mistake in Android actuals?▼

UI operations like launching a share sheet require a foreground task, which applicationContext cannot provide without FLAG_ACTIVITY_NEW_TASK. That flag hides the lifecycle requirement, so the correct design is an Activity-owned platform binding.