go-swagger

Generate Swagger and OpenAPI documentation for Go HTTP APIs from annotations.

8|Updated Jun 5, 2026
One-click install
npx skills add https://github.com/muratmirgun/gophers --skill go-swagger-muratmirgun
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-swagger
Source: https://github.com/muratmirgun/gophers/tree/main/skills/go-swagger
Command: npx skills add https://github.com/muratmirgun/gophers --skill go-swagger-muratmirgun

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps Go developers keep OpenAPI and Swagger documentation accurate, consistent, and in sync with HTTP handlers so API clients and UI docs do not drift from the code.

Core Features & Use Cases

  • Annotation-driven API docs: Write Swagger comments beside Go handlers using @Summary, @Param, @Success, @Router, and @Security.
  • CLI and build workflow: Regenerate docs with swag init, format annotations with swag fmt, and wire checks into Makefile or CI to prevent stale specs.
  • Framework integration: Add Swagger UI for Gin, Echo, Fiber, Chi, and net/http, and import the generated docs package correctly.
  • Schema enrichment: Use struct tags like example, enums, swaggertype, and swaggerignore to model real request and response shapes.
  • Use case: A team adding a protected order endpoint can document request validation, response schemas, bearer auth, and the /swagger UI without hand-editing generated files.

Quick Start

Use the go-swagger skill to document my Go API handler, generate Swagger output with swag, and tell me exactly which annotations, struct tags, and CI checks I need to keep the spec current.

Frequently Asked Questions about go-swagger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate Swagger documentation for my Go HTTP API using annotations?

Generate Swagger documentation for Go HTTP APIs by writing inline annotations like @Summary, @Param, and @Router beside handlers, then running swag init to produce the spec. Struct tags model request and response schemas.

Can I add Swagger UI to my Gin or Echo framework without hand-editing generated files?

Yes, you can mount Swagger UI for Gin, Echo, Fiber, Chi, and net/http by importing the generated docs package and wiring the framework-specific UI handler, keeping specs aligned without manual edits.

How do I keep OpenAPI specs in sync with my Go code in CI?

Keep OpenAPI specs in sync by running swag init and swag fmt in Makefile or CI pipelines to regenerate and format annotations, preventing stale specs from drifting from handler implementations.

How do I document bearer auth and protected endpoints in Go Swagger annotations?

Document bearer auth for protected endpoints by adding @Security annotations to Go handlers and defining security schemes, modeling protected endpoint request validation and response schemas accurately.

What struct tags do I need to model request and response schemas for swaggo?

Use struct tags like example, enums, swaggertype, and swaggerignore to model real request and response shapes for swaggo, enriching generated schemas to accurately reflect API data structures.

Does swaggo work with net/http or only specific web frameworks?

Swaggo works with net/http alongside Gin, Echo, Fiber, and Chi by correctly importing the generated docs package and applying framework-specific mounting to serve Swagger UI.