kotlin-expert

Provides Kotlin & Kotlin multiplatform programming guidance, including design patterns and best practices for developers.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Zeyden/claude-skills --skill kotlin-expert-zeyden
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-expert
Source: https://github.com/Zeyden/claude-skills/tree/main/skills/kotlin-expert
Command: npx skills add https://github.com/Zeyden/claude-skills --skill kotlin-expert-zeyden

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more efficient, type-safe, and maintainable Kotlin code, particularly for KMP projects, by leveraging advanced language features and patterns.

Core Features & Use Cases

  • State Management: Efficiently manage UI and application state using StateFlow and SharedFlow.
  • Type Safety: Utilize sealed hierarchies (classes and interfaces) for robust state representation and error handling.
  • Performance Optimization: Employ inline functions, reified generics, and value classes for better performance.
  • DSL Builders: Create expressive, type-safe Domain Specific Languages.
  • Immutability: Ensure data integrity and Compose performance with @Immutable and immutable collections.

Quick Start

Use the kotlin-expert skill to explain the difference between StateFlow and SharedFlow with examples.

Frequently Asked Questions about kotlin-expert

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

FAQPage Schema
How do I manage state in Kotlin Multiplatform using StateFlow and SharedFlow?

State management in Kotlin Multiplatform uses StateFlow for state ownership and SharedFlow for event broadcasting. StateFlow holds a single mutable state value, while SharedFlow emits values to multiple collectors without retaining state.

What is the best way to use sealed classes for type safety in Kotlin?

Sealed classes and interfaces in Kotlin provide restricted hierarchies for type-safe state representation and error handling. They allow exhaustive when expressions, ensuring all possible subtypes are handled at compile time.

How do inline functions and reified generics optimize Kotlin performance?

Inline functions and reified generics optimize Kotlin performance by eliminating runtime type erasure overhead and removing lambda allocation costs. The compiler substitutes the function body directly at the call site, preserving generic type information.

When should I use @Immutable with data classes in Kotlin Multiplatform?

Use @Immutable with data classes in Kotlin Multiplatform when ensuring data integrity and optimizing Compose performance. It marks classes where all properties are immutable, allowing the Compose compiler to skip recomposition for unmodified inputs.

How do I build a type-safe DSL in Kotlin?

Building a type-safe DSL in Kotlin involves using DSL builders and function literals with receiver to create expressive APIs. This pattern allows you to define hierarchical structures with compile-time validation and fluent syntax.

What are common Kotlin anti-patterns for state management and how do I avoid them?

Common Kotlin anti-patterns for state management include overusing SharedFlow for state retention instead of StateFlow, and creating unnecessary object allocations. Decision trees help choose appropriate constructs to avoid these performance bottlenecks.