everything-claude-code-zh: Command for Claude Code

.opencode/commands/go-test.md

go-test is a command for Claude Code, OpenCode from xu-xiang/everything-claude-code-zh. It costs 13 tokens per session (773 once invoked), scanned A, original, MIT.

A Go development workflow based on test-driven development (TDD), a method of writing tests before the code that makes them pass.

In plain words
What is it for?
Use it to define Go interfaces and data types, write table-driven tests, implement the smallest passing solution, and add benchmark tests to measure performance.
Why use it?
It gives implementation work a clear test-first cycle and checks both expected results and errors. Table-driven tests group many input-and-result cases in one test structure.

Command for Claude CodeOpenCode

Written for Claude Code and OpenCode: $ARGUMENTS substitution, but also installed under .opencode/. Also seen: agent in frontmatter.

This is xu-xiang/everything-claude-code-zh's own configuration. It tells Claude Code and OpenCode how to work on everything-claude-code-zh itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything everything-claude-code-zh configures →

Part of the everything-claude-code-zh plugin — 17 skills, 26 commands, 13 agents shipped together

About the project

everything-claude-code-zh is a Chinese translation of a collection of configurations for Claude Code and other AI coding agents. It provides agents, skills, hooks, commands, rules, and MCP configurations intended to support development workflows such as memory persistence, security scanning, evaluation, and research-first work. The catalogue includes commands, skills, agents, instructions, and a plugin from this configuration set.

xu-xiang/everything-claude-code-zh · 1,931 stars · on GitHub · oneskill.one

Reuse

Borrowing it

Nothing to install: this file belongs to xu-xiang/everything-claude-code-zh. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/xu-xiang/everything-claude-code-zh/main/.opencode/commands/go-test.md
Clone the repo
git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh

Made for: Claude Code, OpenCode.

Or install everything-claude-code-zh, the plugin that ships this one along with the rest of its 17 skills, 26 commands, 13 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

README.md
[![agentmods](https://agentmods.dev/badge/commands/xu-xiang/everything-claude-code-zh/go-test.svg)](https://agentmods.dev/commands/xu-xiang/everything-claude-code-zh/go-test)
Your own site
<a href="https://agentmods.dev/commands/xu-xiang/everything-claude-code-zh/go-test"><img src="https://agentmods.dev/badge/commands/xu-xiang/everything-claude-code-zh/go-test.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 773 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.1 $0.00013 $0.00773
Opus 5 $0.00006 $0.00387
Sonnet 5 $0.00003 $0.00155
Haiku 4.5 $0.00001 $0.00077

Measured 7d ago against content hash 2ee9ef1b0e56, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

go-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 7d 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.

.opencode/commands/go-test.md · 132 lines

How it starts

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

Go 测试命令 (Go Test Command)

使用 Go 测试驱动开发(TDD)方法论实现:$ARGUMENTS

任务目标

遵循 Go 惯用法应用测试驱动开发:

  1. 定义类型 - 接口(Interfaces)与结构体(Structs)
  2. 编写表格驱动测试(Table-Driven Tests) - 确保全面覆盖
  3. 编写最小代码实现 - 通过测试
  4. 基准测试(Benchmark) - 验证性能

Go 语言的 TDD 循环

步骤 1:定义接口

type Calculator interface {
    Calculate(input Input) (Output, error)
}

type Input struct {
    // 字段
}

type Output struct {
    // 字段
}

步骤 2:表格驱动测试

func TestCalculate(t *testing.T) {
    tests := []struct {
        name    string
        input   Input
        want    Output
        wantErr bool
    }{
        {
            name:  "有效输入",
            input: Input{...},
            want:  Output{...},
        },
        {
            name:    "无效输入",
            input:   Input{...},
            wantErr: true,
        },
    }

    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got, err := Calculate(tt.input)
            if (err != nil) != tt.wantErr {
                t.Errorf("Calculate() error = %v, wantErr %v", err, tt.wantErr)
                return
            }
            if !reflect.DeepEqual(got, tt.want) {
                t.Errorf("Calculate() = %v, want %v", got, tt.want)
            }
        })
    }
}

步骤 3:运行测试(失败/红色 - RED)

go test -v ./...

步骤 4:实现(通过/绿色 - GREEN)

func Calculate(input Input) (Output, error) {
    // 最小化实现
}

步骤 5:基准测试

func BenchmarkCalculate(b *testing.B) {
    input := Input{...}
    for i := 0; i < b.N; i++ {
        Calculate(input)
    }
}

Go 测试相关命令

# 运行所有测试
go test ./...

# 运行并显示详细输出
go test -v ./...

# 运行并显示覆盖率
go test -cover ./...

# 运行并开启竞态检测
go test -race ./...

# 运行基准测试
go test -bench=. ./...

# 生成覆盖率报告
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

测试文件组织结构

package/
├── calculator.go       # 实现代码
├── calculator_test.go  # 测试代码
├── testdata/           # 测试固件/样本数据
│   └── input.json
└── mock_test.go        # Mock 实现

Read the full file on GitHub · 132 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. 7d ago First seen · 132 lines · 13 tokens per session scan A 2ee9ef1b0e56

Subscribe to this mod's changes

go-test is a command published in the GitHub repository xu-xiang/everything-claude-code-zh (1,931 stars, last pushed 6mo ago), licensed MIT. It adds 13 tokens to every session and 773 once invoked, about $0.0001 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-30.