Go test table driven
Deep dive on table-driven tests in Go: when to use them, when to avoid them, struct design, subtest naming.
Safety check
- Claude rated it 6 out of 10, under our bar of 7, so we do not sell it. It is a free link to its author.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: go-test-table-driven
description: >
Deep dive on table-driven tests in Go: when to use them, when to avoid
them, struct design, subtest naming, advanced patterns like test matrices
and shared setup, and refactoring bloated tables into clean ones. Use when
writing table-driven tests, refactoring test tables, reviewing table test
structure, or deciding whether table-driven is the right approach. Trigger
examples: "table-driven test", "table test", "test cases struct", "test
matrix", "parametrize tests", "data-driven test", "refactor test table".
Not for: general test strategy, mocks, golden files, fuzzing
(go-test-quality), benchmarks (go-performance-review).
user-invocable: true
license: MIT
compatibility: Designed for Claude Code or similar AI coding agents working on Go projects. Requires the Go toolchain.
allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(gofmt:*)
metadata:
author: eduardo-sl
version: "1.2.2"
---
# Go Table-Driven Tests
Table-driven tests are a powerful Go idiom — when used correctly. Most
codebases either underuse them (10 copy-paste tests) or overuse them
(complex branching logic in a 200-line struct). This skill covers the
sweet spot.
> Community default. A project skill or agent-config rule that explicitly
> supersedes `go-test-table-driven` takes precedence over this one.
Detailed reference material, loaded on demand:
- `references/patterns.md` — full worked examples: canonical tables,
`wantErr`/`wantErrIs`, parallel tables, map-based tables, error-only
tables, struct alignment for readability.
- `references/refactoring.md` — recognizing bloated tables and rewriting
them as explicit subtests, with before/after examples.
Read a reference file only when the summary below is not enough for the
...From eduardo-sl's repository, MIT licence.
Related skills
-
Checked
JUnit and Mockito tests
Writes and fixes Java tests with JUnit, AssertJ and Mockito that are deterministic and keep failures visible.
8/101 credit -
Checked
Test code review
Reviews new or changed tests in pytest, Jest, Go and more, so weak tests are caught before merge.
7/101 credit -
Checked
Go table driven tests
Writes Go tests with table cases, fakes, fuzzing, benchmarks and golden files that stay fast and reliable.
8/101 credit -
Checked
MSTest Unit Testing
Writes modern C# unit tests with current MSTest APIs, assertions, data driven tests and lifecycle patterns.
8/101 credit -
Checked
Quarkus Testing
Writes and fixes Quarkus tests using Dev Services containers, with the right profiles, mocks and run commands.
7/101 credit -
Checked
Dotnet Test Hot Reload
Sets up a live .NET test host that reruns your tests automatically each time you edit the code.
7/101 credit