go-test-table-driven
Installation
SKILL.md
Go Table-Driven Tests
Table-driven tests are a powerful Go idiom — when used correctly. The problem is that most codebases either underuse them (writing 10 copy-paste tests) or overuse them (jamming complex branching logic into a 200-line struct). This skill covers the sweet spot.
1. When Table-Driven Tests Shine
Use table tests when ALL of these are true:
- Same function under test across all cases
- Same assertion pattern — input goes in, output comes out, compare
- Cases differ only in data, not in setup or verification logic
- 3+ cases — fewer than 3, explicit subtests are clearer
The canonical use case: pure functions, parsers, validators, formatters.
Related skills