kotlin-coding-standards

Applies Kotlin coding standards covering null safety, coroutines, delegation, and testing patterns.

4|Updated Mar 28, 2026
One-click install
npx skills add https://github.com/minexo79/coser-card-maker --skill kotlin-coding-standards-minexo79
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-coding-standards
Source: https://github.com/minexo79/coser-card-maker/tree/main/.kilo/skills/coding-standards/kotlin
Command: npx skills add https://github.com/minexo79/coser-card-maker --skill kotlin-coding-standards-minexo79

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Writing idiomatic Kotlin requires consistent decisions about null safety, coroutine usage, scope functions, and testing structure, and teams often lack a single reference that enforces these conventions across JVM and Android projects. ## Core Features & Use Cases - Idiomatic Kotlin Patterns: Provides quick-reference and in-depth guidance on null safety, scope functions, data classes, sealed classes, coroutines, Flow, and delegation. - Testing Standards: Includes JUnit 5, MockK, coroutines test dispatchers, and Turbine Flow testing patterns with concrete examples. - Static Analysis Setup: Ships a complete detekt.yml configuration and ktlint integration guidance, plus a script that scaffolds a full Gradle Kotlin project with testing and linting preconfigured. - Use Case: When starting a new Kotlin service, run the setup script to generate a Gradle project with detekt, ktlint, JUnit 5, and MockK already wired, then follow the standards guide while implementing coroutine-based features. ## Quick Start Ask the assistant to set up a new Kotlin project with coroutines, testing, and detekt using this skill's setup script and coding standards.

Frequently Asked Questions about kotlin-coding-standards

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

FAQPage Schema
How do I handle null safety in Kotlin without using the !! operator?

Use safe calls (?.) to chain nullable access, the Elvis operator (?:) to supply defaults, and safe casts (as?) for type conversion. Smart casts apply automatically after null checks, and early returns keep non-null flows explicit.

How to test Kotlin coroutines and Flows with JUnit 5?

Use runTest from kotlinx-coroutines-test with a StandardTestDispatcher, and set Dispatchers.setMain in setup for ViewModel tests. For Flows, use Turbine's test block with awaitItem and awaitComplete to assert emissions in order.

What is the difference between StateFlow and SharedFlow in Kotlin?

StateFlow always holds a current value and replays the latest emission to new collectors, making it suited for UI state. SharedFlow has no initial value and is used for one-shot events like error messages or navigation signals.

How do I configure detekt and ktlint for a Kotlin project?

Apply the detekt and ktlint Gradle plugins, point detekt at a detekt.yml config file, and enable rules for complexity, naming, coroutines, and exceptions. The included setup script generates a project with both tools preconfigured.

When should I use Kotlin scope functions like let, apply, and also?

Use let for null checks and transformations, apply for configuring an object and returning it, also for side effects like logging, and run or with when combining configuration with a computed result. Choosing by receiver type and return value keeps code readable.

Does this Kotlin setup work with Spring Boot and WebFlux?

Yes, the reference includes Spring Boot patterns such as coroutine-based REST controllers, JdbcTemplate repositories, and WebFlux functional routers using coRouter with suspend handler functions.