From go-specialist
Detects white box Go tests (package foo in foo_test.go) and proposes conversion to black box (package foo_test), creating export_test.go for unexported symbols. Enforces via golang-pro agent.
How this skill is triggered — by the user, by Claude, or both
Slash command
/go-specialist:go-blackboxThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Detect Go test files using white box testing (same package name) and propose conversion to black box testing (`package foo_test`). Creates `export_test.go` bridge files when internal symbols need external test access.
Detect Go test files using white box testing (same package name) and propose conversion to black box testing (package foo_test). Creates export_test.go bridge files when internal symbols need external test access.
*_test.go files during implementation.go file and one *_test.go file to analyze.Use Glob to find all test files:
**/*_test.go
Exclude vendor/ and export_test.go files from analysis.
For each *_test.go file, read the package declaration (first non-comment, non-blank line starting with package).
Classification rules:
| Package declaration | Source package | Classification |
|---|---|---|
package foo_test | foo | Black box (correct) |
package foo | foo | White box (needs conversion) |
package foo_test | N/A (no source) | Black box (standalone) |
To determine the source package: look for non-test .go files in the same directory and read their package declaration.
For each directory containing test files, check whether an export_test.go already exists.
Present a summary table:
| File | Package | Classification | export_test.go |
|---|---|---|---|
calc_test.go | calculator | White box | No |
math_test.go | calculator_test | Black box | N/A |
internal_test.go | parser | White box | Yes |
For each white box test file identified:
Read the test file and identify references to unexported symbols (lowercase-initial identifiers) from the package under test:
Case A — No unexported symbols used:
package foo to package foo_testAdd(1, 2) → calculator.Add(1, 2))Case B — Unexported symbols used:
package foo to package foo_test in the test fileexport_test.go in the same directory with package foo (no _test suffix) that exports needed internals:package foo
// Exported for testing in foo_test package.
var (
TestableInternalFunc = internalFunc
TestableInternalVar = internalVar
)
Case C — Heavy internal coupling (>10 unexported references):
After conversion, run:
go test ./...
go vet ./...
If tests fail, diagnose: missing imports, renamed references, or unexported symbols not yet bridged via export_test.go.
export_test.go (Go convention)_test suffix) — this is what makes it a bridgeexport_test.go only during go testTestable or use the capitalized form of the original name// Exported for testing in <pkg>_test package. header comment| Condition | Action |
|---|---|
No go.mod found | Abort: "Not a Go module." |
| No test files found | Report: "No test files found. Nothing to analyze." |
| All tests already black box | Report: "All test files use black box naming. No conversion needed." |
| Test compilation fails after conversion | Diagnose missing imports or unexported references. Attempt fix (max 2 retries). |
go vet fails after conversion | Display errors and suggest manual review. |
npx claudepluginhub sgaunet/claude-plugins --plugin go-specialistWrites and reviews production-ready Go tests: table-driven tests, testify suites, parallel tests, fuzzing, goroutine leak detection, snapshot testing, and integration tests. Use when writing, reviewing, or debugging Go tests.
Reviews Go test code for table-driven tests, assertions, parallel execution, cleanup, mocking, benchmarks, fuzzing, httptest, and coverage patterns in *_test.go files.
Guides Go test writing, reviews, and audits using table-driven tests, subtests, t.Parallel, t.Helper, t.Cleanup, testify, mocks/stubs, benchmarks, fuzzing.