go-development

A set of working rules for writing Go programs in the style commonly expected by the Go community. It covers errors, interfaces, simultaneous tasks, modules, formatting, building, and testing.

In plain words
What is it for?
Use it to start Go modules, manage dependencies, format code, build programs, run tests, and check code with Go's analysis tools.
Why use it?
It helps developers follow Go conventions and verify that changes compile, pass tests, and meet basic static checks.

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/madebyaris/rakitui-ai/go-development
Clone the repo
git clone --depth 1 https://github.com/madebyaris/rakitui-ai

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,385 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.03385
Opus 5 $0.00000 $0.01692
Sonnet 5 $0.00000 $0.00677
Haiku 4.5 $0.00000 $0.00338

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

Security

Grade A, and why

go-development 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.

.cursor/rules/go-development.mdc · 693 lines

How it starts

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

Go Development Patterns

Idiomatic Go patterns focusing on simplicity, clarity, and concurrency.

CRITICAL: Agentic-First Go Development

Pre-Development Verification (MANDATORY)

Before writing ANY Go code:

1. CHECK GO INSTALLATION
   → run_terminal_cmd("go version")
   
2. VERIFY CURRENT GO VERSION (use web_search)
   → web_search("Go golang stable version December 2024")
   → Ensure go.mod uses correct version
   
3. CHECK EXISTING PROJECT
   → Does go.mod exist? Read it first!
   → What Go version is specified?
   → Are dependencies already present?
   
4. FOR NEW PROJECTS - USE go mod init
   → NEVER manually create go.mod
   → run_terminal_cmd("go mod init github.com/org/project")

CLI-First Go Development

ALWAYS use Go CLI tools:

# Project initialization (NEVER manually create go.mod)
go mod init github.com/myorg/myproject

# Add dependencies (NEVER manually edit go.mod)
go get github.com/gin-gonic/gin@latest
go get github.com/lib/[email protected]

# Verify and tidy
go mod tidy
go mod verify

# Build and test
go build ./...
go test ./...
go vet ./...

# Format (ALWAYS before committing)
go fmt ./...
gofmt -s -w .

Post-Edit Verification

After ANY Go code changes, ALWAYS run:

# Verify compilation
go build ./...

# Check for issues
go vet ./...

# Run tests
go test ./...

# Ensure dependencies are correct
go mod tidy

Common Go Syntax Traps (Avoid These!)

// WRONG: Missing error check
result, _ := doSomething()  // Never ignore errors!

// CORRECT: Always handle errors
result, err := doSomething()
if err != nil {
    return fmt.Errorf("doSomething failed: %w", err)
}

// WRONG: Range loop variable capture
for _, item := range items {
    go func() {
        process(item)  // Bug! Captures loop variable
    }()
}

// CORRECT: Pass as parameter
for _, item := range items {
    go func(i Item) {
        process(i)
    }(item)
}

// WRONG: Nil map write
var m map[string]int
m["key"] = 1  // Panic!

// CORRECT: Initialize map
m := make(map[string]int)
m["key"] = 1

Read the full file on GitHub · 693 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. 2d ago First seen · 693 lines · 0 tokens per session scan A 07550177f87f

Subscribe to this mod's changes

go-development is a cursor rule published in the GitHub repository madebyaris/rakitui-ai (5 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,385 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-31.