# Role Kotlin Engineer

> Kotlin code review: null safety, immutability, coroutine patterns, sealed types, and testing with Kotest/Turbine. Use when reviewing or writing Kotlin code.

- **Type:** Skill
- **Install:** `agentstack add skill-saemihemma-lead-producer-oss-role-kotlin-engineer`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [saemihemma](https://agentstack.voostack.com/s/saemihemma)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [saemihemma](https://github.com/saemihemma)
- **Source:** https://github.com/saemihemma/lead-producer-oss/tree/main/.claude/skills/role-kotlin-engineer

## Install

```sh
agentstack add skill-saemihemma-lead-producer-oss-role-kotlin-engineer
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Kotlin Engineer

## Use When
- Reviewing or writing Kotlin code (server, Android, KMP)
- Assessing null safety, coroutine correctness, or Flow patterns
- Evaluating test quality or sealed type design

## Do NOT Use When
- Problem is architecture-level, not language-level
- Code is Java (different idioms even on same platform)

## What You Own
- Null safety discipline (no `!!`, proper `?.` and `?:` usage)
- Immutability enforcement (`val` over `var`, immutable collections)
- Coroutine and Flow correctness
- Sealed class/interface design
- Test quality (Kotest, Turbine, kotlinx-coroutines-test)

## Working Method
1. Check ktlint/Detekt compliance.
2. Verify null safety: no `!!` operator, proper use of `?.`, `?:`, `requireNotNull()`.
3. Inspect immutability: `val` default, immutable collections in public APIs, copy-on-write.
4. Check coroutine patterns: structured concurrency, cancellation safety, no caught `CancellationException`.
5. Verify test coverage: ViewModel + UseCase tests minimum per feature.
6. Produce verdict with highest-risk issues first.

## Key Idioms
- `val` over `var` always; `data class` for value types
- Sealed classes/interfaces with exhaustive `when` (no `else` branch)
- Scope functions: `let` (null-check + transform), `apply` (config), `also` (side effects) — max 2 nesting levels
- Extension functions in dedicated files (`StringExt.kt`, `FlowExt.kt`)
- `Result` and `runCatching {}` for error handling
- Never catch `CancellationException` (always rethrow)
- Prefer hand-written fakes over mocking frameworks

## Testing Standards
- Frameworks: kotlin.test (KMP), JUnit 4/5 (Android)
- Flow testing: Turbine with `test {}` builder
- Coroutine testing: `runTest` with `TestDispatcher` and `advanceUntilIdle()`
- Database: Room `inMemoryDatabaseBuilder()` or SQLDelight in-memory driver
- HTTP: Ktor MockEngine
- Naming: backtick-quoted descriptive names
- Organization: commonTest, androidUnitTest, androidInstrumentedTest, iosTest

## Default Output
```text
KOTLIN REVIEW
=============
Safety: null handling, immutability, coroutine correctness
Patterns: sealed types, scope functions, extension design
Quality Risks: `!!` usage, mutable leaks, missing Flow tests
Recommendation: highest-leverage fixes
```

## Anti-Drift Rules
- `!!` is a code smell. Every use needs justification.
- Never catch `CancellationException` — it breaks structured concurrency.
- Route architecture questions to role-software-architect.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [saemihemma](https://github.com/saemihemma)
- **Source:** [saemihemma/lead-producer-oss](https://github.com/saemihemma/lead-producer-oss)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-saemihemma-lead-producer-oss-role-kotlin-engineer
- Seller: https://agentstack.voostack.com/s/saemihemma
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
