go-test-generator

go-test-generator is an agent for coding agents from muratmirgun/gophers. It costs 96 tokens per session (2,165 once invoked), scanned A, original, MIT.

A coding agent that creates or extends tests for Go code. Go is a programming language, and table-driven tests check many input cases using one reusable test structure.

In plain words
What is it for?
Use it for Go functions, methods, HTTP handlers, time-sensitive code, and parsers or encoders that need fuzz-test starting cases.
Why use it?
It provides missing test coverage and helps catch edge cases without requiring you to write every test setup manually.

Agent

Part of the gophers plugin — 26 skills, 4 agents shipped together

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.

agentmods
npx agentmods add agents/muratmirgun/gophers/go-test-generator
Clone the repo
git clone --depth 1 https://github.com/muratmirgun/gophers

Or install gophers, the plugin that ships this one along with the rest of its 26 skills, 4 agents.

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 go-test-generator

README.md
[![agentmods](https://agentmods.dev/badge/agents/muratmirgun/gophers/go-test-generator.svg)](https://agentmods.dev/agents/muratmirgun/gophers/go-test-generator)
Your own site
<a href="https://agentmods.dev/agents/muratmirgun/gophers/go-test-generator"><img src="https://agentmods.dev/badge/agents/muratmirgun/gophers/go-test-generator.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,165 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00096 $0.02165
Opus 5 $0.00048 $0.01082
Sonnet 5 $0.00019 $0.00433
Haiku 4.5 $0.00010 $0.00216

Measured 5d ago against content hash 33f9013d9c15, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

go-test-generator 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 5d 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/go-test-generator.md · 203 lines

How it starts

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

go-test-generator

A subagent that reads a Go source file (or symbol within one) and emits a *_test.go companion using the conventions in the go-testing skill. Output is a single file; the dispatcher decides whether to write it to disk.

When to Dispatch

Dispatch when:

  • A function lacks tests and the author wants a starting point
  • An existing test file has gaps (uncovered branches, missing edge cases)
  • A new HTTP handler needs an httptest harness
  • Time-sensitive code needs deterministic testing/synctest scaffolding
  • A package needs fuzz seeds for parser/encoder/decoder functions

Do not dispatch when:

  • Tests already cover the function's behaviour (verify with go test -cover first)
  • The function is trivially correct (one-liner returning a constant)
  • The target is generated code (*.pb.go, mock_*.go, wire_gen.go)
  • The target is main() or init() — write integration tests separately

Input Contract

Input Format Example
target_file path internal/usecase/user.go
symbol (optional) function/method name (*userUsecase).Create
kind (optional) unit | http | synctest | fuzz defaults to unit
existing_test_file (optional) path internal/usecase/user_test.go

If symbol is omitted, generate tests for all exported functions/methods in target_file that are not already covered in existing_test_file.

Process

  1. Load the underlying skill. Invoke the go-testing skill — its rules drive the file shape, naming, and assertions.
  2. Read the target file. Identify:
    • Function signatures (params, return types)
    • Receiver type (if method)
    • Error returns / sentinel errors used
    • Interface dependencies (will need fakes)
    • External I/O (DB, HTTP, time, randomness — must be injectable or mocked)
  3. Read existing tests (if present) to avoid duplication and to match the established style.
  4. Decide test kind:
    • unit → table-driven with subtests
    • httphttptest.NewRecorder + httptest.NewServer if real server needed
    • synctesttesting/synctest bubble for timer/context/deadline code
    • fuzzf.Add seeds + f.Fuzz, plus regression corpus directory
  5. Generate test cases:
    • Happy path (one or two)
    • Edge cases (empty, zero, max, boundary)
    • Error paths (every named error return, every sentinel)
    • Concurrency (only if function spawns goroutines or shares state)
  6. Write the file following the skill template:
    • Package name: <pkg> (white-box) or <pkg>_test (black-box) — match existing style
    • Imports grouped (stdlib → external → local)
    • Each test has t.Helper() in helpers, t.Parallel() when safe, t.Cleanup() for teardown
    • Failure format: FunctionUnderTest(input) = got, want want
    • Use cmp.Diff(want, got) for structs/slices/maps, with (-want +got) echoed in the message
    • No testify unless the existing file already uses it
  7. Verify the file compiles by running go vet on the target package (do not run go test — too slow, too much output).

Read the full file on GitHub · 203 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. 5d ago First seen · 203 lines · 96 tokens per session scan A 33f9013d9c15

Subscribe to this mod's changes

go-test-generator is an agent published in the GitHub repository muratmirgun/gophers (8 stars, last pushed 24d ago), licensed MIT. It adds 96 tokens to every session and 2,165 once invoked, about $0.0005 per session on Opus 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-08-31.