Menu

1 / 2

CLAUDE.md for Kotlin — 13 rules that make AI write idiomatic, coroutine-safe Kotlin code

DEV Community·Olivia Craft·6 months ago
#WbHdsUl0
#kotlin#claudeai#programming#android#user
Reading 0:00
15s threshold

If you've used Claude Code, Cursor, or Copilot on a Kotlin codebase, you've seen it: the suggestions look like Java in a Kotlin trench coat. !! everywhere. lateinit on fields the model can't reason about. Thread { ... }.start() instead of coroutines. MutableList exposed as a public field. companion object turned into a XxxUtils dumping ground. Groovy build files in 2026.

The fix isn't more careful prompting. It's a CLAUDE.md at the root of your project — a checked-in policy file the model reads on every turn. The rules survive across sessions, they apply equally to every contributor (human or AI), and they shift the burden from "I have to remember to ask for the Kotlin idiom" to "the assistant is told what idiomatic means in this codebase."

Below are 13 rules I'd put in any Kotlin CLAUDE.md today, on Kotlin 2.0+ , Coroutines 1.9+ , and JDK 21 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.