go-swagger

go-swagger is a skill for Claude Code from muratmirgun/gophers. It costs 120 tokens per session (2,192 once invoked), scanned A, original, MIT.

A guide for documenting Go HTTP APIs with OpenAPI, a standard format that describes endpoints, inputs, outputs, errors, and security rules.

In plain words
What is it for?
Use it to add annotation comments, generate Swagger files and a documentation UI, describe request and response types, and document authentication.
Why use it?
It keeps API documentation tied to the handlers that implement it and helps prevent published documentation from disagreeing with the actual service.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code; built for openclaw.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is Read [references/swag-cli.md](../../../skills/go-swagger/references/swag-cli.md) for the CLI flag inventory and Makefile patterns..

Part of the gophers plugin — 26 skills, 4 agents shipped together

Good fit Use it to add annotation comments, generate Swagger files and a documentation UI, describe request and response types, and document authentication.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/muratmirgun/gophers
agentmods
npx agentmods add skills/muratmirgun/gophers/go-swagger

Made for: Claude Code.

Or install gophers, the plugin that ships this one along with the rest of its 26 skills, 4 agents.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/muratmirgun/gophers/go-swagger.svg)](https://agentmods.dev/skills/muratmirgun/gophers/go-swagger)
Your own site
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-swagger"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-swagger.svg" alt="Measured on agentmods" height="20"></a>
Per session 120 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,192 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 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.1 $0.00120 $0.02192
Opus 5 $0.00060 $0.01096
Sonnet 5 $0.00024 $0.00438
Haiku 4.5 $0.00012 $0.00219

Measured 8d ago against content hash aaa3c0c9ca82, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

go-swagger 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 8d 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.

.claude-plugin/skills/go-swagger/SKILL.md · 204 lines

How it starts

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

Go Swagger / OpenAPI with swaggo

github.com/swaggo/swag is the de-facto annotation-driven OpenAPI generator for Go. You annotate handlers with // @... comments, run the swag CLI, and get docs/swagger.json, docs/swagger.yaml, and docs/docs.go for the UI.

Core Rules

  1. Docs are a contract. A field documented as required is the API's promise; a mismatch with the implementation is a bug.
  2. Annotations live next to handlers. Not in a separate docs/ folder — comments rot when separated from code.
  3. Regenerate on every change. swag init is part of the build (go generate or a Makefile target). Stale docs/ is worse than no docs.
  4. The docs package must be imported. A blank import (_ "yourmod/docs") registers the spec at process start.
  5. Use named structs for request/response bodies. swag cannot derive a schema from map[string]any or a primitive type.
  6. Security definitions match implementation. If the API enforces JWT, declare @securityDefinitions.apikey Bearer and annotate every protected endpoint with @Security Bearer.

Install and Bootstrap

go install github.com/swaggo/swag/cmd/swag@latest
swag init                              # general info from main.go
swag init -g cmd/api/main.go           # custom main path
swag fmt                               # format annotation comments like gofmt

Wire the UI for your framework — choose one:

// Gin
import (
    swaggerFiles "github.com/swaggo/files"
    ginSwagger  "github.com/swaggo/gin-swagger"
)
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

// Echo
r.GET("/swagger/*", echoSwagger.WrapHandler)

// Fiber
app.Get("/swagger/*", fiberSwagger.WrapHandler(swaggerFiles.Handler))

// Chi / net/http
mux.Handle("/swagger/", httpSwagger.Handler(swaggerFiles.Handler))

Import the generated spec:

import _ "github.com/acme/myapi/docs"          // blank: just register
import docs "github.com/acme/myapi/docs"       // named: override host at runtime

Read the full file on GitHub · 204 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. 8d ago First seen · 204 lines · 120 tokens per session scan A aaa3c0c9ca82

Subscribe to this mod's changes

go-swagger is a skill published in the GitHub repository muratmirgun/gophers (8 stars, last pushed 27d ago), licensed MIT. It adds 120 tokens to every session and 2,192 once invoked, about $0.0006 per session on Opus 5. 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-31.

Related

Other skills, from other repositories

go

Use when writing Go services, CLIs, or libraries. Covers idiomatic error wrapping, goroutine and context discipline, interface design, table-driven tests, and the race detector.

nimadorostkar/Claude-Skills-collection · 38 tokens

golang-pro

Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming…

Jeffallan/claude-skills · 95 tokens

go-programming-expert

Expert-level skill for Go programming (Go 1.25+). Covers high-performance microservices, concurrency patterns, sqlc, net/http, Gin/Echo/Fiber, gRPC, and testing in English and Indonesian.

roedyrustam/vibes-plug · 51 tokens

encore-go-api

Define typed API endpoints in Encore Go using //encore:api annotations. Covers typed request/response structs, path/query/header/cookie params, and error returns. For raw endpoints (//encore:api raw) and inbound webhooks, use encore-go-webhook instead.

encoredev/skills · 66 tokens

encore-go-webhook

Receive inbound webhooks from external services (Stripe, GitHub, Slack, Twilio, etc.) in Encore Go using //encore:api raw. The right skill any time the user names a third-party provider that POSTs events to a URL you own.

encoredev/skills · 60 tokens

encore-go-bucket

Store unstructured files in Encore Go using objects.NewBucket from encore.dev/storage/objects — uploads, images, documents, blobs.

encoredev/skills · 37 tokens