kmp-architecture

Structure Kotlin Multiplatform projects with source-set boundaries and expect/actual patterns.

1.8k|498|Updated Jan 20, 2020
One-click install
npx skills add https://github.com/meshtastic/Meshtastic-Android --skill kmp-architecture-meshtastic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kmp-architecture
Source: https://github.com/meshtastic/Meshtastic-Android/tree/main/.skills/kmp-architecture
Command: npx skills add https://github.com/meshtastic/Meshtastic-Android --skill kmp-architecture-meshtastic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on organizing Kotlin Multiplatform projects, defining source-set boundaries, and implementing platform bridging techniques.

Core Features & Use Cases

  • Source-Set Management: Establishes clear boundaries for commonMain, androidMain, jvmMain, and other source-sets to optimize code sharing and platform-specific implementation.
  • Bridging Strategies: Recommends effective patterns such as interface-based dependency injection and expect/actual declarations to handle platform differences safely.
  • Use Case: Developers implementing cross-platform mobile and desktop apps can structure their codebase for maintainability and scalability, ensuring proper platform abstraction and resource sharing.

Quick Start

Follow the provided guidelines to organize your project’s source-sets and apply the recommended bridging techniques to enable seamless multi-platform development.

Frequently Asked Questions about kmp-architecture

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

FAQPage Schema
How do I structure Kotlin Multiplatform source-sets for Android and JVM?

Define clear boundaries for commonMain, androidMain, and jvmMain source-sets to optimize code sharing and platform-specific implementation. This separation ensures maintainable, modular cross-platform applications.

What is the best way to handle platform differences in Kotlin Multiplatform?

Handle platform differences in Kotlin Multiplatform using interface-based dependency injection and expect/actual declarations. These bridging strategies safely manage platform variations while maximizing shared code across Android, JVM, and desktop environments.

Can I use expect/actual declarations for desktop and mobile platform bridging?

Yes, you can use expect/actual declarations for desktop and mobile platform bridging in Kotlin Multiplatform. This pattern allows you to define expected functionality in commonMain and provide actual implementations in androidMain or jvmMain source-sets safely.

When do I need to define separate source-set boundaries in a Kotlin Multiplatform project?

Define separate source-set boundaries in a Kotlin Multiplatform project when you need to optimize code sharing and isolate platform-specific implementation. Proper boundaries ensure scalable resource sharing across Android, JVM, and desktop environments without creating maintenance bottlenecks.

Does interface-based dependency injection work for Kotlin Multiplatform modularization?

Interface-based dependency injection works effectively for Kotlin Multiplatform modularization by providing a recommended bridging strategy. It enables safe platform abstraction and dependency management across shared and platform-specific source-sets for scalable cross-platform development.