kotlin-patterns

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

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/RUSHYOP/imperium-cli --skill kotlin-patterns-rushyop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-patterns
Source: https://github.com/RUSHYOP/imperium-cli/tree/main/content/skills/kotlin-patterns
Command: npx skills add https://github.com/RUSHYOP/imperium-cli --skill kotlin-patterns-rushyop

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing Kotlin code that is robust and maintainable requires adopting idiomatic patterns across null safety, concurrency, and API design.

Core Features & Use Cases

  • Null safety by default with safe-call and Elvis patterns
  • Immutability by default using data classes and copy
  • Structured concurrency with coroutines and flows
  • DSL builders and type-safe APIs for expressive libraries
  • Extension functions, sealed classes, and delegation for clean architecture
  • Use cases include refactoring modules, designing Kotlin libraries, and code reviews for patterns

Quick Start

Audit a Kotlin project and replace anti-patterns with idiomatic constructs to improve safety and readability.

Frequently Asked Questions about kotlin-patterns

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

FAQPage Schema
How do I apply idiomatic Kotlin patterns for null safety and immutability?

Idiomatic Kotlin patterns enforce null safety using safe-call and Elvis operators, while immutability is achieved by default through data classes and the copy function.

What is the best way to structure concurrency with Kotlin coroutines and Flow?

Structured concurrency in Kotlin is achieved using coroutines and Flow to manage asynchronous tasks safely, ensuring that background operations are properly scoped and canceled when no longer needed.

How do I build type-safe DSLs in Kotlin for library design?

Type-safe DSLs in Kotlin are built using extension functions and lambda receivers, allowing you to create expressive, structured APIs for library consumers with strict compile-time constraints.

When do I need sealed classes and extension functions in Kotlin architecture?

Sealed classes represent constrained type hierarchies, and extension functions add behavior without inheritance, yielding clean architecture when modeling fixed states and augmenting external libraries.

Can I use these Kotlin patterns to refactor existing projects?

Yes, you can audit existing Kotlin projects and replace anti-patterns with idiomatic constructs like data classes and structured concurrency to improve code safety and readability.

Does this approach cover code reviews for Kotlin best practices?

Yes, applying these idiomatic patterns during code reviews helps verify null-safety, structured concurrency, and type-safe DSL design requirements across typical projects and libraries.