Use when designing or reviewing Kotlin function ownership, member or extension functions, factories, single-field domain types, value classes, data classes, Kotlin Multiplatform expect/actual declarations, or platform service boundaries.
Start a fresh conversation. Replace the highlighted placeholders.
Use kotlin-api-design to review [Kotlin API or module] and recommend an ownership-focused public API design, including explicit sealed-result outcomes and appropriate platform boundaries.
Required inputs
[Kotlin API or module]
User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗
SKILL.md
name: kotlin-api-designdescription: Use when designing or reviewing Kotlin function ownership, member or extension functions, factories, single-field domain types, value classes, data classes, Kotlin Multiplatform expect/actual declarations, or platform service boundaries.
Kotlin API design
Core principle
Place behavior, types, and platform seams where their meaning is clearest to
callers; use the smallest public abstraction that preserves domain language and
platform independence.
Procedure
Name the domain concept, its owning type or module, and the callers that
need to depend on it.
Choose function ownership before adding an extension, factory, helper, or
service layer. When rejecting one, name the owner callers should use instead.
When reviewing a public mapping over a sealed result, name every
caller-visible outcome. Flag a catch-all else that hides a subtype and
recommend explicit subtype branches so the contract stays exhaustive and
preserves smart casts.
Represent a single-field domain concept with the smallest type that preserves
its semantic and interop contract.
Keep shared code semantic; put native SDK and platform details behind an
interface or a narrowly justified expect/actual boundary.
Read the focused reference for the selected decision below.
Finish when the public surface states domain intent, platform details remain
at leaves, and callers do not depend on convenience abstractions with no
clear owner.
Topic router
Signal
Read
Member vs top-level, extension, factory, service, or receiver choice