Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rules Kotlin?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-rules-kotlin)
---
name: rules-kotlin
description: "ANVIL coding rules for kotlin code (**/*.kt, **/*.kts, **/*Test.kt, **/*Tests.kt): Kotlin, Kotlin Testing."
---
<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->
# ANVIL rules: kotlin
Follow these rules for kotlin code (**/*.kt, **/*.kts, **/*Test.kt, **/*Tests.kt).
## Kotlin
# Kotlin
- Prefer `val` and immutable collections; no `!!` outside tests.
- Structured concurrency: scoped coroutines, never `GlobalScope`; rethrow `CancellationException`.
- Sealed classes or interfaces for closed result and state types; exhaustive `when`.
- Data classes for values; keep side effects out of `init` blocks.
## Kotlin Testing
# Kotlin Testing
- Use `runTest` from `kotlinx-coroutines-test` with virtual time instead of `runBlocking` and real `delay`.
- Inject `CoroutineDispatcher` and fakes via constructors rather than hardcoding `Dispatchers.IO`.
- Use backtick descriptive test names selectively for readability and test exhaustive sealed-state transitions cleanly.
- Assert collected `StateFlow` / `Flow` emissions deterministically (for example with Turbine) instead of timing guesses.