go-add-test

Generate Go unit and integration tests for microservice layers using MockFunc.

Updated Jun 8, 2026
One-click install
npx skills add https://github.com/JotJunior/cstk-plugin-codex --skill go-add-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-add-test
Source: https://github.com/JotJunior/cstk-plugin-codex/tree/main/skills/go-add-test
Command: npx skills add https://github.com/JotJunior/cstk-plugin-codex --skill go-add-test

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the process of adding unit and integration tests to Go microservices, streamlining the testing process and reducing manual effort.

Core Features & Use Cases

  • Test Generation: Automatically generate tests for service, domain, handler, repository, or consumer layers in Go microservices.
  • MockFunc Pattern: Uses the MockFunc pattern to create test mocks.
  • Test Setup: Generates setup functions to wire the service with mock dependencies.
  • Test Coverage: Encourages comprehensive test coverage with scenarios including happy path, validation errors, not found, repository/dependency errors, authorization, and edge cases.
  • Use Case: When a developer needs to quickly add tests to a new service or expand tests for an existing one.

Quick Start

Use the go-add-test skill to generate tests for the service layer of the 'gob-process-service' microservice.

Frequently Asked Questions about go-add-test

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

FAQPage Schema
How do I generate unit and integration tests for Go microservices?

You can generate Go microservices tests by automating test creation for domain, service, handler, repository, and consumer layers. This process uses established patterns and MockFunc for dependency mocking to ensure comprehensive coverage with minimal manual effort.

How does the MockFunc pattern work for mocking dependencies in Go tests?

The MockFunc pattern creates test mocks by generating setup functions that wire your Go service with mock dependencies. This mechanism isolates the service layer, allowing you to simulate repository, dependency, and validation errors without needing live external services.

What test coverage scenarios should I include when testing Go microservice layers?

Test coverage for Go microservices should include happy path, validation errors, not found, repository or dependency errors, authorization, and edge cases. Comprehensive coverage strategies target each layer individually, from domain logic to handlers and consumers.

Can I use this automated testing approach for both new and existing Go services?

Yes, automated Go test generation suits both new and existing microservices. Developers can quickly add initial tests for a new service or expand the test coverage for an existing one by targeting specific layers like service, repository, or consumer.

What is the best way to add tests to a Go service layer without writing boilerplate?

The best way to avoid boilerplate is automating Go test generation with MockFunc. It generates setup functions and mock dependencies for your service layer, systematically creating test scenarios like happy path and authorization errors.

What are the limitations of using MockFunc for Go microservice test generation?

MockFunc test generation focuses on mocking dependencies for specific architectural layers like domain, handler, and repository. It may not cover integration scenarios requiring live external services or complex stateful interactions beyond standard mocked dependency behaviors.