kmp

Shares Kotlin code across Android, iOS, and web via expect/actual declarations and Gradle configuration.

1|1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/pddhkt/kotlin-kmp-skills --skill kmp-pddhkt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kmp
Source: https://github.com/pddhkt/kotlin-kmp-skills/tree/main/plugins/kotlin-kmp/skills/kmp
Command: npx skills add https://github.com/pddhkt/kotlin-kmp-skills --skill kmp-pddhkt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Kotlin Multiplatform patterns enable sharing code across Android, iOS, desktop, and web by promoting commonMain, expect/actual declarations, and a clean source-set structure to reduce duplication and maintenance.

Core Features & Use Cases

  • Shared architecture templates for commonMain and platform-specific implementations
  • Patterns for expect/actual, source-set organization, and Gradle configuration
  • Use Case: Implement a cross-platform repository with common domain models and platform adapters

Quick Start

Create a multi-target module with shared code and use expect/actual to supply platform-specific implementations.

Frequently Asked Questions about kmp

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

FAQPage Schema
How do I share Kotlin code across Android, iOS, desktop, and web platforms?

You can share Kotlin code across Android, iOS, desktop, and web platforms by organizing shared logic into commonMain and using expect/actual declarations to supply platform-specific implementations. This approach reduces code duplication and maintenance across multi-target projects.

What are expect/actual declarations in Kotlin Multiplatform?

Expect/actual declarations in Kotlin Multiplatform are a mechanism where commonMain defines expected APIs, and platform-specific source sets provide actual implementations. This pattern lets you declare a common interface while supplying unique adapters for each target platform.

How do I configure Gradle for a Kotlin Multiplatform project?

Configuring Gradle for a Kotlin Multiplatform project involves setting up a clean source-set structure to support modularization and multi-target builds. You establish commonMain for shared code and configure platform modules to handle target-specific dependencies and compilation.

Can I implement a cross-platform repository with common domain models using Kotlin Multiplatform?

Yes, you can implement a cross-platform repository with common domain models using Kotlin Multiplatform. By placing shared domain logic in commonMain and using platform adapters via expect/actual, you create a unified repository structure across Android and iOS.

What is the best way to organize source sets in a Kotlin Multiplatform project?

The best way to organize source sets in a Kotlin Multiplatform project is to maintain a clean source-set structure centered on commonMain. This setup supports modularization, separates platform-specific implementations, and applies best practices for dependency injection and Gradle configuration.

Does Kotlin Multiplatform work for modularizing shared code across desktop and web targets?

Yes, Kotlin Multiplatform works for modularizing shared code across desktop and web targets. It supports multi-target projects by promoting commonMain patterns and clean source-set organization, allowing you to unify shared logic across Android, iOS, desktop, and web platforms.