kotlin-best-practices

Applies opinionated Kotlin type, API, and coroutine discipline when editing .kt and .kts files.

1|Updated Aug 26, 2026
One-click install
npx skills add https://github.com/edivad1999/stuc-stack --skill kotlin-best-practices-edivad1999
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kotlin-best-practices
Source: https://github.com/edivad1999/stuc-stack/tree/main/skills/kotlin-best-practices
Command: npx skills add https://github.com/edivad1999/stuc-stack --skill kotlin-best-practices-edivad1999

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Kotlin codebases accumulate inconsistent type usage, ad-hoc coroutine patterns, and layering violations when multiple contributors or agents edit code without shared conventions. This Skill enforces a consistent set of opinionated Kotlin rules and routes each concern to the correct upstream chrisbanes skill cluster. ## Core Features & Use Cases - Fail-closed routing to upstream skills: Maps concerns like Flow/StateFlow, exhaustive when, KMP boundaries, and Gradle runs to named chrisbanes skills, stopping with an install command if they are missing. - Opinionated overlays: Enforces rules such as app/UI modules never importing data-layer DTOs, LiveData-to-StateFlow migration, named boolean parameters with safe defaults, and a single JSON serialization stack. - Use Case: While refactoring an Android screen that still uses LiveData, the Skill directs the agent to load kotlin-concurrency-and-flow, migrate to StateFlow, and finish with a real Gradle assemble to verify the change. ## Quick Start Ask the agent to review or edit a Kotlin file using the kotlin-best-practices skill, for example to migrate a LiveData-based screen to StateFlow.

Frequently Asked Questions about kotlin-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate LiveData to StateFlow in an Android Kotlin project?▼

Migrate LiveData to StateFlow when touching a screen that still uses LiveData, including result wrappers if the project has them. The Skill routes this work to the chrisbanes kotlin-concurrency-and-flow cluster for stateIn, scopes, and cancellation rules.

What Kotlin skills handle coroutines, Flow, and API design?▼

Coroutines and Flow concerns route to chrisbanes kotlin-concurrency-and-flow, while types, signatures, expect/actual, and value classes route to kotlin-api-design. This Skill adds opinionated overlays on top without duplicating those clusters.

Can app modules import data-layer DTOs or entities in Kotlin?▼

No. App and UI modules must never import data-layer DTOs or entities; domain models and interfaces stay on the app-facing side while the data layer maps and implements repositories. New app-to-data model imports are rejected.

What happens if the required chrisbanes skills are not installed?▼

The Skill fails closed: if a named chrisbanes skill does not resolve, it stops and prints the install command `npx skills add chrisbanes/skills` instead of proceeding without the upstream guidance.

Which JSON serialization library should new Kotlin code use?▼

New Kotlin JSON code uses kotlinx.serialization as the default destination, and only one JSON stack is allowed per project. Shared serializers live in the module that already owns them, and a second serializer must not be added beside the house stack.