Adds Swagger/OpenAPI documentation to Go projects using swaggo/swag. Covers the full workflow: annotating handlers with @Summary, @Param, @Success, @Router directives, running swag init to generate docs, and wiring the UI endpoint for Gin, Echo, Fiber, Chi, or net/http. Includes security definitions for Bearer/JWT, OAuth2, and API keys, plus struct tags for examples, enums, and type overrides. The audit mode is handy for reviewing existing annotations for completeness. One thing to watch: you need to re-run swag init after every annotation change or your docs will drift. The skill treats API docs as a contract, which is the right mindset if you're shipping a public or partner-facing API.

skills.sh installs
38.6K
GitHub stars
3.8K
last updated
Aug 21, 2026

Install

$ npx -y skills add samber/cc-skills-golang --skill golang-swagger --agent claude-code

Installs into .claude/skills of the current project.

Files

Persona: You are a Go API documentation engineer. You treat docs as a contract — accurate, complete annotations prevent integration bugs and make the Swagger UI the source of truth for API consumers.

Modes:

  • Build — adding Swagger to a new or existing Go project: set up the toolchain, annotate handlers, generate docs, wire the UI endpoint.
  • Audit — reviewing existing swagger annotations for completeness, correctness, and security coverage.

Dependencies:

  • swag: go install github.com/swaggo/swag/cmd/swag@latest

Setup

Three steps to get Swagger UI running:

swag init                        # generates docs/ with docs.go, swagger.json, swagger.yaml
swag init -g cmd/api/main.go     # if general info is not in main.go
swag fmt                         # format annotation comments (like go fmt)

Import the docs package to register the spec. Use a blank import when only wiring the UI; use a named import when you also need to override docs.SwaggerInfo at runtime:

import _ "yourmodule/docs"          // blank: registers spec, no identifier
import docs "yourmodule/docs"       // named: use when overriding SwaggerInfo

Sponsors

Details

Repository
github.com/samber/cc-skills-golang
Categories
Backend & APIs, Security, Git & Pull Requests, Documentation, Go
First seen
May 16, 2026

More from samber/cc-skills-golang

All 47
1mcp-use avatarmcp-apps-buildermcp-use/mcp-useBuild, modify, debug, migrate, or review TypeScript MCP servers and interactive MCP Apps using mcp-use v2. Use for tools, resources, prompts, Views, React host 33.1Kskills.sh installs
2minimax-ai avatarmmx-climinimax-ai/cliUse mmx to generate text, images, video, speech, and music via the MiniMax AI platform. Use when the user wants to create media content, chat with MiniMax model32.5Kskills.sh installs
3expo avatarexpo-data-fetchingexpo/skillsFramework (OSS). Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching31.8Kskills.sh installs
4caffeinelabs avatarextension-core-infrastructurecaffeinelabs/skillsCore infrastructure providing backend connection configuration, storage client, and React app entry point.30.8Kskills.sh installs
5caffeinelabs avatarextension-http-outcallscaffeinelabs/skillsHTTP outcalls performed by the backend canister (not in the frontend).30.8Kskills.sh installs
6caffeinelabs avatarextension-openaicaffeinelabs/skillsMANDATORY recipe for every Caffeine build that calls OpenAI (ChatGPT, GPT-4o, an LLM, a chatbot, embeddings). The ONLY supported path is the `openai-client` mop30.8Kskills.sh installs