golang-gin-swagger
Installation
SKILL.md
golang-gin-swagger — Swagger/OpenAPI Documentation
Generate and serve Swagger/OpenAPI documentation for Gin APIs using swaggo/swag. This skill covers the 80% you need daily: setup, handler annotations, model tags, Swagger UI, and doc generation.
When to Use
- Adding Swagger/OpenAPI documentation to a Gin API
- Documenting endpoints with request/response schemas
- Serving Swagger UI for interactive API exploration
- Generating
swagger.json/swagger.yamlfrom Go annotations - Documenting JWT Bearer auth in OpenAPI spec
- Setting up CI/CD to validate docs are up to date
Quick Reference
Dependencies
go install github.com/swaggo/swag/cmd/swag@latest— CLI doc generatorgo get -u github.com/swaggo/gin-swagger+go get -u github.com/swaggo/files- Ensure
$(go env GOPATH)/binis in$PATH