go-api-development-general-rules

go-api-development-general-rules is a cursor rule for Cursor from paulpham157/paul-s-cursor-rules. It costs 0 tokens per session (433 once invoked), scanned A, a copy of go-servemux-rest-api-cursorrules-prompt-file, MIT.

A set of rules for building web APIs in Go with the standard net/http package, including REST design, validation, errors, JSON responses, and concurrency.

In plain words
What is it for?
It helps create API structures, endpoints, request handling, response formatting, and supporting setup in Go 1.22 or newer.
Why use it?
It provides a consistent approach to planning and implementing Go APIs while covering common correctness and security concerns.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit It helps create API structures, endpoints, request handling, response formatting, and supporting…

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/paulpham157/paul-s-cursor-rules/go-api-development-general-rules
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.

Clone the repo
git clone --depth 1 https://github.com/paulpham157/paul-s-cursor-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-api-development-general-rules

README.md
[![agentmods](https://agentmods.dev/badge/rules/paulpham157/paul-s-cursor-rules/go-api-development-general-rules.svg)](https://agentmods.dev/rules/paulpham157/paul-s-cursor-rules/go-api-development-general-rules)
Your own site
<a href="https://agentmods.dev/rules/paulpham157/paul-s-cursor-rules/go-api-development-general-rules"><img src="https://agentmods.dev/badge/rules/paulpham157/paul-s-cursor-rules/go-api-development-general-rules.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 433 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 91% 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.1 $0.00000 $0.00433
Opus 5 $0.00000 $0.00217
Sonnet 5 $0.00000 $0.00087
Haiku 4.5 $0.00000 $0.00043

Measured 3d ago against content hash 4599fae046cc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

go-api-development-general-rules 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

91% identical to go-servemux-rest-api-cursorrules-prompt-file — 57 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.

1/framework_rules/rules/go-servemux-rest-api-cursorrules-prompt-file/go-api-development-general-rules.mdc · 26 lines

What it actually says

  • 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:
    • 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 · 26 lines · 0 tokens per session scan A 4599fae046cc

Subscribe to this mod's changes

go-api-development-general-rules is a cursor rule published in the GitHub repository paulpham157/paul-s-cursor-rules (27 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 433 tokens. A static security scan graded it A with 0 findings. It is 91% identical to go-servemux-rest-api-cursorrules-prompt-file, differing in 57 lines, and is treated as a copy.