This skill may not reflect the latest upstream change
Next.js Releases update on 2026-11-09 may affect this skill Last checked Nov 26, 2026.
Kotlin Best Practices
Core Kotlin patterns for scope functions, backing properties, and read-only collection interfaces. Use for let/apply/run/also/with choices or encapsulating mutable state; defer general language constructs, extension functions, coroutines/runCatching, Android/Room recipes, and testing/tooling setup.
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install multi-language-standards-kotlin-best-practicesManual setup by platform
Claude Code
~/.claude/skills/multi-language-standards-kotlin-best-practices/SKILL.md
Instructions
Kotlin Best Practices
Priority: P1 (HIGH)
Implementation Guidelines
- Scope Functions:
apply: Object configuration (returns object).also: Side effects / validation / logging (returns object).let: Null checks (?.let) or mapping (returns result).run: Object configuration and mapping (returns result).with: Grouping multiple method calls on object (returns result).- Backing Properties: Use
_state(private mutable, e.g.,private val _state = MutableStateFlow(initial)) exposed asval state = _state.asStateFlow()(public read-only). Pattern:_propprivate,proppublic. On Kotlin 2.4+ an explicit backing field (val state: StateFlow<…> field = MutableStateFlow(…)) is a stable alternative — see Kotlin 2.4 features. Keep the_propidiom for olderlanguageVersions. - Collections: Expose
List/Map(read-only) publicly; keepMutableListinternal. - Error Handling: Use
runCatchingfor simple, non-suspending recovery over try/catch. In coroutines it also catchesCancellationException— rethrow it before mapping a failure (see kotlin-coroutines). - Visibility: Default to
privateorinternal. Minimizepublicsurface area. - Top-Level: Prefer top-level functions/constants over implementation-less
objectsingletons.
Anti-Patterns
- No Deep Scope Nesting: Limit let/apply nesting to 2 levels; deeper destroys readability.
- No Public var: Use private set or backing properties for encapsulation.
- No Global Mutable State: Avoid mutable top-level variables.
References
- Backing Property & Scope Function Examples
- Kotlin 2.4 Gated Features — load only for 2.4+ projects
Security
Reviews (0)
Related skills
Browse all →More from Multi-Language Standards
View source →More Build skills
Browse category →Frequently asked questions about kotlin-best-practices
What does the kotlin-best-practices skill do?
Core Kotlin patterns for scope functions, backing properties, and read-only collection interfaces. Use for let/apply/run/also/with choices or encapsulating mutable state; defer general language constructs, extension functions, coroutines/runCatching, Android/Room recipes, and testing/tooling setup. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the kotlin-best-practices skill?
Run `npx @skills-hub-ai/cli install multi-language-standards-kotlin-best-practices` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/multi-language-standards-kotlin-best-practices/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does kotlin-best-practices work with?
kotlin-best-practices runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the kotlin-best-practices skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use kotlin-best-practices after installing it?
In Claude Code, type `/multi-language-standards-kotlin-best-practices` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the kotlin-best-practices skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.