About kotlin-api-design
A Kotlin API design skill for developers choosing where behavior, types, and platform-specific details belong. It provides decision procedures for function ownership, value types, multiplatform boundaries, and control flow.
Key features
- 01Place domain concepts with clear owners
- 02Choose appropriate function ownership
- 03Check exhaustive sealed-result mappings
- 04Design semantically precise single-field types
- 05Isolate platform and native SDK details
Use cases
- 01Review ownership of extensions or factories
- 02Design a single-field domain type
- 03Separate shared code from platform implementations
- 04Check sealed-type branch completeness
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ chrisbanes/ skills --skill kotlin-api-designAfter installing, type/kotlin-api-designin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/functions.mdmultiplatform-boundaries.mdvalue-classes.mdDetails
From the project READMEKotlin 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
elsethat 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 | Function ownership |
Primitive obsession, one-field domain type, @JvmInline value class, data class, interop, or Compose stability | Value classes |
| Source sets, platform services, native SDKs, files, sensors, permissions, Compose Multiplatform interop, or expect/actual | Multiplatform boundaries |
Branching, guard-condition shape, sealed-result mapping, or a catch-all else | Kotlin control flow |
Comments
Markdown supported