Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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…

HoangNguyen0403от HoangNguyen0403★ 598 звёзд на GitHub

Об этом скилле

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 as val state = _state.asStateFlow() (public read-only). Pattern: _prop private, prop public. On Kotlin 2.4+ an explicit backing field (val state: StateFlow<…> field = MutableStateFlow(…)) is a stable alternative — see Kotlin 2.4 features. Keep the _prop idiom for older languageVersions.
  • Collections: Expose List/Map (read-only) publicly; keep MutableList internal.
  • Error Handling: Use runCatching for simple, non-suspending recovery over try/catch. In coroutines it also catches CancellationException — rethrow it before mapping a failure (see kotlin-coroutines).
  • Visibility: Default to private or internal. Minimize public surface area.
  • Top-Level: Prefer top-level functions/constants over implementation-less object singletons.

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

Установить kotlin-best-practices в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/evals.jsonreferences/example.mdreferences/kotlin-2.4.md

FAQ

Что делает скилл 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.

Как установить скилл kotlin-best-practices?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл kotlin-best-practices запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить kotlin-best-practices с