Skip to content
kotlin-multiplatform-reviewer logo

Kotlin Multiplatform Reviewer Skill

kotlin-multiplatform-reviewer

WHEN: Kotlin Multiplatform (KMP) project review, expect/actual patterns, shared module structure, iOS interop WHAT: Module structure analysis + expect/actual validation + platform separation + iOS/Android interop + dependency management WHEN NOT: Android UI → kotlin-android-reviewer, Server → kot...

SKILL.md

Full skill instructions

Kotlin Multiplatform Reviewer Skill

Purpose

Reviews Kotlin Multiplatform (KMP) project structure and patterns including shared code design, expect/​actual mechanism, and iOS interop.

When to Use

  • KMP project code review
  • "expect/​actual", "shared module", "commonMain", "multiplatform" mentions
  • iOS/​Android code sharing design review
  • Projects with kotlin("multiplatform") plugin

Project Detection

  • kotlin("multiplatform") plugin in build.gradle.kts
  • src/​commonMain, src/​androidMain, src/​iosMain directories
  • shared or common module exists

Workflow

Step 1: Analyze Structure

**Kotlin**: 2.0.x
**Targets**: Android, iOS (arm64, simulatorArm64)
**Shared Module**: shared
**Source Sets**:
  - commonMain (shared code)
  - androidMain (Android specific)
  - iosMain (iOS specific)

Step 2: Select Review Areas

AskUserQuestion:

"Which areas to review?"
Options:
- Full KMP pattern check (recommended)
- Module structure/​dependencies
- expect/​actual implementation
- Platform code separation
- iOS interop (Swift/​ObjC)
multiSelect: true

Detection Rules

Module Structure

CheckRecommendationSeverity
Bloated shared moduleSplit by layerMEDIUM
Circular dependenciesUnidirectional depsHIGH
Platform code in commonMainMove to androidMain/​iosMainHIGH
Missing test moduleAdd commonTestMEDIUM

Recommended Structure:

project/
├── shared/
│   └── src/
│       ├── commonMain/​kotlin/    # Shared business logic
│       ├── commonTest/​kotlin/    # Shared tests
│       ├── androidMain/​kotlin/   # Android specific
│       ├── iosMain/​kotlin/       # iOS specific
│       └── iosTest/​kotlin/
├── androidApp/                    # Android app
└── iosApp/                       # iOS app (Xcode)

expect/​actual Patterns

CheckRecommendationSeverity
actual without expectexpect declaration requiredCRITICAL
Missing actual implProvide actual for all targetsCRITICAL
Excessive expect/​actualConsider interface + DIMEDIUM
Direct platform API in actualAdd abstraction layerMEDIUM
// commonMain - expect declaration
expect class Platform() {
    val name: String
    fun getDeviceId(): String
}

// androidMain - actual implementation
actual class Platform actual constructor() {
    actual val name: String = "Android ${Build.VERSION.SDK_INT}"
    actual fun getDeviceId(): String = Settings.Secure.getString(
        context.contentResolver,
        Settings.Secure.ANDROID_ID
    )
}

// iosMain - actual implementation
actual class Platform actual constructor() {
    actual val name: String = UIDevice.currentDevice.systemName()
    actual fun getDeviceId(): String = UIDevice.currentDevice
        .identifierForVendor?.UUIDString ?: ""
}

BAD: expect/​actual overuse

// BAD: expect/​actual for simple values
expect val platformName: String
actual val platformName: String = "Android"

// GOOD: interface + DI
interface PlatformInfo {
    val name: String
}

// androidMain
class AndroidPlatformInfo : PlatformInfo {
    override val name = "Android"
}

Platform Separation

CheckRecommendationSeverity
Platform import in commonMainMove to platform source setCRITICAL
Java class in commonMainexpect/​actual or pure KotlinHIGH
UIKit/​Android SDK in commonSeparate to platform source setCRITICAL
// BAD: Android import in commonMain
// commonMain/​kotlin/​Repository.kt
import android.content.Context  // Compile error!

// GOOD: expect/​actual separation
// commonMain
expect class DataStore {
    fun save(key: String, value: String)
    fun get(key: String): String?
}

// androidMain
actual class DataStore(private val context: Context) {
    private val prefs = context.getSharedPreferences("app", Context.MODE_PRIVATE)
    actual fun save(key: String, value: String) {
        prefs.edit().putString(key, value).apply()
    }
    actual fun get(key: String): String? = prefs.getString(key, null)
}

// iosMain
actual class DataStore {
    actual fun save(key: String, value: String) {
        NSUserDefaults.standardUserDefaults.setObject(value, key)
    }
    actual fun get(key: String): String? =
        NSUserDefaults.standardUserDefaults.stringForKey(key)
}

iOS Interop

CheckRecommendationSeverity
Missing @ObjCNameSwift-friendly namingLOW
Sealed class iOS exposureUse enum or @ObjCNameMEDIUM
Direct Flow exposure to iOSProvide wrapper functionHIGH
suspend function iOS callProvide completion handler wrapperHIGH
// BAD: Direct suspend function exposure
class Repository {
    suspend fun fetchData(): Data  // Hard to call from iOS
}

// GOOD: iOS wrapper provided
class Repository {
    suspend fun fetchData(): Data

    // iOS completion handler wrapper
    fun fetchDataAsync(completion: (Data?, Error?) -> Unit) {
        MainScope().launch {
            try {
                val data = fetchData()
                completion(data, null)
            } catch (e: Exception) {
                completion(null, e)
            }
        }
    }
}

Flow iOS Exposure:

// BAD: Direct Flow exposure
val dataFlow: Flow<Data>

// GOOD: iOS wrapper
fun observeData(onEach: (Data) -> Unit): Closeable {
    val job = MainScope().launch {
        dataFlow.collect { onEach(it) }
    }
    return object : Closeable {
        override fun close() { job.cancel() }
    }
}

Dependency Management

CheckRecommendationSeverity
Platform library in commonMainUse multiplatform libraryHIGH
Version mismatchUse Version CatalogMEDIUM
Unused dependenciesRemove unusedLOW

Multiplatform Library Recommendations:

PurposeLibrary
HTTPKtor Client
SerializationKotlinx Serialization
AsyncKotlinx Coroutines
DIKoin, Kodein
Date/​TimeKotlinx Datetime
SettingsMultiplatform Settings
LoggingNapier, Kermit
DBSQLDelight

Response Template

## KMP Project Review Results

**Project**: [name]
**Kotlin**: 2.0.x
**Targets**: Android, iOS (arm64, simulatorArm64)

### Module Structure
| Status | Item | Issue |
|--------|------|-------|
| OK | Source set separation | commonMain/​androidMain/​iosMain correct |
| MEDIUM | Tests | Add commonTest recommended |

### expect/​actual
| Status | File | Issue |
|--------|------|-------|
| OK | Platform.kt | expect/​actual correctly implemented |
| HIGH | DataStore.kt | Missing iosMain actual implementation |

### iOS Interop
| Status | Item | Issue |
|--------|------|-------|
| HIGH | Repository.kt | suspend function needs iOS wrapper |
| MEDIUM | UiState.kt | Add @ObjCName to sealed class |

### Recommended Actions
1. [ ] Add DataStore iosMain actual implementation
2. [ ] Add completion handler wrapper to fetchData()
3. [ ] Add commonTest source set

Best Practices

  1. Share Scope: Business logic > Data layer > UI (optional)
  2. expect/​actual: Minimize usage, prefer interface + DI
  3. iOS Interop: Use SKIE library or manual wrappers
  4. Testing: Test shared logic in commonTest
  5. Dependencies: Prefer multiplatform libraries

Integration

  • kotlin-android-reviewer skill: Android specific code
  • kotlin-spring-reviewer skill: Server shared code
  • code-reviewer skill: General code quality

Notes

  • Based on Kotlin 2.0+
  • KMP 1.9.20+ recommended (Stable)
  • Compose Multiplatform requires separate review

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View