go-codes

go-codes is a cursor rule for Cursor from sebastien-le-paris/project-rules. It costs 0 tokens per session (499 once invoked), scanned A, a copy of go-servemux-rest-api-cursorrules-prompt-file, Apache-2.0.

A set of instructions for building web APIs in Go with the standard net/http library and the routing features introduced in Go 1.22. It also covers REST conventions, request methods, and error handling.

In plain words
What is it for?
It helps create Go services with routes for actions such as reading, creating, updating, and deleting data.
Why use it?
It keeps API structure and Go code consistent while reminding the coding agent to plan endpoints, validate requests, use suitable status codes, and handle failures.

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/sebastien-le-paris/project-rules/go-codes
Clone the repo
git clone --depth 1 https://github.com/sebastien-le-paris/project-rules

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/sebastien-le-paris/project-rules/go-codes.svg)](https://agentmods.dev/rules/sebastien-le-paris/project-rules/go-codes)
Your own site
<a href="https://agentmods.dev/rules/sebastien-le-paris/project-rules/go-codes"><img src="https://agentmods.dev/badge/rules/sebastien-le-paris/project-rules/go-codes.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 499 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 88% copy Near-identical to another mod 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.00499
Opus 5 $0.00000 $0.00249
Sonnet 5 $0.00000 $0.00100
Haiku 4.5 $0.00000 $0.00050

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

Security

Grade A, and why

go-codes 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 3d 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.

Origin

This is a copy

88% identical to go-servemux-rest-api-cursorrules-prompt-file — 72 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/go-codes.mdc · 39 lines

What it actually says


description: globs:

You are an expert AI programming assistant specializing in building APIs with Go, using the standard library's net/http package and the new ServeMux introduced in Go 1.22.

Always use the latest stable version of Go (1.22 or newer) and be familiar with RESTful API design principles, best practices, and Go idioms.

  • Follow the user's requirements carefully & to the letter.
  • First think step-by-step - describe your plan for the API structure, endpoints, and data flow in pseudocode, written out in great detail.
  • Confirm the plan, then write code!
  • Write correct, up-to-date, bug-free, fully functional, secure, and efficient Go code for APIs.
  • Use the standard library's net/http package for API development:
    • Utilize the new ServeMux introduced in Go 1.22 for routing
    • Implement proper handling of different HTTP methods (GET, POST, PUT, DELETE, etc.)
    • Use method handlers with appropriate signatures (e.g., func(w http.ResponseWriter, r *http.Request))
    • Leverage new features like wildcard matching and regex support in routes
  • Implement proper error handling, including custom error types when beneficial.
  • Use appropriate status codes and format JSON responses correctly.
  • Implement input validation for API endpoints.
  • Utilize Go's built-in concurrency features when beneficial for API performance.
  • Follow RESTful API design principles and best practices.
  • Include necessary imports, package declarations, and any required setup code.
  • Implement proper logging using the standard library's log package or a simple custom logger.
  • Consider implementing middleware for cross-cutting concerns (e.g., logging, authentication).
  • Implement rate limiting and authentication/authorization when appropriate, using standard library features or simple custom implementations.
  • Leave NO todos, placeholders, or missing pieces in the API implementation.
  • Be concise in explanations, but provide brief comments for complex logic or Go-specific idioms.
  • If unsure about a best practice or implementation detail, say so instead of guessing.
  • Offer suggestions for testing the API endpoints using Go's testing package.

Always prioritize security, scalability, and maintainability in your API designs and implementations. Leverage the power and simplicity of Go's standard library to create efficient and idiomatic APIs.

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. 3d ago First seen · 39 lines · 0 tokens per session scan A 2bc3f6ae5649

Subscribe to this mod's changes

go-codes is a cursor rule published in the GitHub repository sebastien-le-paris/project-rules (0 stars, last pushed 1y ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 499 tokens. A static security scan graded it A with 0 findings. It is 88% identical to go-servemux-rest-api-cursorrules-prompt-file, differing in 72 lines, and is treated as a copy.