
Golang Swagger
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-codeInstalls 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- Golang Graphql38.5K
- Golang Google Wire38.3K
- Golang Spf13 Viper38.3K
- Golang Uber Fx38.1K
- Golang Uber Dig38K
- Golang How To37.9K
- Golang Linter26.5K
- Golang Pkg Go Dev13.3K
- Golang Refactoring12.9K
- Golang Gopls12.5K
- Golang Code Style46.1K
- Golang Testing45.4K
- Golang Error Handling45.3K
- Golang Security44.2K
- Golang Design Patterns43.8K
- Golang Performance43.6K
- Golang Concurrency43.6K
- Golang Context42.7K
- Golang Naming42.5K
- Golang Database42.5K
- Golang Safety42.2K
- Golang Project Layout42.1K
- Golang Documentation42K
- Golang Modernize42K