Skip to content

Kotlin Testing Patterns

Guides an agent to write Kotlin tests with Kotest, MockK, coroutine and property tests, and Kover coverage.

Repository
affaan-m/ECC
Stars
295,127
Licence
MIT
Files
1 file

What it does

When installed, the agent follows a test-first (red-green-refactor) workflow for Kotlin code. It writes Kotest specs in styles like StringSpec, FunSpec, BehaviorSpec and DescribeSpec, uses MockK to fake dependencies, and checks coverage with Kover, aiming for 80% or more. The file is mostly reference examples and a step-by-step TDD walkthrough.

Great for

  • Kotlin developers who want an agent to write unit tests in Kotest and MockK
  • Teams practising TDD on Kotlin or Ktor projects who want consistent test structure
  • Developers setting up Kover coverage reports with Gradle

Skip it if

  • Projects not using Kotlin, Gradle, Kotest or MockK, since the examples will not match their stack
  • Anyone expecting a guaranteed coverage result: the 80% target is a guideline the agent will attempt, not something the file verifies

Try asking

  • “Write Kotest BehaviorSpec tests for my OrderService with MockK mocks for the repository”
  • “Set up Kover in my Gradle project and generate an HTML coverage report”
  • “Use TDD to add an email validator to my Kotlin library, starting with failing tests”
  • “Add coroutine tests with coEvery and coVerify for my suspend functions”
Step-by-step guide: how to use Kotlin Testing PatternsInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    kotlin-testing.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip kotlin-testing.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip kotlin-testing.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Name the test style you want (StringSpec, FunSpec, BehaviorSpec or DescribeSpec) so the agent matches your existing project.
  • Ask the agent to run ./gradlew test after writing tests so you see the real red and green results.
  • Check that the dependencies (Kotest, MockK, Kover) are already in your build file, since the skill does not add them for you.

What's inside

  • SKILL.md

Redistributed unmodified from affaan-m/ECC under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.