kotlin-multiplatform-expect-actual

Enforce stable cross-platform boundaries in Kotlin Multiplatform projects using expect/actual or interfaces.

908|42|Updated May 12, 2026
One-click install
npx skills add https://github.com/chrisbanes/skills --skill kotlin-multiplatform-expect-actual
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-multiplatform-expect-actual
Source: https://github.com/chrisbanes/skills/tree/main/skills/kotlin-multiplatform-expect-actual
Command: npx skills add https://github.com/chrisbanes/skills --skill kotlin-multiplatform-expect-actual

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Design clean, stable cross-platform boundaries in Kotlin Multiplatform projects using expect/actual declarations or interfaces, preventing leakage of platform specifics into shared code.

Core Features & Use Cases

  • Establish clear division between commonMain APIs and platform-specific actual implementations.
  • Guide when to use expect/actual vs common interfaces, and how to structure dependency bindings across modules.
  • Provide guidance for interop scenarios across Android, iOS, Desktop, and Wasm, including permissions, files, and settings.

Quick Start

Describe a boundary strategy for a Kotlin Multiplatform module using expect/actual across Android and iOS.

Frequently Asked Questions about kotlin-multiplatform-expect-actual

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

FAQPage Schema
How do I design cross-platform boundaries in Kotlin Multiplatform to prevent platform specifics from leaking into shared code?

Use expect/actual declarations or common interfaces to separate commonMain APIs from platform-specific implementations, ensuring a single stable call site. This prevents platform specifics from leaking into shared code.

When should I use expect/actual versus common interfaces in a Kotlin Multiplatform module?

Use expect/actual versus common interfaces in a Kotlin Multiplatform module based on your dependency structure and interop needs. Expect/actual provides direct platform bindings, while common interfaces offer flexible dependency injection across Android, iOS, Desktop, and Wasm modules.

How do I set up expect and actual declarations for Android and iOS in Kotlin Multiplatform?

Define expected APIs in commonMain and provide actual implementations in platform modules. This strategy maintains stable cross-platform boundaries for permissions, files, settings, and sensors across Android and iOS.

Can I use expect/actual for interop scenarios involving permissions and sensors across Android, iOS, Desktop, and Wasm?

Yes, you can use expect/actual for interop scenarios involving permissions and sensors across Android, iOS, Desktop, and Wasm. This approach structures platform bindings and module dependencies to maintain stable call sites for these platform-specific features.

What are the limitations of using expect/actual for platform boundaries in Kotlin Multiplatform?

Limitations of using expect/actual for platform boundaries in Kotlin Multiplatform include strict matching requirements between expected and actual declarations and potential module dependency complexity. Consider common interfaces for more flexible dependency binding across platforms.