go

A Cursor rule for Go development in the har-mcp project. It sets expectations for project folders, commands, naming, formatting, testing, and dependency maintenance.

In plain words
What is it for?
Use it when creating or changing Go programs and packages, then building, testing, formatting, checking, or tidying the project.
Why use it?
It gives coding agents concrete project conventions and verification commands, reducing inconsistent Go code and incorrect assumptions about interfaces.

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/tjamet/har-mcp/go
Clone the repo
git clone --depth 1 https://github.com/tjamet/har-mcp

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 486 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.00486
Opus 5 $0.00000 $0.00243
Sonnet 5 $0.00000 $0.00097
Haiku 4.5 $0.00000 $0.00049

Measured 2d ago against content hash fc21b49f9f33, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.mdc · 68 lines

What it actually says

Go Development Rules for Cursor

Project Structure

  • Use cmd/${program}/main.go for main applications
  • Use pkg/**/*.go for shared libraries and packages
  • Keep packages focused and cohesive

Build and Run Commands

  • NO Make - use simple Go commands only
  • Build: go build ./cmd/har-mcp
  • Run: go run ./cmd/har-mcp
  • Test: go test ./...
  • Format: go fmt ./...
  • Vet: go vet ./...
  • Tidy dependencies: go mod tidy

Code Style

  • Follow standard Go formatting with gofmt
  • Use standard Go naming conventions (PascalCase for exported, camelCase for unexported)
  • Keep functions and methods small and focused
  • Use meaningful variable and function names
  • Avoid unnecessary else clauses when using early returns

Coding

  • You should have access to a godoc tool. Use it as much as possible
  • Don't guess interfaces. Use the tools that you have to doublecheck what you are doing is correct

Testing

  • Use github.com/stretchr/testify for assertions
  • NO table-driven tests - use test helpers instead
  • Test file naming: *_test.go
  • Test function naming: TestFunctionName
  • Use require for test setup that must succeed, assert for actual test assertions
  • Create helper functions to reduce test duplication
  • Test one thing per test function

Error Handling

  • Always handle errors explicitly
  • Use meaningful error messages
  • Wrap errors with context using fmt.Errorf("context: %w", err)
  • Return errors as the last return value

Dependencies

  • Minimize external dependencies
  • Use standard library when possible
  • Pin dependency versions in go.mod

Comments

  • Use godoc style comments for exported functions and types
  • Comment explains WHY, not WHAT
  • Keep comments concise and up-to-date

Performance

  • Avoid premature optimization
  • Profile before optimizing
  • Use appropriate data structures
  • Be mindful of memory allocations in hot paths

Concurrency

  • Use channels for communication between goroutines
  • Avoid shared mutable state
  • Use context.Context for cancellation and timeouts
  • Prefer composition over inheritance
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 · 68 lines · 486 tokens per session scan A fc21b49f9f33

Subscribe to this mod's changes

go is a cursor rule published in the GitHub repository tjamet/har-mcp (27 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 486 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.