# Build Better Go Tests

Go teams need consistent tests across units, integrations, mocks, benchmarks, and coverage. This skill provides practical Go testing patterns that Claude, Codex, and Claude Code can apply during development.

## Install

```bash
npx skillstore add joseph obrien/89jobrien-golang-testing
```

## Metadata

- Status: approved
- Slug: 89jobrien-golang-testing
- Version: 1.0.1
- Author version: 1.0.1
- Skillstore revision: r1
- Version status: valid
- Tree hash: 48a6dad1de93349a68a14586ea5e70e2aa54f15dbcd53603c4be663c1aa55edd
- Author: Joseph OBrien
- GitHub username: 89jobrien
- License: MIT
- Repository: https://github.com/89jobrien/steve/tree/main/steve/skills/golang-testing
- Ref: c4037264bbd363c572662d6154a3ab28f5ca4f53
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: scripts, external\_commands
- Quality score: 81
- Quality tier: silver
- Public page: https://skillstore.pages.dev/skills/89jobrien-golang-testing
- Manifest: https://skillstore.pages.dev/api/skills/89jobrien-golang-testing/manifest

## Capabilities

- Explains table-driven unit tests with error cases and subtests.
- Shows interface-based mocking patterns for repositories and services.
- Demonstrates integration tests with Testcontainers and PostgreSQL examples.
- Covers setup, teardown, fixtures, HTTP handler tests, and coverage commands.
- Describes benchmark patterns, sub-benchmarks, and parallel benchmarks.

## Use Cases

- Write Service Tests: Create table-driven unit tests and interface mocks for Go service logic.
- Validate Integration Flows: Plan integration tests with containers, fixtures, setup, and teardown steps.
- Standardize Test Practices: Align a team on Go testing structure, benchmark style, and coverage workflow.

## Prompt Templates

### Create a Table-Driven Test

```
Use the golang-testing skill to create a table-driven unit test for this Go function. Include success and error cases.
```

### Add Interface Mocks

```
Use the golang-testing skill to design interface-based mocks for this service dependency. Show the test cases I should cover.
```

### Plan Integration Tests

```
Use the golang-testing skill to plan integration tests for this Go package. Include setup, teardown, fixtures, and short-mode behavior.
```

### Review Test Architecture

```
Use the golang-testing skill to review this Go test suite. Identify gaps in organization, mocking, benchmarks, coverage, and reliability.
```

## Limitations

- Provides guidance and examples, not a complete generated test suite by itself.
- Assumes the project already uses Go and the standard testing package.
- Testcontainers examples require Docker or a compatible container runtime.
- Does not replace project-specific review of dependencies, data, or concurrency risks.

## Best Practices

- Start with table-driven tests for pure functions and small service methods.
- Keep integration tests behind build tags or short-mode skips.
- Use helpers and fixtures to reduce setup noise while preserving readability.

## Anti Patterns

- Copying examples without adapting assertions to domain behavior.
- Running slow container tests as part of every quick unit test loop.
- Testing private implementation details instead of observable outcomes.

## Security Audit

- Audited at: 2026-07-05T12:37:50.582\+00:00
- Summary: The static findings are false positives from Markdown code fences, Go import blocks, example identifiers, and documented Go test commands. The skill is instructional content only, with no executable installer, secret access, data exfiltration, or prompt injection evidence.

## Stats

- Views: 220
- Downloads: 19
- Favorites: 0
- Popularity score: 0
