Agent skill

Kotlin Multiplatform Boundaries

by rcosteira79 in rcosteira79/android-skills

Helps choose how common Kotlin Multiplatform code reaches platform APIs: expect/actual, a common interface with platform bindings, or separate platform screens.

MITAuto-check passedMobile

Install Kotlin Multiplatform Boundaries

skills CLI
$ npx skills add rcosteira79/android-skills --skill kmp-boundaries -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rcosteira79/android-skills kmp-boundaries --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rcosteira79/android-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/android-skills/skills/kmp-boundaries .claude/skills/kmp-boundaries && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
kmp-boundaries
GitHub stars
153
Token cost
~1.5k tokens
SKILL.md length
554 words
Files
2 (incl. references)
Skills in repo
21
Repo updated
First seen
Licence
MIT

At a glance

Helps choose how common Kotlin Multiplatform code reaches platform APIs: expect/actual, a common interface with platform bindings, or separate platform screens.

  • Deciding between expect/actual and a common interface for a platform service
  • SKILL.md covers Platform-UI bindings are… and AGP-9 KMP-library constraints…
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Designing capability interfaces for clipboard, share, haptics or biometrics

What it does

Five core rules shape every boundary. Keep commonMain semantic by describing what the product needs rather than Android or iOS mechanics, split by capability so Clipboard, ShareSheet, Haptics and Biometrics are separate interfaces and not one Platform object, keep actuals thin, prefer a common interface with per-platform bindings over expect class when you need fakes, DI, lifecycle or runtime selection, and add an intermediate source set such as appleMain or skikoMain only when two platforms truly share an actual.

The skill gives most detail to platform-UI bindings, which should be owned by an Activity rather than a Context: passing applicationContext and hiding the gap with a new-task intent flag is called a smell, and the binding should be built in an activity scope with Hilt or Koin. It also covers constraints for AGP 9 KMP libraries. A reference file, references/ios-interop.md, handles Kotlin to Swift naming, SKIE, sealed classes and SwiftUI embedding for the iOS side.

When your agent uses it

  • Deciding between expect/actual and a common interface for a platform service
  • Designing capability interfaces for clipboard, share, haptics or biometrics
  • Structuring source sets such as appleMain and skikoMain
  • Wiring Android activity-bound features into shared Kotlin code

Example prompts

  • “Design the boundary for sharing text from common code on Android and iOS.”
  • “Review my commonMain Haptics code and tell me whether expect class or an interface fits better.”
  • “Move the business branching out of our actual Biometrics implementation into common code.”
  • “Set up an appleMain source set only for the actuals that iOS and macOS really share.”

What it can do on your machine

Read from SKILL.md and the folder at commit 0f9af5a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are kotlin).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Kotlin Multiplatform Boundaries loads about 1.5k tokens when it runs, and up to ~3.3k if it reads all its reference files. Until then it costs about 129 tokens; SKILL.md has 554 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~129
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rcosteira79/android-skills at commit 0f9af5a, republished under its MIT licence (© rcosteira79). 554 words, ~1,542 tokens.

Download SKILL.mdSave it as .claude/skills/kmp-boundaries/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
kmp-boundaries
description
Use when designing Kotlin Multiplatform boundaries — choosing between expect/actual, common interfaces with platform bindings, or separate platform screens. Covers platform services (clipboard, share, haptics, permissions, files, settings, sensors, biometrics), native SDKs, source-set hierarchies (commonMain, skikoMain, appleMain, androidMain), Compose Multiplatform interop, and capability granularity. Use whenever common code needs to reach a platform API and you're picking the boundary shape.

Kotlin Multiplatform Boundary Design

Core rules for any KMP boundary:

  • Keep commonMain semantic — describe what the product needs, not Android/iOS mechanics: currentRegion(), never currentRegionFromAndroidLocale(context).
  • Split by capability — Clipboard, ShareSheet, Haptics, Biometrics as separate interfaces, not one Platform god object.
  • Keep actuals thin — they translate, they don't decide; a business if/when inside an actual belongs in common, tested with a fake.
  • Prefer a common interface + per-platform binding over expect class whenever you need fakes / DI / lifecycle / runtime selection.
  • Introduce an intermediate source set (skikoMain, appleMain) only when two platforms genuinely share an actual.

Two boundaries get the most detail below: the Activity-owned platform-UI boundary, and the AGP-9 KMP-library constraints.

Related: android-skills:kmp-ktor (network boundary), compose/references/multiplatform.md (Compose-MP mechanics), android-skills:kotlin-coroutines (scope ownership). For the iOS↔Swift bridge — Kotlin→Swift naming, type widths (Int is 32-bit), SKIE suspend→async / Flow→AsyncSequence, sealed-class exhaustiveness, SwiftUI embedding — load references/ios-interop.md when authoring the iOS-side actual.

Platform-UI bindings are Activity-owned, not Context-owned

The single most common Android boundary mistake: passing applicationContext / LocalContext.current into a binding that actually needs an Activity, then papering over the lifecycle gap with Intent.FLAG_ACTIVITY_NEW_TASK. That flag is a smell — it hides that this is a foreground-UI operation. Hold an Activity instead.

kotlin
// commonMain — semantic interface; DOCUMENT what `suspend` means
interface ShareSheet {
    /** Launches the system share sheet. Returns when the sheet is PRESENTED — not when the user
     *  completes or cancels. (Otherwise callers write incorrect retry/confirmation logic.) */
    suspend fun shareText(text: String)
}

// androidMain — thin: build the intent and launch it. Activity-owned.
class AndroidShareSheet(private val activity: Activity) : ShareSheet {
    override suspend fun shareText(text: String) {
        activity.startActivity(Intent.createChooser(
            Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_TEXT, text), null,
        ))
    }
}

You don't app-wide-inject an Activity (it's framework-created and lifecycle-bound) — construct the binding in an activity scope in the Android app module (Hilt @InstallIn(ActivityComponent::class), where Activity is a default binding; Koin scoped). commonMain only ever sees the interface; the Activity never leaves the app module. If a longer-lived (app-scoped) object needs it, hold it behind a lifecycle-aware provider (set in onResume, cleared in onPause) so a destroyed Activity can't leak.

Show full SKILL.md (293 more words)Show less

AGP-9 KMP-library constraints (structural — they shape what can live in shared code)

AGP 9 replaces com.android.library with com.android.kotlin.multiplatform.library for the Android side of a KMP module, and rejects com.android.application + kotlin.multiplatform outright. The new plugin enforces a single-variant architecture:

  • BuildConfig is unavailable — compile-time constants come from BuildKonfig or an injected AppConfiguration interface. Don't design commonMain APIs that assume BuildConfig.X exists.
  • No build variants — variant-specific deps/resources/signing live in the app module; a debug/release decision surfaces as a runtime config value injected into common code, not a build-variant split inside the KMP module.
  • No NDK / JNI — extract native (C/C++) into a separate com.android.library module, wrapped behind a common interface the KMP module consumes.
  • Compose-MP resources need explicit enable — add androidResources { enable = true } inside kotlin { android { … } }, or Res.string.* / Res.drawable.* crash at runtime on Android (the build still succeeds — easy to miss).
  • Consumer ProGuard rules need migration — consumerProguardFiles("rules.pro") from the old android {} block is silently dropped; use consumerProguardFiles.add(file("rules.pro")) in the new DSL.
  • The KMP module can't also be com.android.application — the Android entry point (MainActivity, Application class, launcher manifest, applicationId / targetSdk / versionCode / versionName) moves to a separate androidApp module that depends on the shared library. MainActivity, app-level Hilt setup, and nav-host wiring all move out of the shared androidMain.
  • kapt is incompatible with AGP 9's built-in Kotlin — migrate annotation processors to KSP (2.3.1+), or fall back to com.android.legacy-kapt for processors with no KSP equivalent.
ConcernPre-AGP-9 (monolithic)AGP 9 KMP library
MainActivity, Application class, launcher manifestandroidMain of shared moduleSeparate androidApp module
applicationId, versionCode, targetSdkShared module's android {}androidApp only
Compile-time constants (env, flags)BuildConfig fieldBuildKonfig in common, or runtime DI
NDK / JNI native codeandroidMain (any module)Separate com.android.library, behind a common interface

For migrating an existing project, see JetBrains' kotlin-tooling-agp9-migration skill for the full mechanics.

© rcosteira79, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in plugins/android-skills/skills/kmp-boundaries of rcosteira79/android-skills.

  • SKILL.md
  • references/ios-interop.md

Open the folder on GitHubat commit 0f9af5a

Compare with similar skills

Kotlin Multiplatform Boundaries next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Kotlin Multiplatform Boundaries compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Kotlin Multiplatform Boundaries this skillrcosteira79/android-skills153—~1.5kAutomated safety check: PassMIT
Expo UIarcboxlabs/linkcode155—~1.2kAutomated safety check: PassMIT
Ksafeioannisa/KSafe338—~17kAutomated safety check: PassApache-2.0
KtormonitorCosminMihuMDC/KtorMonitor254—~2.5kAutomated safety check: PassApache-2.0
SimdeckNativeScript/SimDeck153—~3.6kAutomated safety check: PassMIT
Expo Brownfieldexpo/skills2.7k—~1.4kAutomated safety check: PassMIT

Similar skills

  • Expo UI

    arcboxlabs/linkcode

    Framework (OSS). An agent skill from arcboxlabs/linkcode.

    155 GitHub stars~1.2k tokensUpdated 13 days ago
    MobileAuto-check passed
  • Ksafe

    ioannisa/KSafe

    Required before any reply that touches KSafe (by ksafe(...), ksafe.get/put, :ksafe-compose, :ksafe-biometrics), even a 'can KSafe do X?' question or a one-line change that looks like plain Kotlin.

    338 GitHub stars~17k tokensUpdated 7 days ago
    MobileAuto-check passed
  • Ktormonitor

    CosminMihuMDC/KtorMonitor

    KtorMonitor is a Kotlin Multiplatform library for real-time HTTP traffic monitoring.

    254 GitHub stars~2.5k tokensUpdated 28 days ago
    MobileAuto-check passed
  • Simdeck

    NativeScript/SimDeck

    A skill your agent uses for simulator lifecycle, app install/launch, live viewing, UI inspection, touch/keyboard automation, screenshots, recordings, logs, pasteboard, hardware controls, and…

    153 GitHub stars~3.6k tokensUpdated 29 days ago
    MobileAuto-check passed
  • Expo Brownfield

    expo/skills

    Official

    Integrate Expo and React Native into an existing native iOS or Android app.

    2.7k GitHub stars~1.4k tokensUpdated 3 days ago
    MobileAuto-check passed
  • Expo UI

    sickn33/agentic-awesome-skills

    Build native UI with the @expo/ui package: real SwiftUI on iOS and Jetpack Compose on Android rendered from React in an Expo or React Native app.

    47k GitHub starsUsed in 1 repo~1.1k tokens
    MobileAuto-check passed

More from rcosteira79/android-skills

All 21 skills in this repo
  • Guides writing correct, performant Compose and Compose Multiplatform UI across Android, desktop, iOS and web, from state and animation to design-to-code and crash fixes.

    153 GitHub stars~2.6k tokensUpdated 21 days ago
    Auto-check passed
  • Android Data Layer and Room in KMP

    rcosteira79/android-skills

    Sets out the repository pattern's error-propagation model for Android and Kotlin Multiplatform, plus the Room setup for commonMain.

    153 GitHub stars~1.2k tokensUpdated 21 days ago
    Auto-check passed
  • Android Debugging

    rcosteira79/android-skills

    Android and KMP debugging techniques for crashes, ANRs, memory leaks, R8 traces, Gradle failures and Compose recomposition, built on finding the root cause first.

    153 GitHub stars~2.6k tokensUpdated 21 days ago
    Auto-check passed
  • Android and KMP Baseline

    rcosteira79/android-skills

    Sets house defaults for Android and Kotlin Multiplatform work and routes to the right specialized skill for Compose, networking, testing or build tooling.

    153 GitHub stars~3k tokensUpdated 21 days ago
    Auto-check passed
  • Android Gradle Build Logic

    rcosteira79/android-skills

    Sets up Android Gradle convention plugins in a build-logic composite build, including the version catalog wiring and shared configuration that are easy to get wrong.

    153 GitHub stars~959 tokensUpdated 21 days ago
    Auto-check passed
  • Android Retrofit

    rcosteira79/android-skills

    A skill your agent uses when setting up or working with Retrofit in Android — service interface definitions, coroutines integration, OkHttp configuration, Hilt module setup, and error handling in…

    153 GitHub stars~942 tokensUpdated 21 days ago
    Auto-check passed

Categories

Questions about Kotlin Multiplatform Boundaries

What does Kotlin Multiplatform Boundaries do?

Helps choose how common Kotlin Multiplatform code reaches platform APIs: expect/actual, a common interface with platform bindings, or separate platform screens. Five core rules shape every boundary. Keep commonMain semantic by describing what the product needs rather than Android or iOS mechanics, split by capability so Clipboard, ShareSheet, Haptics and Biometrics are separate interfaces and not one Platform object, keep actuals thin, prefer a common interface with per-platform bindings over expect class when you need fakes, DI, lifecycle or runtime selection, and add an intermediate source set such as appleMain or skikoMain only when two platforms truly share an actual.

When should I use Kotlin Multiplatform Boundaries?

Kotlin Multiplatform Boundaries fits situations like: deciding between expect/actual and a common interface for a platform service; designing capability interfaces for clipboard, share, haptics or biometrics; structuring source sets such as appleMain and skikoMain; wiring Android activity-bound features into shared Kotlin code.

How do I install Kotlin Multiplatform Boundaries in Claude Code?

Run `npx skills add rcosteira79/android-skills --skill kmp-boundaries -a claude-code`. Or copy the skill folder (plugins/android-skills/skills/kmp-boundaries in rcosteira79/android-skills) into .claude/skills/kmp-boundaries in your project. Claude Code loads it when a task matches its description.

How do I install Kotlin Multiplatform Boundaries in Codex?

Run `npx skills add rcosteira79/android-skills --skill kmp-boundaries -a codex`. Or copy the skill folder (plugins/android-skills/skills/kmp-boundaries in rcosteira79/android-skills) into .agents/skills/kmp-boundaries in your project. Codex loads it when a task matches its description.

Can I use Kotlin Multiplatform Boundaries in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rcosteira79/android-skills --skill kmp-boundaries -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/kmp-boundaries, .gemini/skills/kmp-boundaries, .github/skills/kmp-boundaries and .opencode/skills/kmp-boundaries in your project.

What does Kotlin Multiplatform Boundaries need to run?

SKILL.md names no scripts, command-line tools or credentials: Kotlin Multiplatform Boundaries is instructions for the agent only.

Does Kotlin Multiplatform Boundaries access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Kotlin Multiplatform Boundaries safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Kotlin Multiplatform Boundaries use?

Kotlin Multiplatform Boundaries is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Kotlin Multiplatform Boundaries use?

About 1.5k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.8k tokens, read only when the agent opens those files.

What are the alternatives to Kotlin Multiplatform Boundaries?

Skills that share tags, products or a category with Kotlin Multiplatform Boundaries: Expo UI (arcboxlabs/linkcode, 155 stars), Ksafe (ioannisa/KSafe, 338 stars), Ktormonitor (CosminMihuMDC/KtorMonitor, 254 stars) and Simdeck (NativeScript/SimDeck, 153 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Kotlin Multiplatform Boundaries?

rcosteira79 (a GitHub user) maintains it in rcosteira79/android-skills, which has 153 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on September 19, 2026.

Source: rcosteira79/android-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.