cursor_rules

A set of Cursor editor rules for documenting existing Go HTTP APIs with comments and generating OpenAPI 3 specifications. OpenAPI is a machine-readable description of an API’s endpoints, inputs, and outputs.

In plain words
What is it for?
Use it to add documentation comments and data tags to Go handlers and structures, then generate an OpenAPI file with the go-swagger3 tool.
Why use it?
It gives the coding agent a defined process for adding API documentation without rewriting request handlers. The resulting specification can describe how other programs should call the service.

Cursor rule

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/parvez3019/go-swagger3/cursor_rules
Clone the repo
git clone --depth 1 https://github.com/parvez3019/go-swagger3
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,386 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.03386
Opus 5 $0.00000 $0.01693
Sonnet 5 $0.00000 $0.00677
Haiku 4.5 $0.00000 $0.00339

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

Security

Grade A, and why

cursor_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 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.

agent-skills/cursor/cursor_rules.mdc · 345 lines

How it starts

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

go-swagger3 — document existing Go APIs

Copy this file into your project as .cursor/rules/go-swagger3.mdc.

When the user asks to document an API, add Swagger/OpenAPI comments, or generate an OAS file: annotate existing Go code with go-swagger3 godoc @ tags and struct tags, then run the CLI. Prefer editing comments and tags over rewriting handlers.

Install

go install github.com/parvez3019/go-swagger3@latest
export PATH="$HOME/go/bin:$PATH"

# Docker alternative
docker run -t --rm -v $(pwd):/app -w /app parvez3019/go-swagger3:latest \
  --module-path . --main-file-path ./cmd/api/main.go --output oas.json --schema-without-pkg

Workflow

  1. Confirm go.mod exists (Go modules only).
  2. Put service annotations on the main/entry file (@Title and @Version required).
  3. Annotate each HTTP handler’s godoc (comments must sit directly above the func).
  4. Add json + OAS tags on request/response structs; add @Enum / @HeaderParameters types when needed.
  5. Generate (pick the matching layout):
    # main next to go.mod
    go-swagger3 --module-path . --output oas.json --schema-without-pkg
    
    # main elsewhere
    go-swagger3 --module-path . --main-file-path ./cmd/api/main.go --output oas.json --schema-without-pkg
    
    # only scan handlers under a path
    go-swagger3 --module-path . --main-file-path ./cmd/api/main.go --handler-path ./internal/handlers --output oas.json --schema-without-pkg
    
    # YAML
    go-swagger3 --module-path . --main-file-path ./cmd/api/main.go --output oas.json --schema-without-pkg --generate-yaml
    
  6. Open the output, fix gaps, re-run with --debug if needed. Use --strict when hardening.

CLI flags

Flag Purpose
--module-path Module root to scan
--main-file-path File with service-level annotations
--handler-path Optional: only scan handlers under this path
--output Output path (default oas.json)
--schema-without-pkg Schema names without package prefix
--generate-yaml Emit YAML (.json output becomes .yml)
--exclude Comma-separated dirs to skip
--quiet Reduce log noise
--debug Debug logging
--strict Treat parse warnings as fatal

Read the full file on GitHub · 345 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 · 345 lines · 0 tokens per session scan A 70de9abc843c

Subscribe to this mod's changes

cursor_rules is a cursor rule published in the GitHub repository parvez3019/go-swagger3 (149 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,386 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.