kotlin-patterns

Enforce idiomatic Kotlin standards for null safety, concurrency, and DSLs.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/nazrulsoftwaredev/NIT_CRM_2 --skill kotlin-patterns-nazrulsoftwaredev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-patterns
Source: https://github.com/nazrulsoftwaredev/NIT_CRM_2/tree/main/.agents/skills/kotlin-patterns
Command: npx skills add https://github.com/nazrulsoftwaredev/NIT_CRM_2 --skill kotlin-patterns-nazrulsoftwaredev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the challenge of writing inconsistent or non-idiomatic Kotlin code, helping developers avoid common pitfalls like null-pointer exceptions, mutable state bugs, and inefficient concurrency patterns.

Core Features & Use Cases

  • Idiomatic Best Practices: Provides clear guidance on null safety, immutability, and expression-based programming.
  • Advanced Language Features: Offers patterns for sealed classes, coroutines, structured concurrency, and type-safe DSL builders.
  • Use Case: When refactoring a legacy service, use this Skill to convert imperative block-style functions into concise expression bodies and replace manual thread management with structured coroutine scopes.

Quick Start

Apply the kotlin-patterns skill to review my current implementation of a sealed class hierarchy for API responses and suggest improvements for better type safety.

Frequently Asked Questions about kotlin-patterns

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

FAQPage Schema
What are the best practices for refactoring imperative Kotlin code into expression bodies?

Kotlin structured concurrency manages asynchronous tasks by binding coroutine lifespances to specific scopes. It replaces manual thread management, preventing memory leaks and ensuring reliable background task execution within defined architectural boundaries.

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

Refactoring imperative Kotlin code into expression bodies involves converting block-style functions into concise, single-expression syntax. This approach enforces immutability and idiomatic best practices, reducing mutable state bugs and improving overall code maintainability.

How does Kotlin structured concurrency work with coroutines?

Type-safe DSL builders in Kotlin are implemented using advanced language features like function types with receivers. This allows you to create expressive, domain-specific configuration hierarchies while enforcing compile-time type safety and preventing invalid structural nesting.

How do I ensure null safety when designing sealed class hierarchies for API responses?

Ensuring null safety with sealed class hierarchies involves leveraging Kotlin's compile-time checks to handle distinct API response states. This targets null-pointer exceptions by enforcing exhaustive type matching, resulting in robust and predictable module designs.