Kotlin Coding Practices
Application skill for Kotlin style learning (from the archived awesome-guidelines style capsules). For Android/Compose/KMP stack patterns, load stack capsules in skills/*-foundation.
Core Principle
Kotlin readability is official formatter mechanics plus immutability-first idioms, explicit imports, semantic class layout, stable library surfaces.
When to Use / NOT
- Kotlin JVM/KMP/application/library source, ktlint/detekt CI.
- Reviewing naming, formatting, class organization, public API.
NOT when:
- Non-Kotlin code.
- Generated code, validate generators, not hand-edits.
- Compose/Android-only rules, use Android style guide / foundation when stack is Android.
Workflow
- Format & layout, 4-space, braces, modifiers, trailing commas (
kotlin-style-formatting-layout.md).
- Naming & files, packages, files, constants, backing props (
kotlin-style-naming-files.md).
- Organization, directories, class layout, overloads (
kotlin-style-organization-classes.md).
- Idioms & API, val, defaults, expression control flow, library KDoc (
kotlin-style-idioms-api.md).
- Verify, ktlint/detekt +
./gradlew check (or project equivalent) on changed modules.
Red Flags
- Wildcard imports
- Tabs or inconsistent indent
var when never reassigned
- Mutable collection types in public API parameters
- Overloads instead of default parameters
Util.kt / meaningless file names
- Binary
when instead of if
- Public API without return types (libraries)
Verification
- ktlint/detekt on changed files
- Compile + tests for touched modules
- Capsule checklist on public API review
References
awesome-guidelines/references/kotlin-style-learning-note.md
awesome-guidelines/references/kotlin-style-formatting-layout.md
awesome-guidelines/references/kotlin-style-naming-files.md
awesome-guidelines/references/kotlin-style-organization-classes.md
awesome-guidelines/references/kotlin-style-idioms-api.md
1---2name: kotlin-coding-practices3description: Use when authoring or reviewing Kotlin, 4-space layout, PascalCase/camelCase naming, package-aligned files, class member order, val immutability, default parameters, expression if/when, and explicit library API.4---56# Kotlin Coding Practices78Application skill for Kotlin style learning (from the archived `awesome-guidelines` style capsules). For Android/Compose/KMP stack patterns, load stack capsules in `skills/*-foundation`.910## Core Principle1112Kotlin readability is **official formatter mechanics plus immutability-first idioms**, explicit imports, semantic class layout, stable library surfaces.1314## When to Use / NOT1516- Kotlin JVM/KMP/application/library source, ktlint/detekt CI.17- Reviewing naming, formatting, class organization, public API.1819**NOT when:**2021- Non-Kotlin code.22- Generated code, validate generators, not hand-edits.23- Compose/Android-only rules, use Android style guide / foundation when stack is Android.2425## Workflow26271. **Format & layout**, 4-space, braces, modifiers, trailing commas (`kotlin-style-formatting-layout.md`).282. **Naming & files**, packages, files, constants, backing props (`kotlin-style-naming-files.md`).293. **Organization**, directories, class layout, overloads (`kotlin-style-organization-classes.md`).304. **Idioms & API**, val, defaults, expression control flow, library KDoc (`kotlin-style-idioms-api.md`).315. **Verify**, ktlint/detekt + `./gradlew check` (or project equivalent) on changed modules.3233## Red Flags3435- Wildcard imports36- Tabs or inconsistent indent37- `var` when never reassigned38- Mutable collection types in public API parameters39- Overloads instead of default parameters40- `Util.kt` / meaningless file names41- Binary `when` instead of `if`42- Public API without return types (libraries)4344## Verification4546- ktlint/detekt on changed files47- Compile + tests for touched modules48- Capsule checklist on public API review495051## References5253- `awesome-guidelines/references/kotlin-style-learning-note.md`54- `awesome-guidelines/references/kotlin-style-formatting-layout.md`55- `awesome-guidelines/references/kotlin-style-naming-files.md`56- `awesome-guidelines/references/kotlin-style-organization-classes.md`57- `awesome-guidelines/references/kotlin-style-idioms-api.md`