AGENTS.kmp.md โ Kotlin Multiplatform shared code
Additive to ../AGENTS.md and AGENTS.kotlin.md. Applies to shared/ (or
your KMP module).
Rules
commonMaincontains no platform APIs. If you reach forjava.*,android.*,Foundation, orNSObject, you are in the wrong source set.expect/actualpairs land together, in the same PR, with both platform implementations. Never merge anexpectwith oneactual.- Serialization is kotlinx.serialization with explicit
@SerialNameon every field that crosses the wire. Do not rely on property names โ a rename becomes a production bug. - Public shared API is designed for both callers: no Kotlin-only constructs in signatures that Swift will consume awkwardly (default args, sealed hierarchies without a mapped enum, suspend functions without a callback wrapper where needed).
- Any change to shared model shapes is a Kitchen change: two platforms and a server contract are downstream.
Check
./gradlew :shared:allTests
./gradlew :shared:linkDebugFrameworkIosSimulatorArm64 # catches Swift-facing breakage early