tdd

Apply test-driven development patterns to Go software with table-driven tests and mocks.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/matlockx/copilot-accountant --skill tdd-matlockx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/matlockx/copilot-accountant/tree/main/.opencode/skills/tdd
Command: npx skills add https://github.com/matlockx/copilot-accountant --skill tdd-matlockx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go-focused test-driven development patterns help teams write reliable code by starting with tests that fail, then implementing only what is needed to pass them.

Core Features & Use Cases

  • Test-first workflow: Write failing tests before implementing production code to guide design.
  • Table-driven tests: Organize multiple scenarios in a compact, readable format.
  • Mocking with interfaces: Use interfaces to isolate dependencies and enable fast, deterministic tests.
  • Integration test conventions: Provide guidance on integrating and running tests across packages.

Quick Start

Start by writing a failing unit test for a Go package, then implement the minimal code to satisfy the test and iterate toward full coverage.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I write table-driven tests in Go for multiple scenarios?

Table-driven tests in Go organize multiple test scenarios in a compact, readable format by structuring cases as slices and looping through them. This approach keeps test logic centralized and simplifies adding new coverage scenarios.

What is the test-first workflow for Go development?

The test-first workflow in Go involves writing failing unit tests before implementing production code. This test-driven development practice guides software design by ensuring you build only what is needed to pass the tests and iterate toward full coverage.

How do I use mocking with interfaces to isolate dependencies in Go?

Mocking with interfaces in Go isolates dependencies by defining contracts that production code and mock implementations both satisfy. This enables fast, deterministic tests by replacing real external dependencies with controlled mock behavior.

Does test-driven development work for integration testing across Go packages?

Test-driven development supports integration testing across Go packages by providing explicit conventions for organizing and running tests. This ensures reliable cross-package behavior verification while maintaining separation from unit tests.

What is the best way to organize unit tests and production code in Go?

The best way to organize unit tests and production code in Go is enforcing them side-by-side within the same package. This test-driven convention ensures tests act as living documentation and maintain immediate coupling with implementation logic.