kotlin

Enforce Kotlin project conventions for null-safety, coroutines, and Compose.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Pyl-Tech/stream-coding --skill kotlin-pyl-tech
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin
Source: https://github.com/Pyl-Tech/stream-coding/tree/main/.agents/skills/kotlin
Command: npx skills add https://github.com/Pyl-Tech/stream-coding --skill kotlin-pyl-tech

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents Kotlin codebases from drifting into unsafe patterns (null-bugs, non-exhaustive logic, coroutine misuse) by turning Kotlin conventions into enforceable documentation constraints.

Core Features & Use Cases

  • Kotlin formatting and build constraints: requires ktlint or detekt enforcement and sets kotlin.code.style=official in gradle.properties.
  • Null safety and immutability rules: bans !!, prefers ?., ?:, requireNotNull(), enforces val over var, and pushes copy-on-write via copy(...).
  • Production-safe control flow and types: mandates sealed types with exhaustive when and restricts error handling to Result<T>/sealed outcomes with correct cancellation behavior.
  • Coroutines/Flows and Compose guardrails: blocks common anti-patterns like GlobalScope, incorrect cancellation catching, unsafe Compose recomposition patterns, and improper LazyColumn usage.
  • Review and build verification guidance: provides a targeted /code-review checklist and /build-fix commands to reproduce lint/build/test issues.

Quick Start

Activate the kotlin skill while writing a project spec for your Kotlin or Android code changes, so the generated implementation follows these conventions and passes the specified verification expectations.

Frequently Asked Questions about kotlin

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

FAQPage Schema
How do I enforce null safety and ban the !! operator in Kotlin code?

To enforce null safety in Kotlin, you must ban the `!!` operator and prefer `?.`, `?:`, or `requireNotNull()`. This skill establishes explicit project constraints to ensure safer null handling and reduce runtime bugs across Android and Kotlin codebases.

What is the best way to prevent GlobalScope misuse and incorrect coroutine cancellation in Kotlin?

Preventing coroutine misuse in Kotlin requires structured concurrency rules that block `GlobalScope` and ensure correct `CancellationException` handling. This skill enforces these production-safe control flow constraints to maintain stable asynchronous execution.

How do I set up ktlint or detekt formatting rules for an Android Kotlin project?

Setting up Kotlin formatting involves requiring ktlint or detekt enforcement and setting `kotlin.code.style=official` in `gradle.properties`. This skill generates these build constraints to prevent style regressions in `.kt` and `build.gradle.kts` projects.

Does this skill support Jetpack Compose best practices and exhaustive when statements?

Yes, this skill supports Jetpack Compose by enforcing best practices to prevent unsafe recomposition and improper `LazyColumn` usage. It also mandates sealed types with exhaustive `when` statements to ensure complete logic branches.

Can I use this to generate a Kotlin code review checklist for build verification?

Yes, you can use this skill to generate a targeted `/code-review` checklist and `/build-fix` commands. It provides review and build verification guidance to reproduce lint, build, and test issues for Kotlin codebases.

Why should I prefer val over var and use Result<T> for Kotlin error handling?

Preferring `val` over `var` enforces immutability and copy-on-write design, while `Result<T` restricts error handling to sealed outcomes. This skill applies these rules to prevent maintainable-code regressions and ensure production-safe control flow.