Sign inGet started
All insights

Coding With Agents in Kotlin: Setup, Skills and Pitfalls in 2026

By SkillzBench · October 17, 2026

Fix 'compiles but wrong' Kotlin bugs with AI agent skills. Learn setup, security risks, and how to verify skill quality before you code.


Key Facts

  • 66% of organizations adopting AI agents report measurable productivity gains per PwC's AI Agent Survey.
  • Roughly 26% of published agent skills carry at least one vulnerability, making trust verification essential before installing any skill.
  • AI agents generate Kotlin that compiles but gets details wrong, causing race conditions from `_state.value = ...` instead of atomic `_state.update { }` calls.
  • Using `collectAsState()` instead of `collectAsStateWithLifecycle()` drains battery — one of six silent Kotlin failure modes invisible at compile time.
  • One open-source Kotlin skill kit claims compatibility with 27 coding agents, including Cursor, Claude Code, Codex CLI, and Gemini CLI.
  • Enterprise analysis identifies five skill risk categories: prompt injection, tool misuse, missing audit trails, memory poisoning, and over-broad permissions.
  • SkillzBench is building a free directory that pins skills to commit SHAs, security-scans them, and benchmarks quality Lift in percentage points.

The 'Compiles but Wrong' Problem: Why AI Agents Break Kotlin

The scariest code is the code that looks fine. An AI agent hands you Kotlin that compiles cleanly, passes a quick glance, and ships to production with bugs baked in — because, as one practitioner skill-kit project puts it bluntly, "AI coding agents generate Kotlin/Compose code that compiles but gets the details wrong."

The failure modes are surprisingly consistent. The repository catalogs six concrete ways agents get Kotlin wrong, all invisible at compile time:

  • Race conditions from `_state.value = …` assignments instead of atomic `_state.update { }` calls
  • Battery drain from `collectAsState()` instead of `collectAsStateWithLifecycle()`
  • Broken localisation from hardcoded UI strings instead of `stringResource(R.string.…)`
  • Recomposition storms from `LazyColumn` lists missing `key` + `contentType`
  • Memory leaks from `GlobalScope.launch { }` inside ViewModels, and config-change bugs from `mutableStateListOf`

Each of these fails silently. A keyless LazyColumn still renders; it just recomposes far more than it should and breaks scrolling under load. A GlobalScope coroutine still runs; it just leaks when the ViewModel is cleared. The agent isn't hallucinating syntax — it's producing plausible, idiomatic-looking code that violates the discipline real Android engineers spend years internalising.

This is the paradox of AI-assisted Kotlin in 2026. According to PwC's AI Agent Survey as cited by Atlan, 66% of organizations adopting AI agents report measurable value through increased productivity. Yet the correctness gap persists, because the gap isn't about capability — it's about constraint. An agent that knows Kotlin syntax doesn't automatically know that naked state assignment is banned under strict MVI, or that lifecycle-aware collection exists.

The emerging fix is instructive: the practitioner project enforces correctness through a markdown "skill kit" the agent reads before writing code, complete with a banned-antipatterns reference and a 6-point review checklist for auditing Composables. Skills, in other words, are how you turn a general-purpose agent into a disciplined Kotlin contributor.

But skills carry their own risk — published research has found roughly 26% carry at least one vulnerability, which is why SkillzBench is building a free directory that security-scans, license-checks, and benchmarks every skill in a sandbox before you trust it with your codebase.

How Agent Skills Fix It: The Markdown Skill-Kit Approach

The fix that's gaining traction is refreshingly low-tech: a plain markdown file the agent reads before it writes a single line of Kotlin. One open-source project calls it a "skill kit" and sums up the setup in one line: clone the repo into your agent's skills folder, and the agent reads it before writing Kotlin.

The kit's root SKILL.md pins the entire 2026 toolchain — Kotlin 2.x with the K2 compiler, AGP 9, the Compose BOM 2026, and Navigation 3 with type-safe NavKey routes — alongside strict MVI guardrails and a dedicated banned-antipatterns reference. Below that root sit three sub-skills (architecture, Compose, and testing) loaded on demand, plus 20 numbered reference modules covering specifics like Coil 3.4 image loading and accessibility targets of 48dp under WCAG AA. A validator script enforces frontmatter, link integrity, and registry parity in CI, so the instructions themselves can't quietly rot.

The compatibility claim is broad: the project asserts support for 27 coding agents, including Cursor, Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, Windsurf, and JetBrains AI/Junie, with per-agent install guides for each. Setup is deliberately minimal — Claude Code users, for example, add a five-line block to CLAUDE.md. It's markdown instructions, not a library: you clone it with git, not implementation(...).

Does it actually change agent output? The project's own without-vs-with comparison makes the difference concrete:

  • ViewModel state: _state.value = ... (race conditions) becomes atomic _state.update { it.copy(...) }
  • Flow collection: battery-draining collectAsState() becomes collectAsStateWithLifecycle()
  • Navigation: deprecated string routes become Navigation 3 type-safe NavKey routes
  • Coroutines: leaking GlobalScope.launch { } becomes viewModelScope with structured concurrency

The kit also ships a REVIEW MODE — a six-point checklist for auditing Composables, covering modifier placement, state hoisting, lazy-list keys, lifecycle-aware collection, and stable data params.

One caveat deserves honest treatment: these claims are self-published and not independently verified. That's the broader challenge with skills in general — published research has found roughly 26% of agent skills carry at least one vulnerability, so quality varies wildly across what's out there. This is the gap SkillzBench is building to close: a free directory that crawls and dedupes skills from GitHub, pins every version to a commit SHA, runs security scans and quality checks, and benchmarks each skill with the same model, with and without it, publishing the Lift in percentage points. A matching free MCP tool will let you toggle exactly which skills each of your agents sees.

Skills like this turn a general-purpose agent into a disciplined Kotlin contributor — provided you pick ones that have actually been vetted.

The Hidden Cost: Skills Are Also a Risk Surface

Here's the uncomfortable flip side: the same skill packages that fix your race conditions and recomposition storms can also hand an attacker a doorway into your agent. Every SKILL.md you add is instructions your agent will follow — and instructions can be malicious, stale, or simply wrong.

Enterprise analysis of agent skills identifies five core risk categories: prompt injection, where hidden instructions in documents trigger unauthorized actions; tool misuse, where skills call the wrong functions or act at the wrong time; missing audit trails, where actions complete with no record of the decision path; memory poisoning, where stale or conflicting definitions spread across multi-agent workflows; and over-broad permissions, where skills inherit service accounts with far more access than they need.

The scale of the problem is not theoretical. Published research found that roughly 26% of agent skills carry at least one vulnerability. That means about one in four skill packages floating around GitHub — including ones you might clone straight into your agent's skills folder — has a security flaw of some kind. And because skills are plain markdown, a malicious one looks identical to a helpful one until you actually read it line by line.

The governance frameworks treating AI safety as ongoing work rather than one-time approval — the OWASP AI Agent Security Cheat Sheet, NIST AI RMF, and ISO/IEC 42001 — converge on a common set of controls:

  • Least-privilege scoping, so a skill only touches the data and tools it genuinely needs
  • Human-in-the-loop approval paths for high-impact actions
  • Auditability — recording the context, rules, tools, actions, and results of every skill-driven step
  • Versioning and drift control, so changes to a skill's instructions are tracked and re-reviewed

The enterprise readiness test is blunt: can you show what the skill knew, what it was allowed to do, why the action was approved, and what happened next? If not, the argument goes, a skill is not ready for enterprise use — "a skill without governed norms is not a capability. It is a liability."

This is exactly why verification matters before you clone anyone's skill kit, no matter how good the "with skill" comparison table looks. Pinning each skill to a specific commit SHA, security-scanning it, checking its license, and benchmarking whether it actually lifts output quality are the controls that turn a random markdown file into something you can trust. That's the problem SkillzBench is being built to solve: a free, independent directory that verifies, scans, and benchmarks agent skills — with a trust score and a separately reported Lift figure — plus a free MCP connector so your agent only ever sees the skills you explicitly chose for it.

Your Setup and Review Workflow: A Practical Checklist

Once your agent is loaded with the right Kotlin skills, the real work is enforcing them — every session, every review, every release. Setup without a review workflow just produces broken code faster.

Install skills per agent, then verify the install. The practitioner pattern is simple: clone the skill kit into your agent's skills folder so the agent reads it before writing Kotlin. For Claude Code specifically, that means adding the required 5-line block to CLAUDE.md; per-agent install guides exist for 27 agents including Cursor, Codex CLI, and Gemini CLI. After installing, confirm the agent actually picks up the root SKILL.md — the layer that pins the 2026 toolchain (Kotlin 2.x/K2, AGP 9, Compose BOM 2026, Navigation 3) and declares banned antipatterns.

Enforce architecture guardrails, not just suggestions. The skill kit enforces strict MVI with atomic StateFlow updates: UiState + UiEvent + UiEffect, with naked state assignment (_state.value = ...) explicitly banned because it causes race conditions. Put these rules where they can't be ignored — the root skill file for defaults, and a CI validator script that checks frontmatter, link integrity, and skill-registry parity. Prompts alone won't hold the line; as one enterprise analysis puts it, prompts tell models how to behave but cannot control what your systems will actually allow.

Run a review pass on every agent-generated Composable. The kit's REVIEW MODE triggers a six-point checklist:

  • `modifier: Modifier = Modifier` is present and is the last optional parameter
  • State is hoisted — no screen state stuck inside the `@Composable`
  • Every `LazyColumn` or `LazyRow` has `key` + `contentType` to prevent recomposition storms
  • `collectAsStateWithLifecycle()` is used — never `collectAsState()`, which drains battery
  • No IO, database, or network calls in the composition body
  • Data parameters passed to children are `@Stable` or `@Immutable`

Treat skills as governed capabilities, not drop-in files. For teams adopting agents at scale — 66% of organizations adopting AI agents reported measurable productivity gains, according to PwC's AI Agent Survey via Atlan — a six-stage release process applies: Propose → Evaluate → Approve → Deploy → Observe → Correct. The test: can you show what the skill knew, what it was allowed to do, why it was approved, and what happened next? If not, it isn't ready.

That's also why verification matters before any skill reaches your skills folder. SkillzBench is building exactly this: a free directory that pins every skill to a commit SHA, runs security scans and license checks, and benchmarks each skill with and without it in a sandbox — plus a free MCP connector so your agent only sees the skills you've chosen. You can join the waitlist to get early access when it launches.

In the meantime, audit what you've already installed. The open-source Compose/Kotlin skill kit documents its own layered structure and validator approach — a reasonable template for reviewing any skill package before you trust it with your codebase.

Where to Find (and Trust) Kotlin Agent Skills

Finding Kotlin agent skills is easy in 2026 — knowing which ones to trust is the hard part. Skill kits now proliferate across GitHub, with one practitioner Kotlin/Compose skill kit alone claiming compatibility with 27 different coding agents, from Claude Code and Cursor to Gemini CLI and JetBrains' own Junie.

The catch is that skills cut both ways. They fix subtle Kotlin failures — race conditions from _state.value = …, battery drain from collectAsState(), recomposition storms from keyless LazyColumn — but they also expand your attack surface. Enterprise governance research identifies five distinct risk categories for agent skills, including prompt injection, tool misuse, and over-broad permissions. As that analysis bluntly puts it: "A skill without governed norms is not a capability. It is a liability."

Most of these risks hide in plain sight. A skill's README can claim anything; nothing independently verifies it.

That verification gap is what SkillzBench is being built to close. As a free, independent directory, it is designed to continuously crawl and deduplicate skills from GitHub, then put each one through a verification pipeline:

  • Pin every skill version to a commit SHA, so you know exactly what you're running
  • Security-scan and license-check each skill before it earns a place in the directory
  • Benchmark every skill in a sandbox — same model, with and without the skill — and publish the Lift in percentage points
  • Track upstream changes, re-scan, and notify you when a skill you rely on shifts underneath you

The benchmarking approach matters most for Kotlin. The difference between a good and bad skill is invisible in a README — you only see it when the agent writes _state.update { } instead of _state.value = …, or collectAsStateWithLifecycle() instead of the battery-draining alternative. Measured Lift, shown separately from ratings and never touched by money, turns "trust me" into evidence.

SkillzBench is also building a free MCP tool that connects any agent to the skills you choose, with per-agent loadouts: toggle skills and tools per agent, and the agent only sees what you selected. Everything — directory, connector, benchmarks, alerts — is free.

The platform is pre-launch right now. If you want to test Kotlin skills against this verification pipeline as it goes live, join the waitlist at skillzbench.com and be among the first to see which skills genuinely help your agents write better Kotlin — and which ones quietly make things worse.

Frequently Asked Questions

Why does AI-generated Kotlin code compile fine but still have bugs?
AI agents know Kotlin syntax but not Android discipline, so they produce plausible code with silent failures like race conditions from `_state.value = …` instead of atomic `_state.update { }`, or battery drain from `collectAsState()` instead of `collectAsStateWithLifecycle()`. As one practitioner skill-kit project puts it, agents "generate Kotlin/Compose code that compiles but gets the details wrong" — and every one of these bugs is invisible at compile time.
What are the most common mistakes AI coding agents make in Kotlin and Compose?
Six recurring failure modes: race conditions from naked state assignment, battery drain from `collectAsState()`, broken localisation from hardcoded UI strings, recomposition storms from `LazyColumn` lists missing `key` + `contentType`, memory leaks from `GlobalScope.launch { }` inside ViewModels, and config-change bugs from `mutableStateListOf`. Each fails silently — a keyless `LazyColumn` still renders, it just recomposes far more than it should, per the skill-kit catalog.
How do agent skills actually fix bad AI-generated Kotlin code?
A skill kit is a plain markdown file (SKILL.md) the agent reads before writing code, pinning the 2026 toolchain (Kotlin 2.x/K2, AGP 9, Compose BOM 2026, Navigation 3), strict MVI guardrails, and a banned-antipatterns reference. Setup is just cloning the repo into your agent's skills folder — Claude Code users add a five-line block to `CLAUDE.md` — and the project claims compatibility with 27 coding agents including Cursor, Codex CLI, and Gemini CLI, per its documentation.
Are AI agent skills safe to install, or are they a security risk?
They cut both ways: they fix subtle Kotlin bugs but also expand your attack surface, with enterprise analysis identifying five risk categories including prompt injection, tool misuse, and over-broad permissions. Because skills are plain markdown, a malicious one looks identical to a helpful one until you read it line by line — which is why verification (security scanning, commit-SHA pinning, benchmarking) matters before you clone anything.
Is there any evidence AI coding agents actually make teams more productive?
Yes — 66% of organizations adopting AI agents reported measurable value through increased productivity, according to PwC's AI Agent Survey. But the correctness gap persists, because knowing Kotlin syntax isn't the same as knowing your project's constraints — that's what skills are for.
How do I know which Kotlin agent skills to trust before installing them?
A skill's README can claim anything and nothing independently verifies it, so look for evidence: version pinning to a commit SHA, security scans, license checks, and benchmarked results with and without the skill. SkillzBench is building a free directory that does exactly this — plus a free MCP connector so your agent only sees the skills you've explicitly vetted and chosen.

Skills, Proven — Not Just Promised

The lesson from coding Kotlin with agents in 2026 is clear: the dangerous code isn't the code that fails to compile — it's the code that compiles and quietly ships race conditions, battery drain, and memory leaks. Markdown skill kits close that correctness gap, turning a general-purpose agent into a disciplined Kotlin contributor with banned-antipattern lists, MVI guardrails, and review checklists. But skills are also a risk surface: with roughly 26% of agent skills carrying at least one vulnerability, and 66% of organizations adopting AI agents reporting measurable productivity gains per PwC's AI Agent Survey cited by Atlan, the teams that win are the ones that verify before they trust. Your next steps: audit any skills already in your agents' folders, enforce review checklists on every agent-generated Composable, and only adopt skills pinned to a commit SHA and security-scanned. SkillzBench is building exactly that verification — a free directory that scans, benchmarks, and tracks skills, plus a free MCP connector for per-agent loadouts. Join the waitlist at skillzbench.com to be first in line when it launches.

Kotlin Agent Skills: Setup & Pitfalls in 2026 · SkillzBench