go-testing

Run and write Go tests for MCPSpy with require and assert conventions.

515|79|Updated Jul 17, 2025
One-click install
npx skills add https://github.com/alex-ilgayev/MCPSpy --skill go-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/alex-ilgayev/MCPSpy/tree/main/.claude/skills/go-testing
Command: npx skills add https://github.com/alex-ilgayev/MCPSpy --skill go-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidance and structure for Go testing within the MCPSpy project, helping developers write, run, and improve tests with consistent conventions.

Core Features & Use Cases

  • Testing philosophy: Apply MCPSpy's go test conventions (require vs. assert).
  • Test templates: Reuse patterns for internal and external package tests.
  • Debugging & coverage: Improve test reliability and increase coverage efficiently.

Quick Start

Tell the agent to create a new test file for a MCPSpy package, then run go test ./... to validate the changes.

Frequently Asked Questions about go-testing

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

FAQPage Schema
How do I write and run unit tests in Go?

Go unit tests use the `go test` command to run test files ending in `_test.go`. Write test functions named `TestXxx` that accept a `*testing.T` parameter, use assertions to verify behavior, and run `go test ./...` to execute all tests in your project.

What's the difference between require and assert in Go testing?

Require stops test execution immediately on assertion failure, halting further checks in that test case. Assert logs failures but continues execution, allowing multiple assertions per test. Use require for critical assertions and assert for non-critical ones.

How do I test internal functions in Go packages?

Test internal functions by creating test files in the same package without the `_test` suffix, granting direct access to unexported identifiers. External package testing uses `_test` suffixed files to verify only the public API.

Can I use fixtures and mocks to improve Go test reliability?

Yes, fixtures provide reusable test data and mocks replace external dependencies, enabling isolated unit tests. Implement fixtures as setup functions and mocks as stub implementations to control test environment behavior.

How do I increase test coverage in my Go project?

Identify untested code paths using `go test -cover`, write new test cases for those paths, and use mocks or fixtures to handle external dependencies. Run coverage analysis regularly to track improvement.