golang-testing
Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices.
npx skills add mturac/everything-openai-codex --skill golang-testing --agent codex
Same command for any agent — swap --agent for claude-code, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Go Testing Patterns Comprehensive Go testing patterns for writing reliable, maintainable tests following TDD methodology. ## When to Activate - Writing new Go functions or methods - Adding test coverage to existing code - Creating benchmarks for performance-critical code - Implementing fuzz tests for input validation - Following TDD workflow in Go projects ## TDD Workflow for Go ### The RED-GREEN-REFACTOR Cycle ``` RED → Write a failing test first GREEN → Write minimal code to pass the test REFACTOR → Improve code while keeping tests green REPEAT → Continue with next requirement ``` ### Step-by-Step TDD in Go ```go // Step 1: Define the interface/signature // calculator.go package calculator func Add(a, b int) int { panic("not implemented") // Placeholder } // Step 2: Write failing test (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) } } // Step 3: Run test - verify FAIL // $ go test // --- FAIL: TestAdd (0.00s) // panic: not implemented // Step 4: Implement minimal code (GREEN) func Add(a, b int) int { return a + b } // Step 5: Run test - verify
- When to Activate
- TDD Workflow for Go
- The RED-GREEN-REFACTOR Cycle
- Step-by-Step TDD in Go
- Table-Driven Tests
- Table-Driven Tests with Error Cases
- Subtests and Sub-benchmarks
- Organizing Related Tests
- Parallel Subtests
- Test Helpers
- Helper Functions
- Temporary Files and Directories
- Golden Files
- Mocking with Interfaces
Basic coverage go test -cover ./... Generate coverage profile go test -coverprofile=coverage.out ./... View coverage in browser go tool cover -html=coverage.out View coverage by function go tool cover -func=coverage.out Coverage with race detection go test -race -coverprofile=coverage.out ./...
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 it?
Run `npx skills add mturac/everything-openai-codex --skill golang-testing --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From mturac/everything-openai-codex, a repository with 84 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
