Agent skill

Golang Stretchr Testify

by context-labs in context-labs/whip

Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq.

MITAuto-check passedDevelopment

Install Golang Stretchr Testify

skills CLI
$ npx skills add context-labs/whip --skill golang-stretchr-testify -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install context-labs/whip golang-stretchr-testify --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/context-labs/whip.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/golang-stretchr-testify .claude/skills/golang-stretchr-testify && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
golang-stretchr-testify
GitHub stars
1.1k
Used in
2 other repos
Token cost
~1.8k tokens
SKILL.md length
370 words
Files
3 (incl. references)
Skills in repo
40
Repo updated
First seen
Licence
MIT

At a glance

Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq.

  • Writing testify tests
  • SKILL.md covers assert vs require, Core Assertions, Advanced Assertions and testify/mock, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Choosing assert vs require

What it does

Golang Stretchr Testify is an agent skill from context-labs/whip. Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq. Use when writing testify tests, creating mocks, choosing assert vs require, or when the codebase imports github.com/stretchr/testify.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `evals/evals.json` and `references/mock.md`). Compatibility notes: Designed for Claude Code, Codex or similar harness, and for projects using Golang.

It sits in Development. It works with Go and GitHub. The repository describes itself as: A fast coding-agent harness in Go. Tool-use loop, bubbletea TUI, provider-routable models with live catalog discovery, MCP support, background subagents. One binary, no runtime… The licence is MIT.

When your agent uses it

  • Writing testify tests
  • Choosing assert vs require
  • The codebase imports github.com/stretchr/testify

Example prompts

  • “/golang-stretchr-testify”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang.
  • Pre-approved tools (allowed-tools): Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(gotests:*), AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*

What it can do on your machine

Read from SKILL.md and the folder at commit 8876467. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Edit
    • Write
    • Glob
    • Grep
    • Bash(go:*)
    • Bash(golangci-lint:*)
    • Bash(git:*)
    • Agent
    • WebFetch

    …and 8 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are go).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code, Codex or similar harness, and for projects using Golang.

    From compatibility in the SKILL.md frontmatter.

Context cost

Golang Stretchr Testify loads about 1.8k tokens when it runs, and up to ~2.6k if it reads all its reference files. Until then it costs about 78 tokens; SKILL.md has 370 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~78
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from context-labs/whip at commit 8876467, republished under its MIT licence (© context-labs). 370 words, ~1,794 tokens.

Download SKILL.mdSave it as .claude/skills/golang-stretchr-testify/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
golang-stretchr-testify
description
Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq. Use when writing testify tests, creating mocks, choosing assert vs require, or when the codebase imports github.com/stretchr/testify.
allowed-tools
Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(gotests:*), AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*
compatibility
Designed for Claude Code, Codex or similar harness, and for projects using Golang.
user-invocable
true
license
MIT
metadata.author
samber
metadata.version
1.3.0
paths
**/*.go

Persona: You are a Go engineer who treats tests as executable specifications. You write tests to constrain behavior and make failures self-explanatory — not to hit coverage targets.

Modes:

  • Write mode — adding new tests or mocks to a codebase.
  • Review mode — auditing existing test code for testify misuse.

stretchr/testify

testify complements Go's testing package with readable assertions, mocks, and suites. It does not replace testing — always use *testing.T as the entry point.

This skill is not exhaustive. Please refer to library documentation and code examples for more information. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See samber/cc-skills-golang@golang-pkg-go-dev skill (godig) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See samber/cc-skills-golang@golang-gopls skill (gopls). Context7 remains a fallback for docs not indexed on pkg.go.dev.

assert vs require

Both offer identical assertions. The difference is failure behavior:

  • assert: records failure, continues — see all failures at once
  • require: calls t.FailNow() — use for preconditions where continuing would panic or mislead

Use assert.New(t) / require.New(t) for readability. Name them is and must:

go
func TestParseConfig(t *testing.T) {
    is := assert.New(t)
    must := require.New(t)

    cfg, err := ParseConfig("testdata/valid.yaml")
    must.NoError(err)    // stop if parsing fails — cfg would be nil
    must.NotNil(cfg)

    is.Equal("production", cfg.Environment)
    is.Equal(8080, cfg.Port)
    is.True(cfg.TLS.Enabled)
}

Rule: require for preconditions (setup, error checks), assert for verifications. Never mix randomly.

Core Assertions

go
is := assert.New(t)

// Equality
is.Equal(expected, actual)              // DeepEqual + exact type
is.NotEqual(unexpected, actual)
is.EqualValues(expected, actual)        // converts to common type first
is.EqualExportedValues(expected, actual)

// Nil / Bool / Emptiness
is.Nil(obj)                  is.NotNil(obj)
is.True(cond)                is.False(cond)
is.Empty(collection)         is.NotEmpty(collection)
is.Len(collection, n)

// Contains (strings, slices, map keys)
is.Contains("hello world", "world")
is.Contains([]int{1, 2, 3}, 2)
is.Contains(map[string]int{"a": 1}, "a")

// Comparison
is.Greater(actual, threshold)     is.Less(actual, ceiling)
is.Positive(val)                  is.Negative(val)
is.Zero(val)

// Errors
is.Error(err)                     is.NoError(err)
is.ErrorIs(err, ErrNotFound)      // walks error chain
is.ErrorAs(err, &target)
is.ErrorContains(err, "not found")

// Type
is.IsType(&User{}, obj)
is.Implements((*io.Reader)(nil), obj)

Argument order: always (expected, actual) — swapping produces confusing diff output.

Advanced Assertions

go
is.ElementsMatch([]string{"b", "a", "c"}, result)             // unordered comparison
is.InDelta(3.14, computedPi, 0.01)                            // float tolerance
is.JSONEq(`{"name":"alice"}`, `{"name": "alice"}`)             // ignores whitespace/key order
is.WithinDuration(expected, actual, 5*time.Second)
is.Regexp(`^user-[a-f0-9]+$`, userID)

// Async polling
is.Eventually(func() bool {
    status, _ := client.GetJobStatus(jobID)
    return status == "completed"
}, 5*time.Second, 100*time.Millisecond)

// Async polling with rich assertions
is.EventuallyWithT(func(c *assert.CollectT) {
    resp, err := client.GetOrder(orderID)
    assert.NoError(c, err)
    assert.Equal(c, "shipped", resp.Status)
}, 10*time.Second, 500*time.Millisecond)
Show full SKILL.md (164 more words)Show less

testify/mock

Mock interfaces to isolate the unit under test. Embed mock.Mock, implement methods with m.Called(), always verify with AssertExpectations(t).

Key matchers: mock.Anything, mock.AnythingOfType("T"), mock.MatchedBy(func). Call modifiers: .Once(), .Times(n), .Maybe(), .Run(func).

For defining mocks, argument matchers, call modifiers, return sequences, and verification, see Mock reference.

testify/suite

Suites group related tests with shared setup/teardown.

Lifecycle
SetupSuite()    → once before all tests
  SetupTest()   → before each test
    TestXxx()
  TearDownTest() → after each test
TearDownSuite() → once after all tests
Example
go
type TokenServiceSuite struct {
    suite.Suite
    store   *MockTokenStore
    service *TokenService
}

func (s *TokenServiceSuite) SetupTest() {
    s.store = new(MockTokenStore)
    s.service = NewTokenService(s.store)
}

func (s *TokenServiceSuite) TestGenerate_ReturnsValidToken() {
    s.store.On("Save", mock.Anything, mock.Anything).Return(nil)
    token, err := s.service.Generate("user-42")
    s.NoError(err)
    s.NotEmpty(token)
    s.store.AssertExpectations(s.T())
}

// Required launcher
func TestTokenServiceSuite(t *testing.T) {
    suite.Run(t, new(TokenServiceSuite))
}

Suite methods like s.Equal() behave like assert. For require: s.Require().NotNil(obj).

Common Mistakes

  • Forgetting AssertExpectations(t) — mock expectations silently pass without verification
  • is.Equal(ErrNotFound, err) — fails on wrapped errors. Use is.ErrorIs to walk the chain
  • Swapped argument order — testify assumes (expected, actual). Swapping produces backwards diffs
  • assert for guards — test continues after failure and panics on nil dereference. Use require
  • Missing suite.Run() — without the launcher function, zero tests execute silently
  • Comparing pointers — is.Equal(ptr1, ptr2) compares addresses. Dereference or use EqualExportedValues

Linters

Use testifylint to catch wrong argument order, assert/require misuse, and more. See samber/cc-skills-golang@golang-lint skill.

Cross-References

  • → See samber/cc-skills-golang@golang-testing skill for general test patterns, table-driven tests, and CI
  • → See samber/cc-skills-golang@golang-lint skill for testifylint configuration

© context-labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .agents/skills/golang-stretchr-testify of context-labs/whip.

  • SKILL.md
  • evals/evals.json
  • references/mock.md

Open the folder on GitHubat commit 8876467

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in context-labs/whip, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Golang Stretchr Testify next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Golang Stretchr Testify compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Golang Stretchr Testify this skillcontext-labs/whip1.1k2 repos~1.8kAutomated safety check: PassMIT
Go-Redis Release Preparationredis/go-redis22k—~1.1kAutomated safety check: PassBSD-2-Clause
Machinistowainlewis/machinist4961 repos~761Automated safety check: PassMIT
Valgocohesivestack/valgo508—~2.4kAutomated safety check: PassMIT
Releaseyoanbernabeu/grepai1.9k—~918Automated safety check: PassMIT
Fix Gh Issuebeatlabs/harvester135—~783Automated safety check: PassApache-2.0

Similar skills

  • Official

    Prepares a go-redis release locally: picks the next semver, gathers merged PRs, writes the RELEASE-NOTES entry and bumps versions, without publishing.

    22k GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Machinist

    owainlewis/machinist

    Use Machinist to create, assign, and monitor software tasks.

    496 GitHub starsUsed in 1 repo~761 tokens
    DevelopmentAuto-check passed
  • Valgo

    cohesivestack/valgo

    Add, refactor, debug, review, explain, or migrate type-safe validation in consumer Go applications using github.com/cohesivestack/valgo.

    508 GitHub stars~2.4k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Release

    yoanbernabeu/grepai

    Create a new release for grepai. An agent skill from yoanbernabeu/grepai.

    1.9k GitHub stars~918 tokensUpdated 19 days ago
    DevelopmentAuto-check passed
  • Fix Gh Issue

    beatlabs/harvester

    Fix a single GitHub issue end-to-end using wt. An agent skill from beatlabs/harvester.

    135 GitHub stars~783 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Release

    ggwhite/go-masker

    Release a new version of go-masker: update CHANGELOG.md from git log, create GitHub release.

    129 GitHub stars~938 tokensUpdated 3 mo ago
    DevelopmentAuto-check passed

More from context-labs/whip

All 40 skills in this repo
  • Golang Lint

    context-labs/whip

    Linting best practices and golangci-lint configuration for Go — running linters, configuring .golangci.yml, nolint suppressions, selecting linters.

    1.1k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • Golang Project Layout

    context-labs/whip

    Golang project layouts and workspaces. An agent skill from context-labs/whip.

    1.1k GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Golang Pkg Go Dev

    context-labs/whip

    Golang package/module docs via godig, a pkg.go.dev API client (CLI + MCP) — APIs, symbols, versions, importers, licenses, vulnerabilities.

    1.1k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • CI/CD with GitHub Actions for Golang — testing, linting, SAST, security scanning, coverage, Dependabot, Renovate, GoReleaser, release pipelines.

    1.1k GitHub stars~3.5k tokensUpdated 5 days ago
    Auto-check passed
  • Golang Data Structures

    context-labs/whip

    Golang data structures — slices/maps internals (capacity growth, preallocation, hash buckets), slices/maps packages, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections…

    1.1k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed
  • Golang Grpc

    context-labs/whip

    gRPC usage, protobuf organization, and production patterns for Go microservices.

    1.1k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed

Works with

Categories

Questions about Golang Stretchr Testify

What does Golang Stretchr Testify do?

Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq. Golang Stretchr Testify is an agent skill from context-labs/whip. Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq.

When should I use Golang Stretchr Testify?

Golang Stretchr Testify fits situations like: writing testify tests; choosing assert vs require; the codebase imports github.com/stretchr/testify.

How do I install Golang Stretchr Testify in Claude Code?

Run `npx skills add context-labs/whip --skill golang-stretchr-testify -a claude-code`. Or copy the skill folder (.agents/skills/golang-stretchr-testify in context-labs/whip) into .claude/skills/golang-stretchr-testify in your project. Claude Code loads it when a task matches its description.

How do I install Golang Stretchr Testify in Codex?

Run `npx skills add context-labs/whip --skill golang-stretchr-testify -a codex`. Or copy the skill folder (.agents/skills/golang-stretchr-testify in context-labs/whip) into .agents/skills/golang-stretchr-testify in your project. Codex loads it when a task matches its description.

Can I use Golang Stretchr Testify in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add context-labs/whip --skill golang-stretchr-testify -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/golang-stretchr-testify, .gemini/skills/golang-stretchr-testify, .github/skills/golang-stretchr-testify and .opencode/skills/golang-stretchr-testify in your project.

What does Golang Stretchr Testify need to run?

SKILL.md names no scripts, command-line tools or credentials: Golang Stretchr Testify is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(gotests:*), AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*. Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang..

Does Golang Stretchr Testify access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Golang Stretchr Testify safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Golang Stretchr Testify use?

Golang Stretchr Testify is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Golang Stretchr Testify use?

About 1.8k tokens (SKILL.md is roughly 7.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 804 tokens, read only when the agent opens those files.

What are the alternatives to Golang Stretchr Testify?

Skills that share tags, products or a category with Golang Stretchr Testify: Go-Redis Release Preparation (redis/go-redis, 22k stars), Machinist (owainlewis/machinist, 496 stars), Valgo (cohesivestack/valgo, 508 stars) and Release (yoanbernabeu/grepai, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Golang Stretchr Testify?

context-labs (a GitHub organization) maintains it in context-labs/whip, which has 1,083 GitHub stars. The repository holds 40 skills in this directory. The repository was last updated on October 5, 2026.

Source: context-labs/whip on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.