go

go is a cursor rule for coding agents from ItamarZand88/awesome-agent-conventions. It costs 321 tokens per session, scanned A, a copy of go, MIT.

A set of coding rules for Go, a programming language commonly used for services and command-line tools.

In plain words
What is it for?
Use it when editing Go files so the agent follows idiomatic conventions such as explicit errors, context-aware blocking functions, and table-driven tests.
Why use it?
It gives an agent consistent guidance for error handling, naming, interfaces, concurrency, testing, and avoiding unsafe or unclear patterns.

Cursor rule

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.

agentmods
npx agentmods add rules/itamarzand88/awesome-agent-conventions/go
Clone the repo
git clone --depth 1 https://github.com/ItamarZand88/awesome-agent-conventions

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/itamarzand88/awesome-agent-conventions/go.svg)](https://agentmods.dev/rules/itamarzand88/awesome-agent-conventions/go)
Your own site
<a href="https://agentmods.dev/rules/itamarzand88/awesome-agent-conventions/go"><img src="https://agentmods.dev/badge/rules/itamarzand88/awesome-agent-conventions/go.svg" alt="Measured on agentmods" height="20"></a>
Per session 321 This file is loaded in full into every session.
When invoked 321 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 95% 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.00321 $0.00321
Opus 5 $0.00161 $0.00161
Sonnet 5 $0.00064 $0.00064
Haiku 4.5 $0.00032 $0.00032

Measured 5d ago against content hash 70c8f5ece2cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

go 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 5d 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

95% identical to go — 1 line 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.

conventions/agent-rules/examples/awesome-cursorrules-go/go.mdc · 44 lines

What it actually says


description: "Idiomatic Go rules. Explicit error handling, interface-based design, context-first concurrency." globs: **/*.go alwaysApply: false

Go Language Rules

Expert Go developer. Simple, explicit, idiomatic.

Error Handling

  • Always handle errors — never assign to _
  • fmt.Errorf("context: %w", err) for wrapping
  • errors.Is() / errors.As() for checking
  • Custom error types for structured errors

Naming

  • Short for short-lived vars: i, n, err, ok
  • No stuttering: user.UserID → user.ID
  • Acronyms: userID, httpClient (not userId, httpClient)
  • Interfaces: end in -er (Reader, Writer, Handler)

Interfaces

  • Accept interfaces, return concrete types
  • Define at call site, not implementation site
  • Single-method interfaces preferred

Concurrency

  • context.Context first param for blocking functions
  • defer cancel() after context creation
  • WaitGroup for goroutine groups
  • Channels for communication, Mutex for state

Testing

  • Table-driven: for _, tc := range testCases { t.Run(tc.name, ...) }
  • Interface-based mocking

Forbidden

  • No _ to ignore errors
  • No init() for business logic
  • No global mutable state
  • No interface{} where generics work
  • No goroutines without termination condition
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. 5d ago First seen · 44 lines · 321 tokens per session scan A 70c8f5ece2cf

Subscribe to this mod's changes

go is a cursor rule published in the GitHub repository ItamarZand88/awesome-agent-conventions (30 stars, last pushed 1mo ago), licensed MIT. It adds 321 tokens to every session, about $0.0016 per session on Opus 5. A static security scan graded it A with 0 findings. It is 95% identical to go, differing in 1 line, and is treated as a copy.