| name | golang-swagger |
| description | Golang OpenAPI/Swagger documentation with swaggo/swag — annotation comments (@Summary, @Param, @Success, @Router, @Security), swag init code generation, framework integrations (gin, echo, fiber, chi, net/http), security definitions (Bearer/JWT, OAuth2, API key), and struct tags (swaggertype, enums, example, swaggerignore). Apply when adding or maintaining Swagger/OpenAPI docs in a Go project, or when the codebase imports github.com/swaggo/swag, github.com/swaggo/gin-swagger, github.com/swaggo/echo-swagger, github.com/swaggo/http-swagger, or github.com/swaggo/files. |
| user-invocable | true |
| license | MIT |
| compatibility | Designed for Claude Code or similar AI coding agents. Requires go and swag CLI. |
| metadata | {"author":"samber","version":"1.0.4","openclaw":{"emoji":"📋","homepage":"https://github.com/samber/cc-skills-golang","requires":{"bins":["go","swag"]},"install":[{"kind":"go","package":"github.com/swaggo/swag/cmd/swag@latest","bins":["swag"]}],"skill-library-version":"2.0.0-rc5"}} |
| allowed-tools | Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs Bash(swag:*) AskUserQuestion Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__* |
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
swag init -g cmd/api/main.go
swag 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"
import docs "yourmodule/docs"
Wire the UI endpoint — pick your framework:
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
e.GET("/swagger/*", echoSwagger.WrapHandler)
app.Get("/swagger/*", fiberSwagger.WrapHandler(swaggerFiles.Handler))
mux.Handle("/swagger/", httpSwagger.Handler(swaggerFiles.Handler))
r.Get("/swagger/*", httpSwagger.Handler(swaggerFiles.Handler))
Access the UI at /swagger/index.html.