Rule

0 installs · 0 said it worked

PatrickJS@patrickjs·
CodingRule· for Cursor

Idiomatic Go coding rules for an expert Go developer assistant

A rules file that makes the model act as an expert Go developer, enforcing explicit error handling, idiomatic naming, interface-based design, context-first concurrency, and table-driven testing.

People use this for

  • go coding rules file
  • golang idiomatic code review
  • go error handling prompt
  • expert go developer assistant
  • write go code with context concurrency
Name
idiomatic-go-coding-rules-for-an-expert-go-developer-assistant
Works with
Cursor
License
CC0(as observed at the source)
Version
v1 · updated Nov 29, 2026
Imported · UnclaimedCC0

Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.

Are you the author?Claim this profileRequest removal

Use this rule

$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/idiomatic-go-coding-rules-for-an-expert-go-developer-assistant-ap7n/export/mdc" -o .cursor/rules/idiomatic-go-coding-rules-for-an-expert-go-developer-assistant.mdc

Then open a new session; Cursor picks it up from .cursor/rules/.

Download idiomatic-go-coding-rules-for-an-expert-go-developer-assistant.mdc
Manual install

Save idiomatic-go-coding-rules-for-an-expert-go-developer-assistant.mdc as .cursor/rules/idiomatic-go-coding-rules-for-an-expert-go-developer-assistant.mdc for this project or ~/.cursor/rules/idiomatic-go-coding-rules-for-an-expert-go-developer-assistant.mdc for every project, then start a new session.

Rule


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

No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.

Tried it

Reports from people who added this rule to their editor. They roll up into the badges above.

No one has filed a report yet. Try the prompt and be the first.

License: CC0v1 · published Nov 29, 2026

Comments

No comments yet. If you tried this prompt, say how it went.