GO

go-table-driven-tests

Implements table-driven testing patterns in Go to reduce code duplication and improve test coverage for complex logic.

Install

mkdir -p .claude/skills/go-table-driven-tests && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3238" && unzip -o skill.zip -d .claude/skills/go-table-driven-tests && rm skill.zip

Installs to .claude/skills/go-table-driven-tests

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Write Go table-driven tests following Go community best practices and this repository's conventions. Use when writing or refactoring Go tests, especially when you notice repeated test patterns or copy-pasted test code.
218 chars✓ has a “when” trigger
Beginner

Key capabilities

  • →Define test cases using slice or map patterns
  • →Execute subtests using t.Run
  • →Implement optional precondition setup functions
  • →Run tests in parallel with t.Parallel
  • →Compare errors using errors.Is

How it works

It iterates over a defined table of test cases, executing each as a subtest using t.Run to ensure systematic coverage and maintainable code.

Inputs & outputs

You give it
A slice or map of test cases containing input and expected output
You get back
Execution results for each test case via t.Run

When to use go-table-driven-tests

  • →Writing repeatable tests for functions with multiple inputs
  • →Refactoring legacy test code to reduce duplication
  • →Adding edge-case coverage to existing Go functions

About go-table-driven-tests

Provides templates and best practices for creating table-driven tests in Go. It simplifies adding new test cases and helps enforce systematic coverage for functions with multiple input paths.

Write Go table-driven tests following Go community best practices and this repository's conventions. Use when writing or refactoring Go tests, especially when you notice repeated test patterns or copy-pasted test code.

When not to use it

  • →Unrelated test scenarios
  • →Tests requiring substantially different setup or teardown logic

Limitations

  • →Requires named structs for clarity
  • →Requires manual range variable capture for Go versions below 1.22

How it compares

Unlike traditional tests that require separate functions for each case, this approach uses a single function to iterate over a data-driven table.

Compared to similar skills

go-table-driven-tests side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
go-table-driven-tests (this skill)19moReviewBeginner
go-dev-guidelines141yNo flagsIntermediate
code-formatting15moNo flagsBeginner
tidb-test-guidelines24moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

go-dev-guidelines

jumppad-labs

This skill should be used when writing, refactoring, or testing Go code. It provides idiomatic Go development patterns, TDD-based workflows, project structure conventions, and testing best practices using testify/require and mockery. Activate this skill when creating new Go features, services, packages, tests, or when setting up new Go projects.

1495

code-formatting

openshift

MANDATORY: When writing Go tests, you MUST use 'When...it should...' format for ALL test names. When writing any Go code, you MUST remind user to run 'make lint-fix' and 'make verify'. These are non-negotiable HyperShift requirements.

112

tidb-test-guidelines

pingcap

Decide where to place TiDB tests and how to write them (basic structure, naming, testdata usage). Use when asked about test locations, writing conventions, shard_count limits, casetest categorization, or when reviewing test changes in code review.

210

run-tests

pgschema

Run pgschema automated tests (go test) to validate diff logic, plan generation, and dump functionality using test fixtures

13

lsp-hover-testing

MadAppGang

Automated LSP hover validation for Dingo transpiler. Use when testing hover functionality, validating position mappings, checking for hover drift, or debugging LSP issues after sourcemap changes.

12

go-rig

mudrii

Use this skill when building, reviewing, or refactoring Go code in this repository. It adds process discipline for TDD/ATDD, package boundaries, dependency injection, and review quality, and complements the always-on rules in AGENTS.md.

00

Search skills

Search the agent skills registry