go-add-test

go-add-test is a skill for Claude Code from JotJunior/cstk. It costs 59 tokens per session (2,718 once invoked), scanned A, original, MIT.

A guide for adding unit and integration tests to Go microservices in the GOB project. Unit tests check small pieces of code, while integration tests check how parts work together.

In plain words
What is it for?
Use it to test domain logic, services, handlers, repositories, or consumers in a specified Go service, including a particular method or an entire layer.
Why use it?
It makes new tests follow the project's existing patterns, including how dependencies are replaced with test doubles. It also requires identifying the service and code layer before writing tests.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is cd services/{service-name} && go test ./internal/{layer}/... -v -count=1.

Part of the cstk-language-go plugin — 7 skills shipped together

Good fit Use it to test domain logic, services, handlers, repositories, or consumers in a specified Go service, including a particular method or an entire layer.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/JotJunior/cstk
agentmods
npx agentmods add skills/jotjunior/cstk/go-add-test

Made for: Claude Code.

Or install cstk-language-go, the plugin that ships this one along with the rest of its 7 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for go-add-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/jotjunior/cstk/go-add-test.svg)](https://agentmods.dev/skills/jotjunior/cstk/go-add-test)
Your own site
<a href="https://agentmods.dev/skills/jotjunior/cstk/go-add-test"><img src="https://agentmods.dev/badge/skills/jotjunior/cstk/go-add-test.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,718 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00059 $0.02718
Opus 5 $0.00030 $0.01359
Sonnet 5 $0.00012 $0.00544
Haiku 4.5 $0.00006 $0.00272

Measured 7d ago against content hash e2a95d9198fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

go-add-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cstk-language-go/skills/go-add-test/SKILL.md · 349 lines

How it starts

The opening of the file, as written. The whole thing — 349 lines — stays where its author put it; the contents beside it link to each section on GitHub.

go-add-test

Add unit/integration tests to a GOB Go microservice following established project patterns.

Triggers

  • "add test", "add tests", "criar teste", "novo teste", "test coverage", "testar"
  • "write tests for", "escrever testes para"
  • Examples: "add tests for process-service service layer", "criar testes de domain para bulletin-service"

Instructions

You generate Go tests for GOB microservices following the MockFunc pattern established in gob-member-service and gob-auth-service.

Step 1: Identify Target

Parse the user request to determine:

  • Service: which service in services/ (e.g., gob-process-service)
  • Layer: which layer to test: domain, service, handler, repository, consumer
  • Scope: specific file/method or entire layer

If not specified, ask the user.

Step 2: Pre-flight Reads

Before writing ANY test code, read these files in the target service:

  1. Repository interfacesinternal/repository/repository.go or similar interface files
    • These define the methods you need to mock
  2. Target source file — the file being tested (e.g., internal/service/member_service.go)
    • Understand every method signature, dependencies, and error paths
  3. Domain structsinternal/domain/*.go
    • Needed for creating test fixtures
  4. Existing tests — any *_test.go files in the target package
    • Follow existing patterns if tests already exist
  5. DTO structsinternal/dto/dto.go if testing service/handler layer
    • Request/response types used by the methods

Step 3: Generate Mocks (if mocks_test.go doesn't exist)

Create mocks_test.go in the same package as the tests. Use the MockFunc pattern:

package service

import (
    "context"

    "github.com/google/uuid"
    "github.com/gob/{service}/internal/domain"
)

// --- MockXxxRepository ---

type MockXxxRepository struct {
    FindByIDFunc    func(ctx context.Context, id uuid.UUID) (*domain.Xxx, error)
    CreateFunc      func(ctx context.Context, entity *domain.Xxx) error
    UpdateFunc      func(ctx context.Context, entity *domain.Xxx) error
    DeleteFunc      func(ctx context.Context, id uuid.UUID) error
    ListFunc        func(ctx context.Context, limit, offset int) ([]*domain.Xxx, int, error)
    // Add one field per interface method
}

func (m *MockXxxRepository) FindByID(ctx context.Context, id uuid.UUID) (*domain.Xxx, error) {
    if m.FindByIDFunc != nil {
        return m.FindByIDFunc(ctx, id)
    }
    return nil, nil
}

func (m *MockXxxRepository) Create(ctx context.Context, entity *domain.Xxx) error {
    if m.CreateFunc != nil {
        return m.CreateFunc(ctx, entity)
    }
    return nil
}

// ... implement ALL interface methods with nil-check + safe default

Read the full file on GitHub · 349 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 349 lines · 59 tokens per session scan A e2a95d9198fe

Subscribe to this mod's changes

go-add-test is a skill published in the GitHub repository JotJunior/cstk (23 stars, last pushed 4d ago), licensed MIT. It adds 59 tokens to every session and 2,718 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI…

samber/cc-skills-golang · 115 tokens

setup

Wire Ginkgo into a Go package — install the ginkgo CLI and Ginkgo+Gomega, ginkgo bootstrap to generate the suitetest.go (TestXxx/RegisterFailHandler(Fail)/RunSpecs), the package xxxtest convention, dot-import alternatives (aliased import, dsl/ subpackages, --nodot), ginkgo generate, and testing.T interop via…

onsi/ginkgo · 118 tokens

golang-stretchr-testify

Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use when writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Covers testify assertions, mock expectations, argument matchers, call verification…

samber/cc-skills-golang · 97 tokens

assertions

Write correct synchronous Gomega assertions — Expect/Ω notation, the To/NotTo/ToNot/Should/ShouldNot equivalences, the multi-return error idiom, Succeed vs HaveOccurred, the .Error() chaining form, annotating assertions (format-string and func()string), tuning failure output via the format subpackage…

onsi/gomega · 145 tokens

gstruct

Deep, partial matching of nested structs, slices, maps, and pointers with gstruct — MatchAllFields/MatchFields/Fields, MatchAllElements/MatchElements/Elements (idFn), MatchAllKeys/MatchKeys/Keys, PointTo, and the IgnoreExtras/IgnoreMissing/IgnoreUnexportedExtras/AllowDuplicates options, plus Ignore()/Reject(). Use…

onsi/gomega · 104 tokens

overview

The Ginkgo mental model for writing Go tests — the one idea that explains everything (Ginkgo builds a spec tree at construction time, then runs it) and its consequences for how you write specs, plus spec independence and the node taxonomy. Use this first when you start working with Ginkgo in a project, or to decide…

onsi/ginkgo · 84 tokens