kotlin-patterns

Review Kotlin code for null safety, coroutine structure, and idiomatic patterns.

2|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/Zenobia000/ai-brainstorming --skill kotlin-patterns-zenobia000
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kotlin-patterns
Source: https://github.com/Zenobia000/ai-brainstorming/tree/main/.claude/custom-rule%26skill/skills/kotlin-patterns
Command: npx skills add https://github.com/Zenobia000/ai-brainstorming --skill kotlin-patterns-zenobia000

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the frustration of writing inconsistent, error-prone Kotlin code that suffers from null pointer exceptions, unstructured coroutine leaks, and non-idiomatic patterns that reduce maintainability for solo developers and engineering teams building production Kotlin applications.

Core Features & Use Cases

  • Idiomatic Core Conventions: Enforces best practices for null safety, immutability via val and data class copy(), and value classes for type-safe wrappers with zero runtime overhead.
  • Advanced Type & Concurrency Patterns: Provides proven templates for sealed class/interface hierarchies for exhaustive type handling, structured coroutine concurrency with async/await, and cold reactive Flow streams.
  • DSL & Build Tooling Guidance: Includes type-safe DSL builder patterns using @DslMarker and idiomatic Gradle Kotlin DSL configuration examples for maintainable build scripts.
  • Use Case: A backend developer building a Ktor service can use this Skill to implement structured coroutine scopes for concurrent user and post data fetching, eliminate force-unwrapping of nullable types, and set up idiomatic Gradle test configurations with Detekt and Kover.

Quick Start

Use the kotlin-patterns skill to review your existing Kotlin coroutine code for unstructured concurrency issues and suggest idiomatic fixes using coroutineScope or supervisorScope.

Frequently Asked Questions about kotlin-patterns

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

FAQPage Schema
How do I fix unstructured coroutine leaks in Kotlin?▼

Fix unstructured coroutine leaks in Kotlin by wrapping concurrent operations in `coroutineScope` or `supervisorScope` to ensure structured concurrency and automatic child job cancellation.

What is the best way to handle null safety in Kotlin to prevent runtime crashes?▼

Null safety in Kotlin is best handled by enforcing idiomatic patterns like safe calls, smart casts, and avoiding force-unwrapping nullable types to eliminate null pointer exceptions in production code.

How do I create type-safe DSL builders in Kotlin?▼

Create type-safe DSL builders in Kotlin by applying the `@DslMarker` annotation to restrict implicit receiver scope access, preventing accidental calls to outer scope methods within nested configuration blocks.

Can I use sealed classes for exhaustive type handling in Kotlin multiplatform projects?▼

Sealed classes and interfaces support exhaustive type handling in Kotlin multiplatform projects by allowing the compiler to enforce `when` statement coverage across all defined subtypes for safer logic.

How do I configure Gradle Kotlin DSL build scripts idiomatically?▼

Configure Gradle Kotlin DSL build scripts idiomatically by using type-safe accessors, applying Detekt for static analysis, and integrating Kover for code coverage to maintain robust build environments.

Why use value classes for type-safe wrappers in Kotlin?▼

Use value classes in Kotlin to create type-safe wrappers with zero runtime overhead, ensuring distinct typing at compile time while avoiding memory allocations during execution.