go-conventions

go-conventions is a cursor rule for Cursor from AlphaBitCore/nexus-gateway. It costs 0 tokens per session (906 once invoked), scanned A, original, Apache-2.0.

A style guide for Go code, covering module imports, names, errors, concurrency, logging, and metrics. Go is a programming language commonly used for backend services.

In plain words
What is it for?
Use it when writing or reviewing any Go package, especially code involving errors, concurrent data, configuration, logs, or metrics.
Why use it?
It keeps code consistent with the language and project, and helps errors, shared state, and logging behave predictably.

Cursor rule for Cursor

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/alphabitcore/nexus-gateway/go-conventions
Clone the repo
git clone --depth 1 https://github.com/AlphaBitCore/nexus-gateway

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-conventions

README.md
[![agentmods](https://agentmods.dev/badge/rules/alphabitcore/nexus-gateway/go-conventions.svg)](https://agentmods.dev/rules/alphabitcore/nexus-gateway/go-conventions)
Your own site
<a href="https://agentmods.dev/rules/alphabitcore/nexus-gateway/go-conventions"><img src="https://agentmods.dev/badge/rules/alphabitcore/nexus-gateway/go-conventions.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 906 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00906
Opus 5 $0.00000 $0.00453
Sonnet 5 $0.00000 $0.00181
Haiku 4.5 $0.00000 $0.00091

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

Security

Grade A, and why

go-conventions 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 4d 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.

.cursor/rules/go-conventions.mdc · 81 lines

How it starts

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

Go conventions (binding)

You are editing Go code. Follow idiomatic Go (Effective Go + Go Code Review Comments + std-lib patterns). Do not invent non-standard patterns.

Workspace + module paths

  • All Go modules linked via go.work at repo root.
  • Module path: github.com/AlphaBitCore/nexus-gateway/packages/<module>.
  • Imports use full module paths — Go has no relative imports.

Naming

  • Package: lowercase, short, no underscores (configtypes, configcache).
  • No stutter: hooks.Hook ok; hooks.HooksRegistry stutters.
  • Exported types: PascalCase.

Errors

  • Return errors; do not panic in library code.
  • Sentinel: errors.New("specific lowercase message").
  • Wrap: fmt.Errorf("context: %w", err).

Concurrency

  • sync.Mutex / sync.RWMutex for shared state.
  • atomic.Pointer for hot-swappable config snapshots.
  • sync.Pool for high-frequency allocations.
  • context.Context first parameter on any cross-package method.

Logging (binding)

  • *slog.Logger as a constructor parameter, not a global.
  • After wiring SlogSink + slog.SetDefault(...), MUST reassign module-scope logger = slog.Default() — otherwise DI-injected loggers silently bypass the diag pipeline. Memory anchor: [[feedback_server_slog_sink_di_bypass]].

Metrics

  • prometheus/client_golang via promauto for registration.
  • Constructors that register metrics accept a namespace string parameter.

Testing

  • go test -race -count=1.
  • Table-driven where appropriate.
  • Tests in same package (white-box) or _test package (black-box).

Linting

  • golangci-lint with .golangci.yml per module.
  • Enforce errorlint, bodyclose, noctx, copyloopvar, intrange.

replace directives — workspace-sibling contract (binding)

Every packages/<svc>/go.mod requiring a sibling at github.com/AlphaBitCore/nexus-gateway/packages/<sibling> MUST:

  • Pin the require version to exactly v0.0.0 — an inert placeholder, never a real pseudo-version like v0.0.0-YYYYMMDDHHMMSS-COMMITHASH.
  • Carry a matching replace github.com/AlphaBitCore/nexus-gateway/packages/<sibling> => ../<sibling> directive.
  • Keep its go.sum free of any github.com/AlphaBitCore/nexus-gateway/packages/ lines.

Read the full file on GitHub · 81 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. 4d ago First seen · 81 lines · 0 tokens per session scan A cafd55ca4b7a

Subscribe to this mod's changes

go-conventions is a cursor rule published in the GitHub repository AlphaBitCore/nexus-gateway (23 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 906 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.