Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/dstotijn/go-mcp/go-testing-practicesgit clone --depth 1 https://github.com/dstotijn/go-mcpWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00876 |
| Opus 5 | $0.00000 | $0.00438 |
| Sonnet 5 | $0.00000 | $0.00175 |
| Haiku 4.5 | $0.00000 | $0.00088 |
Grade A, and why
go-testing-practices 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 3d 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.
Copies of this mod
2 near-identical copies found in the catalogue:
- go-testing-practices — 100% identical, 0 lines differ
- go-testing-practices — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Description
This rule ensures that Go tests follow best practices for effective, maintainable, and idiomatic testing in Go projects.
Rule
When writing tests in Go:
Test Organization
- Use table-driven tests for testing multiple scenarios
- Name test functions as
Test<FunctionName>orTest<FunctionName>_<Scenario> - Use subtests with
t.Run()to organize related test cases - Group tests logically by functionality
- Keep test files in the same package as the code they test
Test Structure
- Follow the Arrange-Act-Assert (AAA) pattern:
- Arrange: Set up test data and preconditions
- Act: Call the function/method being tested
- Assert: Verify the results
- Use clear separation between these sections
- Minimize test setup code; use helper functions for common setup
- Make test failures descriptive and actionable
Assertions
- Use
t.Errorf()ort.Fatalf()with descriptive messages - Include expected vs. actual values in failure messages
- Avoid
testifyor similar packages, but do usego-cmp. - Prefer
t.Fatalf()only when continuing the test is impossible
Mocking and Test Doubles
- Use interfaces to enable mocking of dependencies
- Create simple, focused test doubles (mocks, stubs, fakes)
- Consider using the standard library's
httptestfor HTTP testing - Avoid
sqlmockor similar tools for database testing, stick to the stdlib
Test Coverage
- High test coverage is not a goal in and of itself, focus on critical code paths
- Test edge cases and error conditions
- Use
go test -coverto measure coverage - Use
go test -raceto detect race conditions
Implementation
- The Cursor IDE will enforce this rule by:
- Suggesting test improvements
- Highlighting testing anti-patterns
- Providing templates for common testing patterns
Benefits
- More reliable and maintainable tests
- Better test coverage
- Faster test execution
- Clearer test failures
- Consistent testing approach across the project
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.
- 3d ago First seen · 132 lines · 876 tokens per session scan A c925ef0ab63e
go-testing-practices is a cursor rule published in the GitHub repository dstotijn/go-mcp (18 stars, last pushed 1y ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 876 tokens. 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.
Other cursor rules, from other repositories
backend
You are an expert in Go, Gin, Gorm, Gen, Cosy (https://cosy.uozi.org/) with a deep understanding of best practices and performance optimization techniques in these technologies.
go_test
Cursor rule "go_test" from tphakala/birdnet-go, covering go test best practices, go version, test function conventions, table-driven tests and test utilities and cleanups.
schema_test_implementation_guide
A concise and practical guide for building GoZod Schema test files, updated with the latest practices from stringtest.go, objecttest.go, and complextest.go.
unit-test-coverage-95
Unit test coverage ≥95% per Go package (binding rule).
go-handler
Patterns for Go handler layer files — HTTP request handling, validation, routing.
go-service
Patterns for Go service layer files — business logic, DB access, auth checks.