Agent Skillschrisbanes/skills › kotlin-api-design

kotlin-api-design

GitHub

提供Kotlin API设计指南,涵盖函数归属、值类、多平台边界及密封结果映射的决策流程。用于指导开发者在设计或审查Kotlin代码时,选择最合适的类型和函数所有权,确保领域语义清晰且平台细节隔离。

skills/kotlin-api-design/SKILL.md chrisbanes/skills

Trigger Scenarios

设计Kotlin函数归属 审查Kotlin API设计 处理Kotlin多平台边界 定义值类或数据类

Install

npx skills add chrisbanes/skills --skill kotlin-api-design -g -y
More Options

Use without installing

npx skills use chrisbanes/skills@kotlin-api-design

指定 Agent (Claude Code)

npx skills add chrisbanes/skills --skill kotlin-api-design -a claude-code -g -y

安装 repo 全部 skill

npx skills add chrisbanes/skills --all -g -y

预览 repo 内 skill

npx skills add chrisbanes/skills --list

SKILL.md

Frontmatter
{
    "name": "kotlin-api-design",
    "description": "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

  1. Name the domain concept, its owning type or module, and the callers that need to depend on it.
  2. Choose function ownership before adding an extension, factory, helper, or service layer.
  3. 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.
  4. Represent a single-field domain concept with the smallest type that preserves its semantic and interop contract.
  5. Keep shared code semantic; put native SDK and platform details behind an interface or a narrowly justified expect/actual boundary.
  6. Read the focused reference for the selected decision below.
  7. 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

Version History

  • 2026.8.24 Current 2026-08-27 17:15

    简化指令冗长度;增强评估覆盖度及Gradle工作流证据处理。

  • 2026.8.5 2026-08-16 02:44

Same Skill Collection

skills/compose-animations/SKILL.md
skills/compose-component-design/SKILL.md
skills/compose-focus-navigation/SKILL.md
skills/compose-modifier-and-layout-style/SKILL.md
skills/compose-performance/SKILL.md
skills/compose-recomposition-performance/SKILL.md
skills/compose-side-effects/SKILL.md
skills/compose-slot-api-pattern/SKILL.md
skills/compose-stability-diagnostics/SKILL.md
skills/compose-state-and-effects/SKILL.md
skills/compose-state-authoring/SKILL.md
skills/compose-state-deferred-reads/SKILL.md
skills/compose-state-hoisting/SKILL.md
skills/compose-state-holder-ui-split/SKILL.md
skills/compose-ui-testing-patterns/SKILL.md
skills/gradle-run/SKILL.md
skills/grounded-writing/SKILL.md
skills/implement-issue/SKILL.md
skills/kotlin-concurrency-and-flow/SKILL.md
skills/kotlin-control-flow/SKILL.md
skills/kotlin-coroutines-structured-concurrency/SKILL.md
skills/kotlin-flow-state-event-modeling/SKILL.md
skills/kotlin-functions/SKILL.md
skills/kotlin-multiplatform-expect-actual/SKILL.md
skills/kotlin-types-value-class/SKILL.md
skills/release-kotlin-library/SKILL.md
skills/run-github-project/SKILL.md
skills/shepherd/SKILL.md
skills/to-plan/SKILL.md
skills/using-chrisbanes-skills/SKILL.md
skills/implement-with-subagents/SKILL.md

Metadata

Files
0
Version
2026.9.2
Hash
49bc11f0
Indexed
2026-08-16 02:44

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-09 06:36
浙ICP备14020137号-1 $mapa de visitantes$