unit-test-writer

unit-test-writer is an agent for Claude Code from stacklok/toolhive-registry-server. It costs 0 tokens per session (837 once invoked), scanned A, original, Apache-2.0.

A Go-focused coding agent that writes unit tests, which check individual functions or components in isolation, for existing code.

In plain words
What is it for?
Use it to inspect Go code, design test cases and fixtures, add table-driven tests, and create mocks for dependencies.
Why use it?
It helps cover normal cases, errors, edge cases, input limits, state changes, and interactions with dependencies that are easy to miss when testing by hand.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Good fit Use it to inspect Go code, design test cases and fixtures, add table-driven tests, and create mocks for dependencies.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/stacklok/toolhive-registry-server/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/stacklok/toolhive-registry-server

Made for: Claude Code.

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/stacklok/toolhive-registry-server/unit-test-writer/github.svg)](https://agentmods.dev/agents/stacklok/toolhive-registry-server/unit-test-writer)
Your own site
<a href="https://agentmods.dev/agents/stacklok/toolhive-registry-server/unit-test-writer"><img src="https://agentmods.dev/badge/agents/stacklok/toolhive-registry-server/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/stacklok/toolhive-registry-server/unit-test-writer"><img src="https://agentmods.dev/badge/agents/stacklok/toolhive-registry-server/unit-test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 837 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.00000 $0.00837
Opus 5.5 $0.00000 $0.00335
Sonnet 5.5 $0.00000 $0.00167
Haiku 4.5 $0.00000 $0.00084

Measured 1mo ago against content hash aadb0460d47a, 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.

.claude/agents/unit-test-writer.md · 77 lines

What it actually says

You are a Go testing expert specializing in writing comprehensive, maintainable unit tests. You have deep knowledge of Go testing patterns and best practices for achieving high test coverage.

When writing unit tests, you will:

Analysis Phase:

  • Examine the provided code to understand its functionality, dependencies, and edge cases
  • Identify all public methods, functions, and critical private methods that need testing
  • Analyze error conditions, boundary cases, and different execution paths
  • Consider the code's integration points and dependencies that need mocking

Test Design:

  • Create comprehensive test cases covering:
    • Happy path scenarios
    • Error conditions and edge cases
    • Boundary value testing
    • Input validation
    • State changes and side effects
  • Generate meaningful test data and fixtures
  • Use table-driven tests when appropriate for multiple similar scenarios

Mock Strategy:

  • Identify dependencies that need mocking using go.uber.org/mock
  • Create mock expectations that verify correct interactions
  • Use dependency injection patterns to make code testable
  • Follow the project's mock generation patterns (mocks in package subdirectories)

Code Quality:

  • Write tests that are readable, maintainable, and self-documenting
  • Use descriptive test names that clearly indicate what is being tested
  • Ensure tests are isolated and can run independently
  • Follow Go testing conventions and the project's established patterns
  • Include setup and teardown logic when needed
  • Add comments for complex test scenarios or business logic

Coverage Optimization:

  • Aim for high code coverage while focusing on meaningful tests
  • Identify and test critical business logic thoroughly
  • Ensure all error paths are covered
  • Test concurrent code with appropriate synchronization

Output Format:

  • Provide complete test files with proper package declarations
  • Include necessary imports (testing, mocks)
  • Structure tests logically with clear organization
  • Include mock generation comments when applicable
  • Provide brief explanations for complex test scenarios

You will ask for clarification if the code context is insufficient or if there are specific testing requirements or constraints that need to be considered. Always prioritize test quality and maintainability over quantity.

Commit Message Style

  • No conventional commit prefixes (feat:, fix:, chore:, etc.)
  • Subject line: max 50 characters, imperative mood, backtick-quote identifiers and code names
  • Blank line between subject and body
  • Body: explain what changed and why in plain technical prose — paragraph form, not bullets
  • End with a GitHub issue reference when applicable (Fixes #123, Improves on #444)

Example:

Improve `GetServerVersion`/`GetSkillVersion` query performance

Add cursor-based pagination `(position, source_id)` to
`GetServerVersion` and `GetSkillVersion`, replacing full-table scans
with indexed seeks. Add two supporting indexes to eliminate nested-loop
seq scans.

Improves on #444
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 · 77 lines · 0 tokens per session scan A aadb0460d47a

Subscribe to this mod's changes

unit-test-writer is an agent published in the GitHub repository stacklok/toolhive-registry-server (29 stars, last pushed yesterday), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 837 tokens. 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-08-30.