unit-test

unit-test is a skill for Claude Code from johnqtcg/awesome-skills. It costs 100 tokens per session (6,897 once invoked), scanned A, original, MIT.

A Go testing workflow for writing unit tests: small tests that check individual functions or components. It supports table-driven cases, where many inputs and expected results are organised in one test, and subtests.

In plain words
What is it for?
Use it to add or improve Go unit tests, investigate failing tests, organise test cases, or enforce a minimum coverage gate.
Why use it?
It helps catch boundary, mapping, and concurrency bugs while keeping tests organised and setting a coverage target for logic packages.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is go test -coverprofile=pkg_a.out -covermode=atomic ./pkg/a.

Good fit Use it to add or improve Go unit tests, investigate failing tests, organise test cases, or enforce a minimum coverage gate.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/johnqtcg/awesome-skills
agentmods
npx agentmods add skills/johnqtcg/awesome-skills/unit-test

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/johnqtcg/awesome-skills/unit-test/github.svg)](https://agentmods.dev/skills/johnqtcg/awesome-skills/unit-test)
Your own site
<a href="https://agentmods.dev/skills/johnqtcg/awesome-skills/unit-test"><img src="https://agentmods.dev/badge/skills/johnqtcg/awesome-skills/unit-test/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

Your own site · 80×15
<a href="https://agentmods.dev/skills/johnqtcg/awesome-skills/unit-test"><img src="https://agentmods.dev/badge/skills/johnqtcg/awesome-skills/unit-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,897 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00100 $0.06897
Opus 5 $0.00050 $0.03449
Sonnet 5 $0.00020 $0.01379
Haiku 4.5 $0.00010 $0.00690

Measured 6d ago against content hash 24bb095b6389, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

unit-test 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 6d ago.

The scan reads SKILL.md. This mod also ships 5 executable files (scripts/run_regression.sh, scripts/tests/test_behavioral_killer.py, scripts/tests/test_golden_scenarios.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/unit-test/SKILL.md · 494 lines

How it starts

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

Go Unit Test

Create and refine Go tests for this repository with table-driven cases and explicit bug-hunting rules.

Quick Reference

When you need to… Jump to
Quick tests for simple functions Light mode — §Execution Modes
Normal feature development Standard mode (default) — §Execution Modes
High-risk / release / concurrent code Strict mode — §Execution Modes
Fix or triage failing tests §Test Execution Hardening
Supplement coverage on existing code §Coverage Gate Policy
Know if a Killer Case is required Standard + Strict modes: always required — §Killer Case
Check Go version compatibility §Go Version Gate
Write a Killer Case §Killer Case — Definition + load references/killer-case-patterns.md

Hard Rules

  • Name test files as <target_file>_test.go, co-located with source.
  • Assertion strategy (adapt to project):
    • If project uses testify: require for fatal preconditions, assert for value checks.
    • If project uses standard library only: use t.Fatalf for fatal preconditions, t.Errorf for value checks. Include got/want in messages: t.Errorf("Name = %q, want %q", got, want).
    • If project uses go-cmp: use cmp.Diff for deep struct comparison. Prefer over field-by-field assertion for complex output.
    • Detection: Check existing _test.go files for "github.com/stretchr/testify" imports. Follow project convention.
  • Keep tests deterministic; isolate time, randomness, environment, and network.
    • Prefer t.Setenv for env changes; avoid leaking global state between tests. Note: t.Setenv panics under t.Parallel() (see Go Version Gate) — for a parallel subtest that needs env isolation, inject config explicitly instead of mutating the process environment.
  • Prefer stable fakes/stubs over heavy mock chains.
    • Unit tests SHOULD NOT require real external services (DB/Redis/HTTP) unless explicitly requested; that belongs to integration tests.
  • Do NOT test constructors (NewXxx) or private helpers unless explicitly requested OR they contain non-trivial logic (validation/defaulting/option-merging) that can break runtime invariants.
  • For service-layer code with interfaces, focus on methods declared in the interface. For pure functions/handlers, focus on exported functions/endpoints.
  • Run with the race detector (go test -race). Scope is the tested package set, not always ./...: PR mode narrows it to changed packages, and a Light pure-function target with no go/chan/sync may run -race on just that package rather than the whole repo. Precedence when the rules below disagree: race.required config > PR scope > mode default. race.required: false disables -race entirely (state it in the report); otherwise -race is required on every tested package.
  • Killer Case hard constraint (Standard + Strict): each test target (interface method / exported function / handler endpoint) must include at least 1 "killer case" (fault-injection or boundary-kill case) that is expected to fail on a known bad mutation/path.
  • In the report, for each killer case, explicitly state: "if this assertion is removed, the known bug can escape detection."

Read the full file on GitHub · 494 lines

Files

What ships with it

32 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 494 lines · 100 tokens per session scan A 24bb095b6389

Subscribe to this mod's changes

unit-test is a skill published in the GitHub repository johnqtcg/awesome-skills (30 stars, last pushed today), licensed MIT. It adds 100 tokens to every session and 6,897 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-09-03.

Related

Other skills, from other repositories

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI…

alexastrum/skl · 115 tokens

golang-stretchr-testify

Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use when writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Covers testify assertions, mock expectations, argument matchers, call verification…

alexastrum/skl · 97 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

verify-implementation

A workflow that runs a project’s verification skills to produce a report on coding patterns, architecture rules, and project conventions. It is intended for work after implementation, before a pull request, or during code review.

sangrokjung/claude-forge · 37 tokens

verification-engine

Use when verifying build/test/lint before commit, PR, or completion claims. Runs verification pipeline in fresh subagent context with auto-repair. Triggers on /handoff-verify, pre-commit check, build verification, test validation.

sangrokjung/claude-forge · 52 tokens

ci-tests

Run the test suite for the current repo, auto-detecting Python (pytest/uv), Node (vitest/pnpm), or Rust (cargo test).

FlorianBruniaux/claude-code-plugins · 35 tokens