Kotlin API Design
Communitychrisbanes
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.
Overview
- Repository
- chrisbanes/skills
- Publisher
- chrisbanes
- Stars
- 1.2K
- Forks
- 58
- Bundled files
- 3
- License
- Apache-2.0
- Updated
- Nov 14, 2026
Installation
tmp=$(mktemp -d)
git clone --depth 1 https://github.com/chrisbanes/skills.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/skills/kotlin-api-design" ~/.claude/skills/kotlin-api-design
rm -rf "$tmp"tmp=$(mktemp -d)
git clone --depth 1 https://github.com/chrisbanes/skills.git "$tmp"
mkdir -p ~/.codex/skills
cp -R "$tmp/skills/kotlin-api-design" ~/.codex/skills/kotlin-api-design
rm -rf "$tmp"Install the Kotlin API Design agent skill from https://github.com/chrisbanes/skills/tree/main/skills/kotlin-api-design into this project's skills folder.Instructions
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
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 |
Bundled files
FAQ
What does Kotlin API Design do?
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.
Who made Kotlin API Design?
chrisbanes (a community member) publishes it in the chrisbanes/skills repository on GitHub.
Is Kotlin API Design free?
Yes. Kotlin API Design is open source, published by chrisbanes under the Apache-2.0 license.
What comes with Kotlin API Design?
Its instructions and 3 files the agent reads only when a task needs them, such as references, examples or scripts.
Which agents can use Kotlin API Design?
Any coding agent that reads SKILL.md files, including Claude Code, Codex, Cursor, GitHub Copilot and Gemini CLI. The agent loads the skill when a task matches its description.
What are agent skills?
An agent skill is a folder with a SKILL.md file: instructions that teach a coding agent how to do one kind of task, and optionally files it can read while it works. The agent keeps only the skill's name and description in mind and reads the rest when a task calls for it.
How are agent skills different from MCP servers?
An MCP server gives an agent new tools to call, code that runs somewhere and returns results. A skill gives it knowledge: how to approach a task with the tools it already has. Many agents use both.
How can my agent test my Android app?
Robomori lets coding agents create, start and control Android emulators and devices from one command, so they can install your app, take screenshots and check dark mode, font sizes and languages.