kotlin-patterns

Enforce idiomatic Kotlin patterns for null safety and structured coroutine concurrency.

Updated May 9, 2026
One-click install
npx skills add https://github.com/kk20300113-png/my-claude-skills --skill kotlin-patterns-kk20300113-png
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-patterns
Source: https://github.com/kk20300113-png/my-claude-skills/tree/main/kotlin-patterns
Command: npx skills add https://github.com/kk20300113-png/my-claude-skills --skill kotlin-patterns-kk20300113-png

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of writing inconsistent, error-prone Kotlin code that fails to leverage the language's native safety and concurrency features, leading to bugs, technical debt, and difficult maintenance.

Core Features & Use Cases

  • Idiomatic Kotlin Conventions: Enforces best practices for null safety, immutability, data classes, and sealed type hierarchies.
  • Concurrency & DSL Patterns: Provides guidance for structured coroutine concurrency, Flow reactive streams, and type-safe DSL builders.
  • Build & Error Handling: Covers Gradle Kotlin DSL configuration and idiomatic error handling with Result types and preconditions.
  • Use Case: When building a Kotlin backend service, use this Skill to implement safe, maintainable async data fetching with coroutines and sealed Result classes for error handling.

Quick Start

Use the kotlin-patterns skill to refactor your existing Kotlin user service to use immutable data classes and sealed Result types for consistent error handling.

Frequently Asked Questions about kotlin-patterns

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

FAQPage Schema
How do I write idiomatic Kotlin code with proper null safety and immutability?

Idiomatic Kotlin code leverages built-in null safety features and enforces standards for immutable data modeling using data classes. You should use sealed class hierarchies and delegation patterns to ensure robust, maintainable structures.

What's the best way to handle concurrency in Kotlin using coroutines and Flow?

The best way to handle Kotlin concurrency is through structured coroutine concurrency and Flow reactive streams. This approach provides safe, maintainable asynchronous data fetching and eliminates error-prone threading issues.

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

Type-safe DSL builders in Kotlin are implemented using idiomatic delegation patterns and function literals with receiver. This ensures robust configuration and eliminates inconsistent API design.

How do I configure Gradle Kotlin DSL for my build setup?

Configuring Gradle Kotlin DSL involves applying idiomatic Kotlin conventions to your build scripts. This provides type-safe build configuration and enforces consistent error handling with Result types and preconditions.

How do I refactor existing Kotlin code to use sealed Result classes for error handling?

Refactoring Kotlin code to use sealed Result classes involves replacing traditional exception-based error handling with sealed type hierarchies. This enforces idiomatic error handling and consistent data fetching workflows.

Does this Kotlin refactoring approach work for backend service development?

Yes, this Kotlin refactoring approach works for backend service development by implementing safe, maintainable async data fetching. It leverages coroutines and sealed Result classes to eliminate technical debt.