go-testing-quality

Write and review Go tests using table-driven patterns, testify, fuzzing, benchmarks, and pprof profiling.

1|Updated Jul 29, 2026
One-click install
npx skills add https://github.com/fusengine/kimi-code --skill go-testing-quality-fusengine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: go-testing-quality
Source: https://github.com/fusengine/kimi-code/tree/main/plugins/go-expert/skills/go-testing-quality
Command: npx skills add https://github.com/fusengine/kimi-code --skill go-testing-quality-fusengine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/stretchr/testify, and includes references (resource) components.

What problem does it solve? Go developers often write inconsistent or shallow tests, miss data races, and optimize code without evidence. This Skill provides idiomatic, current Go testing and quality practices so test suites are thorough, maintainable, and backed by real measurements. ## Core Features & Use Cases - Table-Driven Tests & Subtests: Standard Go test shape with named cases, t.Run isolation, parallel subtests, and t.Helper/t.Cleanup patterns. - Testify Assertions & Mocks: Guidance on assert vs require, hand-written mocks with testify/mock, suites, and mock generation with mockery or gomock. - Fuzzing, Benchmarks & Profiling: Native fuzz targets with invariants, benchmarks using the Go 1.24+ b.Loop idiom, coverage analysis, the race detector, pprof, and PGO. - Use Case: You are reviewing a Go service's test suite before release. Use this Skill to convert ad-hoc tests into table-driven subtests, add a fuzz target for the input parser, and run go test ./... -race -cover to find gaps and data races. ## Quick Start Use the go-testing-quality skill to write table-driven tests with testify assertions for my Go package and add a fuzz test for its parser.

Frequently Asked Questions about go-testing-quality

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write table-driven tests in Go?▼

Define a slice of anonymous structs holding inputs and expected outputs, loop over it, and run each case with t.Run(tc.name, ...) for isolation. Name every case so you can target it with go test -run TestName/casename, and use t.Fatalf for precondition failures and t.Errorf for independent field checks.

What is the difference between testify assert and require?▼

assert records a failure and continues the test, returning a bool for guarding further checks. require records a failure and aborts the test via t.FailNow. Use require for preconditions like unexpected errors and assert for the actual independent expectations.

How do I run fuzz tests in Go?▼

Write a function like func FuzzXxx(f *testing.F), seed the corpus with f.Add, and assert invariants inside f.Fuzz. Run it with go test -run=Fuzz -fuzz=FuzzXxx -fuzztime=30s; crashers are saved to testdata/fuzz and replayed as regression cases.

Does the Go race detector guarantee my code is race-free?▼

No. A clean go test -race run only reports races actually exercised during execution, so it is not a proof of absence. Pair it with t.Parallel() and realistic concurrency in tests, and run it in CI on every pull request.

When should I use PGO in Go?▼

Use Profile-Guided Optimization after benchmarks and pprof profiles confirm real hotspots in production. Save a representative CPU profile as default.pgo in the main package directory and go build picks it up automatically, typically yielding single-digit percent gains.

When should I not use this Go testing skill?▼

Do not use it for CI pipeline wiring, golangci-lint or govulncheck setup, which belong to tooling and security skills. It also does not cover project architecture, SOLID enforcement, or non-Go test suites like Pest, Vitest, Jest, or cargo test.