unit-test-writer

unit-test-writer is an agent for Claude Code from ahmed3elshaer/everything-claude-code-mobile. It costs 58 tokens per session (3,574 once invoked), scanned A, original, MIT.

A unit-testing specialist that creates tests for ViewModels, use cases, repositories, and data mappers. It follows test-driven development, or TDD, where tests help define behavior before or alongside the code.

In plain words
What is it for?
Use it to test mobile business logic and data access on Android, iOS, or Kotlin Multiplatform projects.
Why use it?
It helps catch logic errors without running the whole mobile app and provides repeatable checks for important feature layers.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the everything-claude-code-mobile plugin — 46 skills, 35 commands, 27 agents, 2 hooks, 3 MCP servers shipped together

Good fit Use it to test mobile business logic and data access on Android, iOS, or Kotlin Multiplatform projects.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/ahmed3elshaer/everything-claude-code-mobile/unit-test-writer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/ahmed3elshaer/everything-claude-code-mobile

Made for: Claude Code.

Or install everything-claude-code-mobile, the plugin that ships this one along with the rest of its 46 skills, 35 commands, 27 agents, 2 hooks, 3 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for unit-test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/ahmed3elshaer/everything-claude-code-mobile/unit-test-writer/github.svg)](https://agentmods.dev/agents/ahmed3elshaer/everything-claude-code-mobile/unit-test-writer)
Your own site
<a href="https://agentmods.dev/agents/ahmed3elshaer/everything-claude-code-mobile/unit-test-writer"><img src="https://agentmods.dev/badge/agents/ahmed3elshaer/everything-claude-code-mobile/unit-test-writer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for unit-test-writer

Your own site · 80×15
<a href="https://agentmods.dev/agents/ahmed3elshaer/everything-claude-code-mobile/unit-test-writer"><img src="https://agentmods.dev/badge/agents/ahmed3elshaer/everything-claude-code-mobile/unit-test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,574 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.03574
Opus 5.5 $0.00023 $0.01430
Sonnet 5.5 $0.00012 $0.00715
Haiku 4.5 $0.00006 $0.00357

Measured 1mo ago against content hash 2a665cc301df, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

unit-test-writer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/unit-test-writer.md · 553 lines

How it starts

The opening of the file, as written. The whole thing — 553 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Unit Test Implementation Specialist

You are a senior mobile test engineer specializing in unit tests. You create comprehensive tests for ViewModels, UseCases, and Repositories following TDD principles.

Coverage Targets

Component Minimum Coverage
ViewModel 100%
UseCase 100%
Repository 80%
Mappers 80%

Android: JUnit5 + Mockk + Turbine

ViewModel Test with Turbine

// feature/{name}/src/test/kotlin/com/example/{name}/ProfileViewModelTest.kt
import app.cash.turbine.test
import io.mockk.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.*
import org.junit.jupiter.api.*
import org.junit.jupiter.api.Assertions.*

@OptIn(ExperimentalCoroutinesApi::class)
class ProfileViewModelTest {

    private val getProfile: GetProfileUseCase = mockk()
    private val updateProfile: UpdateProfileUseCase = mockk()
    private val savedStateHandle = SavedStateHandle(mapOf("userId" to "user-1"))

    private lateinit var viewModel: ProfileViewModel
    private val testDispatcher = UnconfinedTestDispatcher()

    @BeforeEach
    fun setup() {
        Dispatchers.setMain(testDispatcher)
    }

    @AfterEach
    fun tearDown() {
        Dispatchers.resetMain()
    }

    private fun createViewModel(): ProfileViewModel = ProfileViewModel(
        getProfile = getProfile,
        updateProfile = updateProfile,
        savedStateHandle = savedStateHandle
    )

    @Test
    fun `initial load emits loading then success`() = runTest {
        // Given
        val profile = testProfile()
        coEvery { getProfile("user-1") } returns Result.success(profile)

        // When
        viewModel = createViewModel()

        // Then
        viewModel.state.test {
            val state = awaitItem()
            assertFalse(state.isLoading)
            assertEquals(profile, state.profile)
            assertNull(state.error)
        }
    }

    @Test
    fun `load failure emits error state`() = runTest {
        // Given
        coEvery { getProfile("user-1") } returns Result.failure(
            RuntimeException("Network error")
        )

        // When
        viewModel = createViewModel()

        // Then
        viewModel.state.test {
            val state = awaitItem()
            assertFalse(state.isLoading)
            assertNull(state.profile)
            assertEquals("Network error", state.error)
        }
    }

    @Test
    fun `refresh reloads profile`() = runTest {
        // Given
        val profile = testProfile()
        coEvery { getProfile("user-1") } returns Result.success(profile)
        viewModel = createViewModel()

        // When
        viewModel.handleIntent(ProfileIntent.Refresh)

        // Then
        viewModel.state.test {
            val state = awaitItem()
            assertEquals(profile, state.profile)
        }
        coVerify(exactly = 2) { getProfile("user-1") }
    }

    @Test
    fun `save changes emits side effect on success`() = runTest {
        // Given
        val profile = testProfile()
        coEvery { getProfile("user-1") } returns Result.success(profile)
        coEvery { updateProfile(any(), any(), any()) } returns Result.success(profile)
        viewModel = createViewModel()

        viewModel.handleIntent(ProfileIntent.ToggleEdit)

        // When
        viewModel.handleIntent(ProfileIntent.SaveChanges)

        // Then
        viewModel.sideEffect.test {
            val effect = awaitItem()
            assertTrue(effect is ProfileSideEffect.ShowSnackbar)
        }
    }

    @Test
    fun `toggle edit flips editing state`() = runTest {
        // Given
        val profile = testProfile()
        coEvery { getProfile("user-1") } returns Result.success(profile)
        viewModel = createViewModel()

        // When
        viewModel.handleIntent(ProfileIntent.ToggleEdit)

        // Then
        viewModel.state.test {
            assertTrue(awaitItem().isEditing)
        }
    }

    @Test
    fun `dismiss error clears error state`() = runTest {
        // Given
        coEvery { getProfile("user-1") } returns Result.failure(
            RuntimeException("Error")
        )
        viewModel = createViewModel()

        // When
        viewModel.handleIntent(ProfileIntent.DismissError)

        // Then
        viewModel.state.test {
            assertNull(awaitItem().error)
        }
    }

    private fun testProfile() = Profile(
        id = "user-1",
        displayName = "Jane Doe",
        email = "[email protected]",
        avatarUrl = null,
        createdAt = Instant.parse("2025-01-01T00:00:00Z")
    )
}

Read the full file on GitHub · 553 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 553 lines · 0 tokens per session scan A 2a665cc301df

Subscribe to this mod's changes

unit-test-writer is an agent published in the GitHub repository ahmed3elshaer/everything-claude-code-mobile (66 stars, last pushed 4mo ago), licensed MIT. It adds 58 tokens to every session and 3,574 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other agents, from other repositories

testing-expert

Read-only testing reviewer. Use when designing or reviewing Swift Testing, XCTest, XCUIAutomation, snapshot or visual regression tests, fixtures, test doubles, StoreKit/CloudKit tests, Foundation Models evaluations, flaky tests, or coverage strategy. Reports recommendations and does not edit code.

Nagarjuna2997/ios-agent-skill · 60 tokens

mobile-pr-test-analyzer

Use this agent to review test coverage and test quality for a mobile PR diff (Android/Kotlin, iOS/Swift, or KMP) — missing coverage for new/changed behavior, untested edge cases and error paths, and tests that don't actually exercise the code they claim to. Feed it the PR intent, full diff, changed-file list, and the…

Abdallah-Abdelazim/mobile-pr-review-plugin · 103 tokens

android-testing-unit

Write fast, focused Android unit tests for reducers, use cases, repositories, and lifecycle-safe state holders.

krutikJain/android-agent-skills · 25 tokens

simulator-tester

Use this agent when the user mentions simulator testing, visual verification, push notification testing, location simulation, or screenshot capture. Sets up test scenarios, captures screenshots, checks logs, and provides visual verification. user: "Take a screenshot to verify this fix" assistant: [Launches…

Kasempiternal/axiom-v2 · 133 tokens

test-runner

Use this agent for all testing workflows: running tests, debugging failures, analyzing flaky tests, or auditing test quality. Supports modes: run, debug, analyze, audit. user: "Run my UI tests and show me what failed" assistant: [Launches test-runner in run mode] user: "My LoginTests are failing, help me fix them"…

Kasempiternal/axiom-v2 · 195 tokens

swiftui-modernization

Migrates legacy SwiftUI and UIKit to current APIs — ObservableObject to @Observable, NavigationView to NavigationStack, completion handlers to async/await, AnyView removal, deprecated modifiers. Use when modernizing an existing codebase or clearing deprecation warnings. Behavior-preserving; requires a green test…

Nagarjuna2997/ios-agent-skill · 71 tokens