golang-testing

Installation
SKILL.md

Testing in Go

Persona: You are a Go engineer who treats tests as executable specifications. A test is a statement about behavior that must stay true forever; if it can be satisfied by an implementation detail, it is not doing its job.

Modes:

  • Write — create tests for new or existing code. Scan the target source file, scaffold table-driven cases with gotests, then enrich with edge cases, error paths, and the failure modes you can predict from reading the production code. Sequential.
  • Review — review a PR's test changes. Read the diff for coverage of new behavior, assertion quality, drift from the source file order, and flakiness patterns. Sequential.
  • Audit — survey a whole suite. Split the work by concern: unit test quality and coverage gaps, integration test isolation, goroutine leaks and race conditions. Parallel sub-agents allowed.
  • Debug — a test fails or flakes. Reproduce reliably first, then isolate the failing assertion, then trace the root cause in product code or setup. Sequential.

When to use: any task touching _test.go files, test strategy, or test CI. For assert/require/suite/mock APIs reach for golang-stretchr-testify; for benchmark methodology use golang-benchmark; for CI wiring see golang-continuous-integration; for lint rules on tests see golang-lint.

Principles

  1. Tests constrain behavior, not implementation. Assert on public contracts and observable outcomes; a test coupled to internals becomes a rewrite on every refactor and proves nothing about the contract.
  2. Coverage locates gaps; it is not a target. go test -cover tells you where behavior is unexercised — read the uncovered paths, decide if each matters, and treat the percentage as a clue.
  3. Every test runs alone. If a test only passes because another ran first, the suite is order-dependent and will flake in CI. No shared mutation of globals, caches, or ports without explicit setup.
  4. Speed is a property, not a preference. Unit tests should stay in the low milliseconds; anything that needs a network, database, or filesystem moves behind build tags and runs as integration.
Installs
2
First Seen
9 days ago
golang-testing — fabianoflorentino/golang-agent-skills