Guide · Agent skill
How to use the Kotlin Testing Patterns agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The kotlin-testing skill is a folder of instructions, written in Spanish, that tells an AI agent how to write Kotlin tests with Kotest and MockK, follow a red-green-refactor (TDD) workflow, and check coverage with Kover. It is aimed at developers who already work on Kotlin projects built with Gradle. After this guide you will know what the skill changes about the agent's behaviour, how to install it, how to phrase a request that triggers it, and what your project needs before it is useful.
Quick start
- 1Download and unzip. Download the ZIP from this page and unzip it so that SKILL.md sits in ~/.claude/skills/kotlin-testing/ or in your project's .claude/skills/ folder.
- 2Check your project. Make sure the project is a Kotlin project built with Gradle and that it uses the Kotest and MockK libraries and the Kover plugin. The examples run with ./gradlew.
- 3Ask for a test-first change. Describe the Kotlin function or class and say you want Kotest tests with MockK written first, following TDD.
- 4Run the tests and confirm they fail. Ask the agent to run ./gradlew test and check that the new tests fail before the implementation exists.
- 5Generate the coverage report. Run ./gradlew koverHtmlReport and review the HTML report against the 80% target.
What the kotlin-testing skill makes the agent do
An agent skill is a set of instructions that an AI agent loads when a task matches it. Once the kotlin-testing skill is installed, the agent has a defined method for Kotlin test work. Its stated process has seven steps: identify the target code, write a Kotest spec, mock dependencies with MockK, run the tests and confirm they fail (RED), write the minimum code to pass (GREEN), refactor while keeping tests green, and finally run ./gradlew koverHtmlReport and check for 80% or more coverage.
The skill is mostly reference material. Its examples cover Kotest spec styles, MockK usage, a step-by-step TDD walkthrough with an EmailValidator, and common Kotest matchers. The skill's own description also lists property-based testing and coroutine testing as topics it covers.
- Writes Kotest specs in StringSpec, FunSpec, BehaviorSpec or DescribeSpec styles
- Uses MockK to fake dependencies and isolate the unit under test
- Follows a test-first red-green-refactor cycle
- Runs Kover coverage reports with a target of 80% or more
How to install the kotlin-testing skill
Download the ZIP file from this page. The package contains a single file, SKILL.md. There are two ways to make it available to your agent.
For Claude Code, unzip the package into ~/.claude/skills/ to make it available in all your projects, or into a project's .claude/skills/ folder to make it available only in that project. For the Claude apps, you can upload the skill under Settings → Capabilities → Skills instead.
- Option A (all projects): unzip into ~/.claude/skills/
- Option B (one project): unzip into the project's .claude/skills/ folder
- Option C (Claude apps): upload under Settings → Capabilities → Skills
How to trigger the skill with natural requests
You do not need a special command. The skill is meant to load when your request matches its purpose. The source lists these situations: writing new Kotlin functions or classes, adding test coverage to existing Kotlin code, implementing property-based tests, following a TDD workflow in a Kotlin project, and configuring Kover for code coverage.
Name the language, the test framework and the goal in plain words. Mentioning Kotest, MockK, TDD or Kover makes it more likely that the request matches the skill's instructions.
- Write Kotest tests for the OrderService class using MockK for the repository, then implement it test-first.
- Add test coverage to my Kotlin UserValidator and check it reaches 80% with Kover.
- Set up Kover in this Gradle project and show me how to generate an HTML coverage report.
- Use TDD to build an EmailValidator in Kotlin, starting with failing tests.
Pick a Kotest spec style and mock dependencies
The skill shows four Kotest styles. StringSpec is the simplest, with one named string per test. FunSpec is similar to JUnit. BehaviorSpec uses Given, When and Then blocks for behaviour-driven tests. DescribeSpec uses describe, context and it blocks, in the style of RSpec. The skill suggests choosing a style that fits the scope of the test.
For dependencies, the examples use mockk<T>() with coEvery for suspending functions, coVerify to check calls, and answers to capture arguments. The matcher examples use shouldBe, shouldContain, shouldHaveSize, shouldBeEmpty and similar functions from Kotest.
- StringSpec: quick, flat unit tests
- FunSpec: test(...) blocks, familiar to JUnit users
- BehaviorSpec: Given / When / Then scenarios
- DescribeSpec: nested describe / context / it blocks
val repository = mockk<UserRepository>()
coEvery { repository.findById("1") } returns expected
coVerify(exactly = 1) { paymentService.charge(any()) }Check coverage with Kover
The skill's coverage step runs ./gradlew koverHtmlReport. The source says the target is 80% or more, and the skill refers to a Kover configuration section for setup. The coverage figure is a target the agent tries to reach. The skill file does not verify it, so read the generated report yourself before trusting it.
./gradlew koverHtmlReportWhat people use it for
- Adding Kotest unit tests with MockK fakes to an existing Kotlin service layer
- Building a new Kotlin validator test-first, as in the EmailValidator walkthrough in the skill
- Writing BehaviorSpec scenarios that describe business rules such as order placement and payment failure
- Setting up a Kover HTML report for a Gradle project and reviewing coverage gaps
Frequently asked questions
Is the kotlin-testing skill free to use?
The item is listed under the MIT licence. The skill file is a single SKILL.md with reference examples and a TDD walkthrough, and the source does not mention any charge.
Do I need Gradle to use this skill?
Yes, the examples and commands use ./gradlew, so the skill assumes a Gradle-built Kotlin project. Projects using other build tools will need to adapt the commands themselves.
Does the skill install Kotest, MockK or Kover for me?
The source does not say the skill adds these libraries or the Kover plugin to your build. It lists them as requirements, so you need them set up in your project already.
Does the skill run scripts or use the network?
According to the listing, it runs no scripts and uses no network. It is a single instruction file that the agent reads.
Will the skill guarantee 80% test coverage?
No. The 80% figure is a target the agent will attempt. The skill file does not verify the result, so check the Kover report yourself.
What if my project does not use Kotlin, Kotest or MockK?
The examples will not match your stack, so the skill is not a good fit. Pick a skill or guide written for your language and test framework instead.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use the kotlin-testing skill if you are a Kotlin developer on a Gradle project who wants an agent to write Kotest and MockK tests test-first and report Kover coverage. Skip it if your project does not use Kotlin, Gradle, Kotest or MockK, or if you need a guaranteed coverage result, since the 80% target is only a goal the agent tries to meet.
Download the skill