go-table-driven-tests

Installation
SKILL.md

Go Table-Driven Tests

Use this skill when writing or modifying Go table-driven tests. It ensures tests follow established patterns.

Core Principles

  • One test function, many cases - Define test cases in a slice and iterate with t.Run()
  • Explicit naming - Each case has a name field that becomes the subtest name
  • Structured inputs - Use struct fields for inputs, expected outputs, and configuration
  • Helper functions - Use t.Helper() in test helpers for proper line reporting
  • Environment guards - Skip integration tests when credentials are unavailable

Table Structure Pattern

Related skills
Installs
67
GitHub Stars
2
First Seen
Jan 23, 2026