go-testing-practices

go-testing-practices is a cursor rule for Cursor from dstotijn/mcp-cbs-cijfers-open-data. It costs 876 tokens per session, scanned A, a copy of go-testing-practices, Apache-2.0.

A set of rules for writing Go tests, where Go is a programming language. It covers test layout, table-driven cases, subtests, setup and checking, and useful failure messages.

In plain words
What is it for?
Use it while writing files ending in _test.go, especially when testing multiple cases with t.Run and comparing expected results with actual results.
Why use it?
It gives Go tests a consistent structure that makes different scenarios easier to read, maintain, and diagnose when they fail.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions Cursor.

Good fit Use it while writing files ending in _test.go, especially when testing multiple cases with t.Run and comparing expected results with actual results.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/dstotijn/mcp-cbs-cijfers-open-data/go-testing-practices
Install

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.

Clone the repo
git clone --depth 1 https://github.com/dstotijn/mcp-cbs-cijfers-open-data

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for go-testing-practices

README.md
[![agentmods](https://agentmods.dev/badge/rules/dstotijn/mcp-cbs-cijfers-open-data/go-testing-practices/github.svg)](https://agentmods.dev/rules/dstotijn/mcp-cbs-cijfers-open-data/go-testing-practices)
Your own site
<a href="https://agentmods.dev/rules/dstotijn/mcp-cbs-cijfers-open-data/go-testing-practices"><img src="https://agentmods.dev/badge/rules/dstotijn/mcp-cbs-cijfers-open-data/go-testing-practices/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for go-testing-practices

Your own site · 80×15
<a href="https://agentmods.dev/rules/dstotijn/mcp-cbs-cijfers-open-data/go-testing-practices"><img src="https://agentmods.dev/badge/rules/dstotijn/mcp-cbs-cijfers-open-data/go-testing-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 876 This file is loaded in full into every session.
When invoked 876 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00876 $0.00876
Opus 5 $0.00438 $0.00438
Sonnet 5 $0.00175 $0.00175
Haiku 4.5 $0.00088 $0.00088

Measured 9d ago against content hash c925ef0ab63e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

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 9d 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.

Origin

This is a copy

100% identical to go-testing-practices — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/go-testing-practices.mdc · 132 lines

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: Go Testing Best Practices globs: *_test.go

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

  1. Use table-driven tests for testing multiple scenarios
  2. Name test functions as Test<FunctionName> or Test<FunctionName>_<Scenario>
  3. Use subtests with t.Run() to organize related test cases
  4. Group tests logically by functionality
  5. Keep test files in the same package as the code they test

Test Structure

  1. 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
  2. Use clear separation between these sections
  3. Minimize test setup code; use helper functions for common setup
  4. Make test failures descriptive and actionable

Assertions

  1. Use t.Errorf() or t.Fatalf() with descriptive messages
  2. Include expected vs. actual values in failure messages
  3. Avoid testify or similar packages, but do use go-cmp.
  4. Prefer t.Fatalf() only when continuing the test is impossible

Mocking and Test Doubles

  1. Use interfaces to enable mocking of dependencies
  2. Create simple, focused test doubles (mocks, stubs, fakes)
  3. Consider using the standard library's httptest for HTTP testing
  4. Avoid sqlmock or similar tools for database testing, stick to the stdlib

Test Coverage

  1. High test coverage is not a goal in and of itself, focus on critical code paths
  2. Test edge cases and error conditions
  3. Use go test -cover to measure coverage
  4. Use go test -race to 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

Read the full file on GitHub · 132 lines

Changes

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.

  1. 9d ago First seen · 132 lines · 876 tokens per session scan A c925ef0ab63e

Subscribe to this mod's changes

go-testing-practices is a cursor rule published in the GitHub repository dstotijn/mcp-cbs-cijfers-open-data (8 stars, last pushed 1y ago), licensed Apache-2.0. It adds 876 tokens to every session, about $0.0044 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to go-testing-practices, differing in 0 lines, and is treated as a copy.