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-idiomatic-codegit 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.00879 |
| Opus 5 | $0.00000 | $0.00439 |
| Sonnet 5 | $0.00000 | $0.00176 |
| Haiku 4.5 | $0.00000 | $0.00088 |
Grade A, and why
go-idiomatic-code 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 2d 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-idiomatic-code — 100% identical, 0 lines differ
- go-idiomatic-code — 91% identical, 6 lines differ
How it starts
The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Description
This rule ensures that all Go code follows idiomatic Go practices, adhering to the official Go style guide and common best practices in the Go community.
Rule
When writing Go code:
Naming Conventions
- Use
camelCasefor variable and function names (notsnake_case) - Use
PascalCasefor exported names (public functions, types, variables, constants) - Use
camelCasefor unexported names (private functions, types, variables, constants) - Use acronyms in all caps (e.g.,
HTTP,URL,ID) when they appear at the beginning of a name, otherwise all lowercase - Keep names short and descriptive; the larger the scope, the more descriptive the name should be
Code Organization
- Group related declarations (imports, constants, types, variables, functions)
- Order imports in groups: standard library, third-party packages, local packages
- Use blank lines to separate logical sections of code
- Keep functions small and focused on a single responsibility
- Place methods on receiver types in a logical order, with the most important methods first
Error Handling
- Always check errors and handle them appropriately
- Use the
errorspackage for simple errors andfmt.Errorfwith%wfor wrapping errors - Return errors rather than using panic (except for truly unrecoverable situations)
- Use meaningful error messages that help diagnose the problem
Comments and Documentation
- Write comments as complete sentences with proper punctuation (ending with a period)
- Use godoc-style comments for exported functions, types, and variables
- Focus on explaining "why" rather than "what" in comments
- Document non-obvious behavior and edge cases
Code Style
- Use gofmt/goimports to format code
- Avoid unnecessary else blocks after return statements
- Prefer early returns to reduce nesting
- Use named return values only when they improve readability
- Limit line length to 100-120 characters
- Use blank interfaces (
any) sparingly - Use
anyinstead ofinterface{}
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.
- 2d ago First seen · 107 lines · 879 tokens per session scan A dfebda9ec361
go-idiomatic-code 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 879 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-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.
cursor-rule-template
Cursor rule "cursor-rule-template" from singchia/gospec, covering gospec —— go 后端 sdlc 规范(cursor 单文件入口), 任务路由(先看这个表,再决定要不要展开 spec/), 核心约束(不可违反,无需打开 spec 也要遵守), 架构 and 编码.
best-practices
Go Best Practices - enforces current best practices when working with Go code.
go-conventions
Go conventions for all Go code (modules, naming, errors, logging, metrics).