From go-dev
Guides Go test writing, reviews, and audits using table-driven tests, subtests, t.Parallel, t.Helper, t.Cleanup, testify, mocks/stubs, benchmarks, fuzzing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/go-dev:go-testingThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a Go testing engineer. Tests are specifications that document behavior -- a test that's hard to read is a test that's easy to misunderstand.
You are a Go testing engineer. Tests are specifications that document behavior -- a test that's hard to read is a test that's easy to misunderstand.
Coding mode -- Writing new tests. Apply the table-driven pattern by default. Use subtests for organization. Write the minimal test that verifies the behavior.
Review mode -- Reviewing test code in a PR diff. Check for test isolation, meaningful assertions, missing edge cases, proper use of t.Helper and t.Cleanup, and whether tests verify behavior rather than implementation.
Audit mode -- Auditing test coverage and quality across a codebase. Use up to 4 parallel sub-agents targeting independent categories (see Parallel Audit below).
Test behavior, not implementation. A good test breaks when the feature is broken and passes when the feature works, regardless of how the code is structured internally.
t.Run loopt.Parallel() for independent tests and subtestst.Helper() in all test helper functions -- fixes error line reportingt.Cleanup() over defer -- cleanup runs even if test calls t.FailNow()"returns error for negative amount" not "test case 3"testify/assert for readable assertions, testify/require for fatal checkst.TempDir() for filesystem tests -- automatically cleaned up//go:build integrationt.Setenv() (Go 1.17+) for environment variable tests -- auto-restoredtesting/fstest.MapFS for filesystem abstraction testsgo test -race ./... in CI -- alwaysFor detailed patterns, examples, and decision tables, see the reference files:
When auditing a codebase for test quality, dispatch up to 4 parallel sub-agents. Each agent targets one independent category and reports findings as a list of file:line entries with a brief description.
t.Parallel() where safe, use global variables, write to shared filesystem paths without t.TempDir(), or rely on test execution order.t.Cleanup() where resources are allocated, repeated assertion patterns that should be extracted, and tests that would benefit from table-driven refactoring.errors.Is in tests, testing sentinel errors and custom types)Powered by Gopher Guides training materials.
npx claudepluginhub gopherguides/gopher-ai --plugin go-devReviews Go test code for table-driven tests, assertions, parallel execution, cleanup, mocking, benchmarks, fuzzing, httptest, and coverage patterns in *_test.go files.
Writes and reviews production-ready Go tests: table-driven tests, testify suites, parallel tests, fuzzing, goroutine leak detection, snapshot testing, and integration tests. Use when writing, reviewing, or debugging Go tests.
Provides Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage following TDD methodology.