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 c
Install
The skill file stays in the publisher's repository.
Paste the copied command in a terminal. It installs this SKILL.md into that agent.
npx skills add samber/cc-skills-golang --skill golang-stretchr-testify -a cursor -y
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, suite lifecycle, and advanced patterns like Eventually, JSONEq, and custom matchers. Apply when the codebase imports github.com/stretchr/testify.
Questions
How do I install golang-stretchr-testify?
Download skills/golang-stretchr-testify/SKILL.md from the publisher, or copy the path and open the repository. PlugMCP lists the skill and does not host the file.
Where does golang-stretchr-testify live?
The publisher keeps it at https://github.com/samber/cc-skills-golang.
Which agents can use golang-stretchr-testify?
Claude, Cursor, and Codex can read a SKILL.md you add from the publisher's repository.
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, suite lifecycle, and advanced patterns like Eventually, JSONEq, and custom matchers. Apply when the codebase imports github.com/stretchr/testify.
name: golang-stretchr-testify
description: "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, suite lifecycle, and advanced patterns like Eventually, JSONEq, and custom matchers. Apply when the codebase imports github.com/stretchr/testify."
user-invocable: true
license: MIT
compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang.
metadata:
author: samber
version: "1.3.1"
openclaw:
emoji: "✅"
homepage:
requires:
bins:
- go
- gotests
install:
- kind: go
package: github.com/cweill/gotests/...@latest
bins: [gotests]
skill-library-version: "1.11.1"
allowed-tools: Read Edit Write Glob Grep Bash(go:) Bash(git:) AskUserQuestion Bash(godig:) LSP mcp__gopls__*
paths:
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 — 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), preferred 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:
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.
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
How do I install golang-stretchr-testify?
Download skills/golang-stretchr-testify/SKILL.md from the publisher, or copy the path and open the repository. PlugMCP lists the skill and does not host the file.
Where does golang-stretchr-testify live?
The publisher keeps it at https://github.com/samber/cc-skills-golang.
Which agents can use golang-stretchr-testify?
Claude, Cursor, and Codex can read a SKILL.md you add from the publisher's repository.