Golang Testing
Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices.
Install
/plugin marketplace add xu-xiang/everything-claude-code-zhThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add xu-xiang/everything-claude-code-zh --skill golang-testinggit clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git /tmp/everything-claude-code-zh
mkdir -p ~/.claude/skills
cp -r /tmp/everything-claude-code-zh/docs/zh-TW/skills/golang-testing ~/.claude/skills/golang-testingPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Go 測試模式
用於撰寫可靠、可維護測試的完整 Go 測試模式,遵循 TDD 方法論。
## 何時啟用
- 撰寫新的 Go 函式或方法
- 為現有程式碼增加測試覆蓋率
- 為效能關鍵程式碼建立基準測試
- 實作輸入驗證的模糊測試
- 在 Go 專案中遵循 TDD 工作流程
## Go 的 TDD 工作流程
### RED-GREEN-REFACTOR 循環
```
RED → 先寫失敗的測試
GREEN → 撰寫最少程式碼使測試通過
REFACTOR → 在保持測試綠色的同時改善程式碼
REPEAT → 繼續下一個需求
```
### Go 中的逐步 TDD
```go
// 步驟 1:定義介面/簽章
// calculator.go
package calculator
func Add(a, b int) int {
panic("not implemented") // 佔位符
}
// 步驟 2:撰寫失敗測試(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)
}
}
// 步驟 3:執行測試 - 驗證失敗
// $ go test
// --- FAIL: TestAdd (0.00s)
// panic: not implemented
// 步驟 4:實作最少程式碼(GREEN)
func Add(a, b int) int {
return a + b
}
// 步驟 5:執行測試 - 驗證通過
// $ go test
// PASS
// 步驟 6:如需要則重構,驗證測試仍然通過
```
## 表格驅動測試
Go 測試的標準模式。以最少程式碼達到完整覆蓋。Details
- Skill name
golang-testing- Repository
- xu-xiang/everything-claude-code-zh
- Path
docs/zh-TW/skills/golang-testing/SKILL.md- License
- MIT
- Repo updated
- 5 March 2026
FAQ
What does the Golang Testing skill do?
Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices.
How do I install the Golang Testing skill?
Claude Code plugin: /plugin marketplace add xu-xiang/everything-claude-code-zh. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Golang Testing popular?
It lives in xu-xiang/everything-claude-code-zh, which has 2,037 GitHub stars and 332 forks.
Related skills
Backend Patterns
2kxu-xiang/everything-claude-code-zh
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Coding Standards
2kxu-xiang/everything-claude-code-zh
Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
Frontend Patterns
2kxu-xiang/everything-claude-code-zh
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
Python Testing
2kxu-xiang/everything-claude-code-zh
使用 pytest、TDD 方法论、固件(Fixtures)、模拟(Mocking)、参数化及覆盖率要求的 Python 测试策略。
E2E Testing
2kxu-xiang/everything-claude-code-zh
Playwright E2E 测试模式、页面对象模型 (Page Object Model)、配置、CI/CD 集成、产物管理以及不稳定测试 (Flaky Test) 策略。
Python Testing
2kxu-xiang/everything-claude-code-zh
使用 pytest、TDD 方法论、测试夹具(Fixtures)、模拟(Mocking)、参数化(Parametrization)以及覆盖率要求的 Python 测试策略。
Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.