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.
Confirm successful installation by checking the skill directory location:
.cursor/skills/golang-stretchr-testify
Restart Cursor to activate golang-stretchr-testify. Access via /golang-stretchr-testify in your agent's command palette.
โ
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
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. Context7 can help as a discoverability platform.
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:
funcTestParseConfig(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.
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
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
Implementation Guide
Prerequisites
โบClaude Desktop or compatible AI client with skill support
โบClear understanding of task or problem to solve
โบWillingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
1Install skill using provided installation command
2Test with simple use case relevant to your work
3Evaluate output quality and relevance
4Iterate on prompts to improve results
5Integrate into regular workflow if valuable
Common Pitfalls
โ Expecting perfect results without iteration
โ Not providing enough context in prompts
โ Using skill for tasks outside its intended scope
โ Accepting outputs without review and validation
Best Practices
โ Do
+Start with clear, specific prompts
+Provide relevant context and constraints
+Review and refine all outputs before using
+Iterate to improve output quality
+Document successful prompt patterns
โ Don't
โDon't use without understanding skill limitations
โDon't skip validation of outputs
โDon't share sensitive information in prompts
โDon't expect skill to replace human judgment
๐ก Pro Tips
โ Be specific about desired format and style
โ Ask for multiple options to choose from
โ Request explanations to understand reasoning
โ Combine AI efficiency with human expertise
When to Use This
โ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
โ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
1Familiarize yourself with skill capabilities and limitations
2Start with low-risk, non-critical tasks
3Progress to more complex and valuable use cases
4Build expertise through regular use and experimentation