kotlin-patterns

Apply idiomatic Kotlin patterns for null safety, coroutines, and DSL builders.

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/emiled16/close-to-me --skill kotlin-patterns-emiled16
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-patterns
Source: https://github.com/emiled16/close-to-me/tree/main/.codex/skills/kotlin-patterns
Command: npx skills add https://github.com/emiled16/close-to-me --skill kotlin-patterns-emiled16

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write, review, and refactor Kotlin code that is safer, more readable, and easier to maintain by applying proven language idioms instead of ad hoc patterns.

Core Features & Use Cases

  • Null Safety and Immutability: Encourages safe calls, Elvis handling, data classes, value classes, and val-first design.
  • Coroutines and Flow: Guides structured concurrency, cancellation-aware code, and reactive stream composition.
  • DSLs and Build Configuration: Supports type-safe builders, extension functions, delegation, and Gradle Kotlin DSL usage.
  • Use Case: Use this Skill when modernizing a Kotlin service, reviewing repository code, or shaping a new module to follow concise and production-ready Kotlin conventions.

Quick Start

Use this skill to review my Kotlin code for idiomatic null safety, coroutines, DSL builders, and maintainable architecture patterns.

Frequently Asked Questions about kotlin-patterns

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

FAQPage Schema
How do I refactor Kotlin code for better null safety and immutability?

Refactoring Kotlin code for null safety involves applying safe calls, Elvis operators, data classes, value classes, and val-first design to enforce immutability and reduce runtime exceptions.

What is structured concurrency in Kotlin coroutines and how do I use it?

Structured concurrency in Kotlin coroutines ensures cancellation-aware code and reactive stream composition through Flow, guiding reactive flows to prevent memory leaks and manage asynchronous tasks safely.

How do I write type-safe DSL builders in Kotlin?

Writing type-safe DSL builders in Kotlin uses extension functions and delegation to create concise, readable APIs, and applies the same principles for maintainable Gradle Kotlin DSL configuration.

What is the best way to handle exhaustive error handling with Kotlin sealed types?

The best way to handle exhaustive error handling with Kotlin sealed types is using exhaustive when-expressions to ensure all possible subtypes are covered, producing maintainable and robust JVM application logic.

Can I use idiomatic Kotlin patterns for reviewing existing service logic?

You can use idiomatic Kotlin patterns when reviewing existing service logic to modernize code, enforce structured concurrency, and verify adherence to production-ready conventions for robust JVM development.

Why does my Gradle Kotlin DSL configuration lack type safety?

Gradle Kotlin DSL configuration lacks type safety when not utilizing idiomatic extension functions and type-safe builders, which are required to enforce structured, maintainable build conventions.