unit-test

unit-test is a skill for Claude Code from johnqtcg/awesome-skills. It costs 100 tokens per session (7,767 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. Also seen: mentions Claude Code.

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 with agentmods
npx agentmods add skills/johnqtcg/awesome-skills/unit-test
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.

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

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 7,767 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.07767
Opus 5.5 $0.00040 $0.03107
Sonnet 5.5 $0.00020 $0.01553
Haiku 4.5 $0.00010 $0.00777

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

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 · 505 lines

How it starts

The opening of the file, as written. The whole thing — 505 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, name its critical assertion(s) and report Kill: Verified — you injected the named defect through go test -overlay (never by editing the source), re-ran the test, observed the FAIL, and quote the failure line — or Kill: Unverified plus why you could not run it. An unverified kill is a defect hypothesis, not a demonstrated result: never write it as one.
  • Do NOT claim an assertion is indispensable unless you checked that separately. Injecting the defect shows the case catches it; only deleting the named assertion while the defect is still injected and seeing the test PASS shows that assertion is what catches it. Redundant assertions are normal — report Assertion necessity only when that removal check was actually run, never as a blanket statement. → recipe: references/killer-case-patterns.md § Verifying the Kill.

Read the full file on GitHub · 505 lines

Files

What ships with it

36 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. 1mo ago Changed · +1 lines e10027b78838
  2. 1mo ago Changed · -2 lines 933acd5ca11c
  3. 1mo ago Changed · +12 lines 640ec39d5357
  4. 1mo 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 16d ago), licensed MIT. It adds 100 tokens to every session and 7,767 once invoked, about $0.0004 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 skills, from other repositories

golang-testing

Go testing best practices including table-driven tests, test helpers, benchmarking, race detection, coverage analysis, and integration testing patterns. Use when writing or improving Go tests.

affaan-m/ECC · 37 tokens

golang-testing-patterns

Modern Go testing patterns including table-driven tests, subtests, test organization, and best practices. Use when writing or refactoring tests, implementing test coverage, or when the user asks about Go testing approaches.

codeready-toolchain/tarsy · 47 tokens

test-go

Write, review, and improve Go test code for this project. Use whenever generating, reviewing, or modifying Go tests - including when invoked by the Tester agent, the /test prompt, or any test-related request. Covers table-driven tests, subtests, t.Parallel(), test helpers with t.Helper(), error assertions via…

sergeyklay/.agents · 109 tokens

go-testing

Use when writing, reviewing, or improving Go test code — including table-driven tests, subtests, parallel tests, test helpers, test doubles, and assertions with cmp.Diff. Also use when a user asks to write a test for a Go function, even if they don't mention specific patterns like table-driven tests or subtests. Does…

cxuu/golang-skills · 80 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…

aiskillstore/marketplace · 97 tokens

go-testing-with-testify

Write, review, or harden Go tests using stretchr/testify assert, require, mock, or suite. Use for assertion choice, test doubles, subtests, concurrency, and flake triage in an existing Go test setup. Use coding-guidance-go for production code or non-testify tests and tester-mindset for test strategy without concrete…

n-n-code/n-n-code-skills · 79 tokens