kotlin-patterns

Apply idiomatic Kotlin patterns for null safety, immutability, and sealed classes.

Updated Mar 20, 2026
One-click install
npx skills add https://github.com/KanakMalpani/General-Private-Skills --skill kotlin-patterns-kanakmalpani
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-patterns
Source: https://github.com/KanakMalpani/General-Private-Skills/tree/main/skills/kotlin-patterns
Command: npx skills add https://github.com/KanakMalpani/General-Private-Skills --skill kotlin-patterns-kanakmalpani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Kotlin code often suffers from ambiguity and inconsistency when applying idiomatic patterns. This Skill provides a structured guide to adopt best practices for null safety, immutability, sealed hierarchies, and DSL builders, improving readability and maintainability.

Core Features & Use Cases

  • Enforces null-safety, immutability, and expressive type hierarchies (sealed classes) across codebases.
  • Provides guidance on structured concurrency with coroutines, and safe extension functions to enhance readability without sacrificing safety.
  • Use Case: when refactoring a Kotlin module to improve safety, readability, and modular design, apply the patterns to data models, services, and DSL builders to achieve consistent style.

Quick Start

Refactor a Kotlin file to apply idiomatic patterns such as data classes, sealed classes, and DSL builders.

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 to use idiomatic patterns like sealed classes and DSL builders?

Refactor Kotlin code by applying idiomatic patterns to data models, services, and DSL builders. This process enforces null safety, immutability, and expressive type hierarchies to achieve a consistent, maintainable codebase style.

What are the best practices for structured concurrency with Kotlin coroutines?

Best practices for Kotlin coroutines involve applying structured concurrency patterns and safe extension functions. This approach enhances code readability and maintainability without sacrificing safety during asynchronous operations.

How does null safety work with immutable data structures in Kotlin?

Null safety in Kotlin works by enforcing immutability and expressive type hierarchies across data structures. This eliminates ambiguity and inconsistency, ensuring safe data handling and improving overall code readability.

Can I use Gradle Kotlin DSL to improve maintainability across my codebase?

Yes, you can use Gradle Kotlin DSL to satisfy requirements for idiomatic patterns. Applying Gradle Kotlin DSL usage alongside sealed classes and extension functions improves consistency and maintainability across the project.

When do I need to use sealed classes in Kotlin?

You need to use sealed classes in Kotlin when designing expressive type hierarchies for data models. They enforce restricted class hierarchies, improving safety and allowing the compiler to handle exhaustive when-statements.

Why does my Kotlin code suffer from ambiguity when applying idiomatic patterns?

Kotlin code suffers from ambiguity when patterns are applied inconsistently. Adopting structured guides for null safety, immutability, and DSL builders resolves this by enforcing a consistent and readable codebase style.