go-test-seam-discipline

Refactor Go code to remove test-driven abstractions and preserve runtime semantics.

Updated Jun 15, 2026
One-click install
npx skills add https://github.com/tanghuo/th-skill --skill go-test-seam-discipline
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-test-seam-discipline
Source: https://github.com/tanghuo/th-skill/tree/main/skills/go-test-seam-discipline
Command: npx skills add https://github.com/tanghuo/th-skill --skill go-test-seam-discipline

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps maintain clean, production-focused code in Go by identifying and removing test-driven abstractions that don't belong in the runtime codebase.

Core Features & Use Cases

  • Identify Test-Only Abstractions: Detects and removes abstractions like function fields, local interfaces, nil guards, and convenience constructors that exist only to support tests.
  • Refactoring Guidance: Provides a structured approach to refactor code, ensuring that seams and abstractions are only introduced for production reasons.
  • Use Case: When refactoring Go code, use this Skill to ensure that your tests adapt to the production design, not the other way around.

Quick Start

Use the go-test-seam-discipline skill to review the 'main.go' file and remove unnecessary test-driven abstractions.

Frequently Asked Questions about go-test-seam-discipline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove test-driven abstractions from Go production code?

To remove test-driven abstractions in Go, refactor the codebase to eliminate function fields, local interfaces, nil guards, and convenience constructors that exist solely to support tests, ensuring runtime semantics remain unchanged.

What is a test seam in Go and when should I refactor it?

A test seam in Go is an abstraction like a function field or local interface introduced specifically to support testing. You should refactor it when the abstraction serves no production purpose and dictates the runtime code structure.

How do I stop tests from dictating my Go production code structure?

Stop tests from dictating Go production code structure by applying test seam discipline: identify test-only abstractions like nil guards and convenience constructors, then refactor the code so tests adapt to the production design instead.

Does refactoring Go code to remove test seams change runtime behavior?

Refactoring Go code to remove test seams maintains runtime semantics. The process targets and eliminates test-only abstractions without altering the actual runtime behavior or production logic of the application.

What is the best way to separate test code from production code in Go?

The best way to separate test from production code in Go is to remove test-driven abstractions—such as unnecessary function fields and local interfaces—ensuring seams are only introduced for genuine production reasons rather than testing convenience.

Why does my Go codebase have unnecessary interfaces and nil guards?

Your Go codebase likely has unnecessary interfaces and nil guards because they were added as test-driven abstractions to support mocking. These seams should be removed if they do not serve a valid production purpose.