golang-testing

golang-testing is a skill for Claude Code, Codex from Luohaothu/everything-codex. It costs 44 tokens per session (4,403 once invoked), scanned A, original, MIT.

A guide to testing Go programs with table-driven tests, subtests, benchmarks, fuzzing, and coverage checks. It also explains TDD, a workflow where you write a failing test, make it pass, then improve the code.

In plain words
What is it for?
Use it when adding Go functions, increasing test coverage, benchmarking performance-sensitive code, testing input validation with fuzzing, or following a TDD workflow.
Why use it?
It gives Go developers repeatable testing patterns instead of making them design each test approach from scratch. This helps catch errors, check unusual inputs, and measure performance and coverage.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it when adding Go functions, increasing test coverage, benchmarking performance-sensitive code, testing input validation with fuzzing, or following a TDD workflow.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/luohaothu/everything-codex/golang-testing
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 Luohaothu/everything-codex --skill golang-testing
Clone the repo
git clone --depth 1 https://github.com/Luohaothu/everything-codex

Made for: Claude Code, Codex.

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 golang-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/luohaothu/everything-codex/golang-testing/github.svg)](https://agentmods.dev/skills/luohaothu/everything-codex/golang-testing)
Your own site
<a href="https://agentmods.dev/skills/luohaothu/everything-codex/golang-testing"><img src="https://agentmods.dev/badge/skills/luohaothu/everything-codex/golang-testing/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 golang-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/luohaothu/everything-codex/golang-testing"><img src="https://agentmods.dev/badge/skills/luohaothu/everything-codex/golang-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,403 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.00044 $0.04403
Opus 5.5 $0.00018 $0.01761
Sonnet 5.5 $0.00009 $0.00881
Haiku 4.5 $0.00004 $0.00440

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

Security

Grade A, and why

golang-testing 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 3mo 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.

docs/zh-CN/skills/golang-testing/SKILL.md · 722 lines

How it starts

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

Go 测试模式

遵循 TDD 方法论,用于编写可靠、可维护测试的全面 Go 测试模式。

何时激活

  • 编写新的 Go 函数或方法时
  • 为现有代码添加测试覆盖率时
  • 为性能关键代码创建基准测试时
  • 为输入验证实现模糊测试时
  • 在 Go 项目中遵循 TDD 工作流时

Go 的 TDD 工作流

红-绿-重构循环

RED     → Write a failing test first
GREEN   → Write minimal code to pass the test
REFACTOR → Improve code while keeping tests green
REPEAT  → Continue with next requirement

Go 中的分步 TDD

// Step 1: Define the interface/signature
// calculator.go
package calculator

func Add(a, b int) int {
    panic("not implemented") // Placeholder
}

// Step 2: Write failing test (RED)
// calculator_test.go
package calculator

import "testing"

func TestAdd(t *testing.T) {
    got := Add(2, 3)
    want := 5
    if got != want {
        t.Errorf("Add(2, 3) = %d; want %d", got, want)
    }
}

// Step 3: Run test - verify FAIL
// $ go test
// --- FAIL: TestAdd (0.00s)
// panic: not implemented

// Step 4: Implement minimal code (GREEN)
func Add(a, b int) int {
    return a + b
}

// Step 5: Run test - verify PASS
// $ go test
// PASS

// Step 6: Refactor if needed, verify tests still pass

表驱动测试

Go 测试的标准模式。以最少的代码实现全面的覆盖。

func TestAdd(t *testing.T) {
    tests := []struct {
        name     string
        a, b     int
        expected int
    }{
        {"positive numbers", 2, 3, 5},
        {"negative numbers", -1, -2, -3},
        {"zero values", 0, 0, 0},
        {"mixed signs", -1, 1, 0},
        {"large numbers", 1000000, 2000000, 3000000},
    }

    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got := Add(tt.a, tt.b)
            if got != tt.expected {
                t.Errorf("Add(%d, %d) = %d; want %d",
                    tt.a, tt.b, got, tt.expected)
            }
        })
    }
}

包含错误情况的表驱动测试

func TestParseConfig(t *testing.T) {
    tests := []struct {
        name    string
        input   string
        want    *Config
        wantErr bool
    }{
        {
            name:  "valid config",
            input: `{"host": "localhost", "port": 8080}`,
            want:  &Config{Host: "localhost", Port: 8080},
        },
        {
            name:    "invalid JSON",
            input:   `{invalid}`,
            wantErr: true,
        },
        {
            name:    "empty input",
            input:   "",
            wantErr: true,
        },
        {
            name:  "minimal config",
            input: `{}`,
            want:  &Config{}, // Zero value config
        },
    }

    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got, err := ParseConfig(tt.input)

            if tt.wantErr {
                if err == nil {
                    t.Error("expected error, got nil")
                }
                return
            }

            if err != nil {
                t.Fatalf("unexpected error: %v", err)
            }

            if !reflect.DeepEqual(got, tt.want) {
                t.Errorf("got %+v; want %+v", got, tt.want)
            }
        })
    }
}

Read the full file on GitHub · 722 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. 3mo ago First seen · 722 lines · 44 tokens per session scan A 615fb94b7790

Subscribe to this mod's changes

golang-testing is a skill published in the GitHub repository Luohaothu/everything-codex (24 stars, last pushed 3mo ago), licensed MIT. It adds 44 tokens to every session and 4,403 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-08-30.

Related

golang-testing compared with skills from other repositories

golang-testing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
golang-testingLuohaothu/everything-codexSkill243mo agoMITA44Claude Code, Codex
golang-testingaffaan-m/ECCSkill315kyesterdayMITA37Claude Code, Kiro
timeouts-and-asynconsi/ginkgoSkill9.1ktodayMITA106Claude Code
setuponsi/ginkgoSkill9.1ktodayMITA118Claude Code
golang-testingsamber/cc-skills-golangSkill4.0k2d agoMITA115Claude Code
golang-stretchr-testifysamber/cc-skills-golangSkill4.0k2d agoMITA97Claude Code
overviewonsi/ginkgoSkill9.1ktodayMITA84Claude Code