go-test-skeleton

Generate Go _test.go files with gomock and three test cases per method.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-test-skeleton
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-test-skeleton
Source: https://github.com/saddam-eng-tech/ai-agent-skills/tree/main/go-test-skeleton
Command: npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-test-skeleton

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing comprehensive unit tests for Go services can be time-consuming and repetitive, especially setting up mocks and covering various error scenarios.

Core Features & Use Cases

  • Automated Test Generation: Creates a _test.go file for Go service interfaces.
  • Mocking Setup: Integrates gomock for dependency mocking.
  • Test Case Coverage: Generates at least three test cases per method: success, validation error, and downstream error.
  • Use Case: When you define a new Go service interface, use this skill to instantly scaffold a robust test file, ensuring good test coverage from the start.

Quick Start

Generate unit tests for the provided Go service interface.

Frequently Asked Questions about go-test-skeleton

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

FAQPage Schema
How do I generate Go unit tests for a service interface?

To scaffold Go unit tests, input your service interface definition. The skill generates a _test.go file with gomock dependency setup and three test cases per method: success, validation error, and downstream error.

How does gomock setup work for Go microservices?

Gomock setup for Go microservices is automated by generating mock dependencies directly in the _test.go file. This scaffolding ensures service interfaces are properly mocked to test interactions and error scenarios without relying on real downstream implementations.

Can I use this to scaffold tests for existing Go libraries?

Yes, this skill applies to Go microservices and libraries requiring thorough unit test scaffolding. It generates a robust _test.go file for any provided service interface, ensuring good test coverage from the start.

What's the best way to cover error scenarios in Go unit tests?

The best way to cover error scenarios is to generate multiple structured test cases per method. This skill automatically scaffolds validation error and downstream error cases alongside a success case for every service interface method.

What test cases are generated for each Go service method?

Three test cases are generated for each method: success, validation error, and downstream error. This ensures thorough unit test coverage and adherence to common testing patterns.