$npx skillfedfor your agent

Kotlin Idioms

This skill covers core Kotlin idioms that make code safer and more expressive. Learn null-safety techniques, sealed hierarchies for type-safe results, structured concurrency with coroutines, and naming conventions. Includes practical examples and tooling guidance for formatting and static analysis.

Kotlin Idioms teaches idiomatic Kotlin coding patterns including null safety, data classes, coroutines, and testing best practices.

AI-generated summary based on this skill's SKILL.md

150 48 MITupdated by irahardianto

Decision gist · record as of 2026-07-17

Kotlin Idioms teaches idiomatic Kotlin coding patterns including null safety, data classes, coroutines, and testing best practices. This skill covers core Kotlin idioms that make code safer and more expressive. Learn null-safety techniques, sealed hierarchies for type-safe results, structured concurrency with coroutines, and naming conventions. Includes practical examples and tooling guidance for formatting and static analysis.

manual: git clone https://github.com/irahardianto/awesome-agv → cp -r awesome-agv/.agents/skills/kotlin-idioms ~/.claude/skills/kotlin-idioms
.agents/skills/kotlin-idioms/SKILL.md · version 330e1b2f

Use it when

  • Kotlin Idioms covers null-safety through multiple patterns: safe calls (?.) to call methods only on non-null objects.
  • Kotlin Idioms teaches structured concurrency by showing how to avoid launching coroutines in global scope and instead use proper scope.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

irahardianto/awesome-agv/kotlin-idioms · repository language: JavaScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I write idiomatic Kotlin code that follows best practices?

Kotlin Idioms teaches you to leverage the language's unique features for safer, more expressive code. Focus on null-safety with the elvis operator (?:) and safe calls (?.), use sealed classes and data classes for type-safe domain models, prefer scope functions like let for concise transformations, and adopt exhaustive when expressions to catch missing cases at compile time. The skill emphasizes avoiding global scope launches in coroutines and using structured concurrency patterns instead.

What null safety patterns does Kotlin Idioms cover?

Kotlin Idioms covers null-safety through multiple patterns: safe calls (?.) to call methods only on non-null objects, the elvis operator (?:) to provide defaults, and require/check functions for explicit error handling. You'll learn to avoid platform types from Java interop by using nullable annotations, and understand how Kotlin's type system prevents null pointer exceptions at compile time rather than runtime.

How can I master coroutines and structured concurrency in Kotlin?

Kotlin Idioms teaches structured concurrency by showing how to avoid launching coroutines in global scope and instead use proper scope functions like coroutineScope and supervisorScope. You'll learn to manage cancellation, exception handling, and job hierarchies correctly, ensuring coroutines are tied to their parent scope and cleaned up predictably.

What coding conventions and naming rules does Kotlin Idioms teach?

Kotlin Idioms covers naming conventions including camelCase for properties and functions, PascalCase for classes, and UPPER_SNAKE_CASE for constants. The skill includes guidance on using ktlint and detekt for automated static analysis and code formatting, plus best practices like avoiding explicit getters/setters and following Kotlin's property naming conventions.

What are sealed classes and data classes in Kotlin Idioms?

Kotlin Idioms explains sealed classes as a way to restrict class hierarchies for type-safe results and discriminated unions, often paired with data classes for immutable value objects. Sealed interfaces offer modern alternatives for modeling restricted type hierarchies. Together they enable exhaustive when expressions that the compiler can verify are complete.

Does Kotlin Idioms cover testing and static analysis tools?

Kotlin Idioms includes guidance on setting up testing with kotest and MockK for unit and integration tests. It also covers static analysis tooling like ktlint for code formatting and detekt for code quality checks, helping you enforce idioms and conventions automatically across your codebase.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Kotlin Idioms and Patterns

Kotlin rewards conciseness, null safety, and coroutine-based concurrency. Idiomatic Kotlin = safe, expressive, interop-aware.

> Scope: Kotlin coding idioms. Test naming: .agents/rules/testing-strategy.md.

Null Safety

  1. ? for nullable types — never platform types without annotation: kotlin fun findById(id: String): Task? // explicitly nullable fun getById(id: String): Task // guaranteed non-null — throws if not found

  2. Prefer ?.let {} and ?: (Elvis) over null checks.

  3. Never !! in production — use requireNotNull with a message.

Data Classes and Sealed Types

  1. data class for DTOs and domain objects: kotlin data class CreateTaskRequest(val title: String, val priority: Priority)

  2. sealed class/sealed interface for restricted hierarchies: kotlin sealed interface TaskResult { data class Success(val task: Task) : TaskResult data class NotFound(val id: String) : TaskResult data class ValidationError(val errors: List<String>) : TaskResult }

  3. **Exhaustive when with sealed

(truncated - see the full file via the links below)

File tree — 1 file
.agents/skills/kotlin-idioms/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Learn idiomatic Kotlin coding patterns and best practices”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

android-kotlin
by alinaqi · alinaqi/maggy

This skill equips you to develop Android applications using Kotlin's modern ecosystem. Leverage Jetpack Compose for declarative UI, Coroutines for asynchronous programming, and Hilt for dependency injection to create robust, maintainable mobile apps.

MITupdated Jul 2026
★ 703repo stars
Java Idioms
by irahardianto · irahardianto/awesome-agv

Java Idioms covers modern language features and conventions for Java 17+ LTS, emphasizing records for immutable data, sealed classes for type-safe hierarchies, and pattern matching in switch expressions. The skill guides constructor injection, domain-specific exception handling, and testing with JUnit 5 and Mockito, alongside static analysis tooling to enforce code quality before commit.

MITupdated Jul 2026
★ 150repo stars
Cpp Idioms
by irahardianto · irahardianto/awesome-agv

Cpp Idioms teaches you how to write safe, efficient C++ code using modern language features and proven design patterns. Learn RAII principles, smart pointer ownership models, move semantics, and error handling with std::expected—all grounded in C++17/20/23 standards. The skill covers interfaces, dependency injection, testing strategies, and anti-patterns to avoid, with practical code examples and tooling guidance.

MITupdated Jul 2026
★ 150repo stars
Dotnet Idioms
by irahardianto · irahardianto/awesome-agv

Learn idiomatic .NET 8+ development through minimal APIs, dependency injection, and async-first patterns. Covers Entity Framework Core configuration, middleware design, and testing with xUnit. Build clean, performant, cloud-native applications aligned with modern .NET best practices.

MITupdated Jul 2026
★ 150repo stars
hono-idioms
by irahardianto · irahardianto/awesome-agv

Learn idiomatic Hono patterns for building type-safe HTTP APIs across any runtime. This skill covers router composition, middleware ordering, request validation with Zod, error handling, and end-to-end typed RPC clients—all without code generation.

MITupdated Jul 2026
★ 150repo stars
Swift Idioms
by irahardianto · irahardianto/awesome-agv

This skill covers the core patterns that make Swift code safe and maintainable. You'll learn when to use structs over classes, how to handle optionals without crashes, design with protocols instead of inheritance, and leverage Swift's concurrency model. The guide includes practical examples of error handling, property wrappers, actors, and testing strategies—plus anti-patterns to avoid.

MITupdated Jul 2026
★ 150repo stars

More skills Csharp Idioms (MIT) · Elixir Idioms (MIT)

Tags
null-safety-patternsfunctional-programmingconcurrency-modeltype-systemcode-style-guidetesting-frameworksstatic-analysis-toolssealed-hierarchiesreactive-streamsinteroperability-aware