Agent skill · affaan-m

kotlin-patterns

Idiomatic Kotlin patterns, best practices, and conventions for building robust, efficient, and maintainable Kotlin applications with coroutines, null safety, and DSL builders. Use when writing or reviewing Kotlin code and idiomatic structure or null safety is in question.

What it needs

About 9k tokens when loaded.

What this skill does

Kotlin Development Patterns Idiomatic Kotlin patterns and best practices for building robust, efficient, and maintainable applications. When to Use Writing new Kotlin code Reviewing Kotlin code Refactoring existing Kotlin code Designing Kotlin modules or libraries Configuring Gradle Kotlin DSL builds How It Works This skill enforces idiomatic Kotlin conventions across seven key areas: null safety using the type system and safe-call operators, immutability via val and copy() on data classes, sealed classes and interfaces for exhaustive type hierarchies, structured concurrency with coroutines and Flow, extension functions for adding behaviour without inheritance, type-safe DSL builders using @DslMarker and lambda receivers, and Gradle Kotlin DSL for build configuration. Examples Null safety with Elvis operator: Sealed class for exhaustive results: Structured concurrency with async/await: Core Principles 1. Null Safety Kotlin's type system distinguishes nullable and non-nullable types. Leverage it fully. 2. Immutability by Default Prefer val over var, immutable collections over mutable ones. 3. Expression Bodies and Single-Expression Functions Use expression bodies for concise, readable functions. 4. Data Classes for Value Objects Use data classes for types that primarily hold data. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/kotlin-patterns--e7aaa9

View the source on GitHub

Browse the @skills marketplace