/go:go-testingfrom go
Use when you write, fix, review or debug Go tests (_test.go), including flaky, slow or hanging tests, tests that sleep, hit the network or use testify. Table tests, go-cmp, fakes, httptest, synctest, fuzzing, -race.
Ships in go. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Baseline: the test sections of the Google Go Style Guide (decisions and best practices): no assertion libraries, got before want, (-want +got) diffs, t.Error to keep going and t.Fatal only when the rest cannot run, never t.Fatal off the test goroutine. The rules below add to it.
make test runs go test -race -shuffle=on ./.... Every test passes under both: data races and order dependence are bugs, not flakes.testing plus github.com/google/go-cmp/cmp (cmp.Diff) for structs, slices and maps; no testify (depguard in the lint template rejects it).t.Helper() (thelper enforces it) and take testing.TB when benchmarks or fuzz targets share them.t.Parallel() at the top of the test function AND inside every t.Run() table subtest (paralleltest enforces it). Ensure parallel safety: t.TempDir(), t.Context(), and passing dependencies cleanly. Never call t.Setenv or t.Chdir in parallel tests (keep those in serial tests).name, one t.Run(tt.name, ...) per row. A row that needs fundamentally different setup or assertions is a separate test.tests := []struct{ name string; ... }) without dropping any branch coverage, edge cases, or error checks.@xfail attribute. The house pattern for x-failures is a subtest with t.Skip:
t.Run("xfail: bug description / issue #123", func(t *testing.T) {
t.Skip("xfail: pending driver fix for ...")
// reproduction assertions here
})
Reviewers add this to demonstrate bugs; drivers resolve the source bug, remove t.Skip, and verify that the test passes.t.Context() for every context in a test (cancelled when the test ends, before cleanups), t.TempDir() for every file, t.Setenv/t.Chdir instead of mutating process state (both forbid t.Parallel, so keep them in serial tests). t.Cleanup over defer in helpers.depguard rejects them): generated mocks assert call sequences, which is implementation detail. A double other packages' tests need lives in a <pkg>test package (runstatetest.NewStore), never exported from the package itself.httptest.NewServer for HTTP clients, net.Pipe for connections, real child processes (/bin/sh -c) for process code, the real filesystem under t.TempDir().testing/synctest (stable since 1.25) for anything with timeouts, tickers, backoff or goroutines that must finish: inside synctest.Test(t, func(t *testing.T) {...}) time is fake and jumps when every goroutine in the bubble is blocked, synctest.Wait() waits for them to settle and synctest.Sleep(d) (1.27) does both. Test waits for every goroutine in the bubble, and one blocked forever fails it as a deadlock, so leaks surface (a goroutine stuck on real I/O hangs the test instead).now func() time.Time, time.Now in production) where a timestamp is part of the output (records, logs, golden files): a fixed now makes the bytes stable, which synctest's moving clock does not.time.Sleep to wait for something to happen. Wait on a channel, synctest.Wait(), or poll with a deadline as a last resort for real processes.testdata/<TestName>.golden, a -update flag that rewrites them, scrubbed of ids and times before comparing. Review golden diffs like code.FuzzX(f *testing.F) with seeds from real cases, asserting properties (no panic, round-trip, no path escape). Failing inputs land in testdata/fuzz/ and are committed as regression cases.for b.Loop() { ... }, never b.N; compare with benchstat, never by eye.//go:build integration and run via make test-integration. testing.Short() skips slow but hermetic tests in a check-fast target when the full suite takes minutes; CI runs everything. Binaries and assets a suite downloads (envtest, browsers, fixtures) come from per-user shared stores, never a dir in the worktree (host-hygiene, Shared stores).Read references/PATTERNS.md for table test with fake, test compacting, xfail subtest, golden helper, fake, synctest, fuzz, benchmark, httptest and process test, all run on Go 1.27.2.
go test caches passing results; -count=1 forces a rerun when a test reads files or env the cache can't see.-race needs CGO_ENABLED=1 and a C compiler; a test job with CGO_ENABLED=0 fails with "-race requires cgo" there (macOS does not need cgo for it).-timeout is 10 minutes and its panic dumps every goroutine: read that dump for the blocked one before raising the limit.-coverprofile) is reported, never gated (org standard). -coverpkg=./... counts code exercised by other packages' tests.net.Pipe or httptest.NewTestServer (1.27, in-memory network) there.t.Parallel() subtests run after the parent function returns: a defer in the parent fires before them; use t.Cleanup.What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub giocaizzi/harness --plugin go