go-unit-test

Standardize Go unit tests with table-driven structures and classical mocking.

1|Updated Jun 20, 2026
One-click install
npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill go-unit-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-unit-test
Source: https://github.com/shafibabar/SDLC-Artifact-Factory/tree/main/skills/go-unit-test
Command: npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill go-unit-test

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill eliminates inconsistent testing practices and flaky test suites by enforcing a rigorous, behavior-driven standard for Go unit testing that prioritizes maintainability and resistance to refactoring.

Core Features & Use Cases

  • Complexity-Based Strategy: Provides a clear heuristic for determining when to write a unit test versus an integration test based on domain complexity and collaborator count.
  • Canonical Patterns: Defines the standard for table-driven tests, mocking philosophy (classical school), and assertion styles to ensure uniform code quality across the repository.
  • Use Case: A developer uses this skill to structure a new domain model test suite, ensuring that all invariants are covered by table-driven cases and that dependencies are correctly handled via fakes or mocks.

Quick Start

Use the go-unit-test skill to generate a table-driven test file for the current domain model package following the repository standard.

Frequently Asked Questions about go-unit-test

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

FAQPage Schema
How do I structure table-driven unit tests in Go?

Table-driven unit tests in Go are structured by defining test cases in a slice of structs, iterating over them, and executing assertions to standardize verification of domain models. This approach ensures uniform coverage of invariants across the repository.

When should I write a unit test versus an integration test in Go?

A unit test is needed when verifying isolated business logic with low domain complexity and few collaborators. Integration tests are reserved for higher complexity scenarios, ensuring tests remain fast and deterministic based on collaborator count.

What is the classical mocking philosophy for Go unit testing?

Classical mocking philosophy in Go unit testing utilizes fakes or mocks to handle dependencies, ensuring tests remain isolated and behavior-coupled. This approach prioritizes maintainability and resistance to refactoring over strict interaction verification.

How do I prevent flakiness in Go unit test suites?

Flakiness in Go unit test suites is prevented by enforcing a behavior-driven standard that isolates business logic using fakes or mocks. This ensures fast, deterministic verification of domain models without external dependencies.

Does TDD-gate enforcement work with table-driven Go tests?

TDD-gate enforcement works effectively with table-driven Go tests by coupling assertions to behavior and using classical mocking. This combination satisfies TDD requirements while ensuring test suites remain maintainable and resistant to refactoring.