go

go is a cursor rule for Cursor from adonai-labs/agent-runway. It costs 0 tokens per session (580 once invoked), scanned A, original, MIT.

A set of Go coding guidelines for handling errors, concurrency, interfaces, context cancellation, and tests. It applies while working on Go files and modules.

In plain words
What is it for?
Use it when writing or reviewing Go services, command-line tools, or libraries, especially code that performs I/O, runs concurrently, or needs tests.
Why use it?
It helps prevent ignored errors, stuck goroutines, unsafe shared data, and inconsistent APIs. It also gives the agent clear Go conventions to follow.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when writing or reviewing Go services, command-line tools, or libraries, especially code that performs I/O, runs concurrently, or needs tests.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/adonai-labs/agent-runway/go
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/adonai-labs/agent-runway

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/adonai-labs/agent-runway/go/github.svg)](https://agentmods.dev/rules/adonai-labs/agent-runway/go)
Your own site
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/go"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/go/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

Your own site · 80×15
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/go"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/go.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 580 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.00000 $0.00580
Opus 5.5 $0.00000 $0.00232
Sonnet 5.5 $0.00000 $0.00116
Haiku 4.5 $0.00000 $0.00058

Measured 1mo ago against content hash 6c7cdada6248, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.

src/stacks/go/go.mdc · 58 lines

How it starts

The opening of the file, as written. The whole thing — 58 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go Development Guidelines

Directives for Go development. Apply when working with .go files or go.mod.


Error Handling

  • Return errors as the last return value; check every error — do not discard with _ unless justified.
  • Wrap errors with context using fmt.Errorf("...: %w", err) so callers can errors.Is/errors.As.
  • Do not panic for expected failures; reserve panic for truly unrecoverable states.
  • Define sentinel errors (var ErrNotFound = errors.New(...)) or typed errors for conditions callers branch on.

Concurrency

  • Pass context.Context as the first parameter to functions that do I/O or can block; honour cancellation.
  • Never start a goroutine without a clear stop/lifecycle; avoid goroutine leaks.
  • Protect shared state with a mutex or a channel — not both for the same data.
  • Run tests with -race; data races are bugs even if they don't fail today.
  • Do not capture loop variables by reference in goroutines without copying (pre-1.22 semantics).

Interfaces and API Design

  • Accept interfaces, return concrete types.
  • Keep interfaces small — define them at the consumer, not the producer.
  • Avoid empty interface{}/any where a concrete type or generic would be clearer.

Idioms

  • Prefer early returns over deep nesting; keep the happy path left-aligned.
  • Use defer for cleanup (close files, unlock mutexes) right after acquisition.
  • Do not ignore the result of Close() on writers where it can surface data loss.
  • Keep package names short, lower-case, and meaningful; avoid stutter (http.HTTPServer).

Testing

  • Use table-driven tests with subtests (t.Run).
  • Use the standard testing package; reserve external assertion libraries for genuine value.
  • Cover happy path, edge cases, and error paths.
  • Use t.Cleanup for teardown; avoid global test state.

Common Anti-patterns

Anti-pattern Do instead
Ignoring returned errors (val, _ :=) Check and handle or wrap the error
panic for expected failures Return an error
Goroutine with no cancellation/stop Pass context.Context and select on ctx.Done()
Naked returns in long functions Return values explicitly
Logging and returning the same error Do one or the other, not both
interface{}/any everywhere Use concrete types or generics

Read the full file on GitHub · 58 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. 1mo ago First seen · 58 lines · 0 tokens per session scan A 6c7cdada6248

Subscribe to this mod's changes

go is a cursor rule published in the GitHub repository adonai-labs/agent-runway (2 stars, last pushed 19d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 580 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-09-03.