
Golang Stretchr Testify
A comprehensive reference for writing tests with stretchr/testify in Go. Covers the assert versus require distinction (when to stop on failure versus collect all errors), the full assertion API including Eventually and JSONEq, mock setup with argument matchers and call verification, and the suite lifecycle for shared test fixtures. Written as executable specifications rather than coverage chasing. The skill includes gotests integration for scaffolding and warns about common pitfalls like forgetting AssertExpectations or using assert where require would prevent nil panics. Useful anytime you're writing Go tests that import testify, setting up mocks, or deciding between assertion styles. Pairs well with testifylint to catch argument order mistakes.
- skills.sh installs
- 40.9K
- GitHub stars
- 3.8K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add samber/cc-skills-golang --skill golang-stretchr-testify --agent claude-codeInstalls into .claude/skills of the current project.
Files
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-devskill (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-goplsskill (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:
Sponsors
Details
- Repository
- github.com/samber/cc-skills-golang
- Categories
- Testing & QA, Git & Pull Requests, Documentation, Go
- First seen
- Apr 16, 2026
More from samber/cc-skills-golang
All 47- Golang Continuous Integration40.9K
- Golang Grpc40.7K
- Golang Samber Lo40K
- Golang Stay Updated40K
- Golang Samber Do39.8K
- Golang Samber Slog39.8K
- Golang Samber Oops39.7K
- Golang Samber Mo39.7K
- Golang Samber Hot39.7K
- Golang Samber Ro39.6K
- Golang Spf13 Cobra38.6K
- Golang Swagger38.6K
- Golang Graphql38.5K
- Golang Google Wire38.3K
- Golang Spf13 Viper38.3K
- Golang Uber Fx38.1K
- Golang Uber Dig38K
- Golang How To37.9K
- Golang Linter26.5K
- Golang Pkg Go Dev13.3K
- Golang Refactoring12.9K
- Golang Gopls12.5K
- Golang Code Style46.1K
- Golang Testing45.4K