golang-swagger

Generates Swagger/OpenAPI documentation from Go code annotations for HTTP APIs.

1|Updated May 27, 2026
One-click install
npx skills add https://github.com/dmwin72015/netdisk --skill golang-swagger-dmwin72015
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-swagger
Source: https://github.com/dmwin72015/netdisk/tree/main/.agents/skills/golang-swagger
Command: npx skills add https://github.com/dmwin72015/netdisk --skill golang-swagger-dmwin72015

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires go, swag, and includes references (resource) components.

What problem does it solve?

Golang Swagger helps you keep your Go API documentation accurate and discoverable by generating a Swagger/OpenAPI spec directly from code annotations, so frontend teams and API consumers don’t rely on outdated or incomplete docs.

Core Features & Use Cases

  • Annotation-driven API contracts: Document handlers using @Summary, @Param, @Success/@Failure, @Router, and @Security to define request/response shapes and routing.
  • Swagger UI wiring across frameworks: Register the Swagger UI endpoint for popular Go HTTP frameworks (Gin, Echo, Fiber, Chi, and net/http).
  • Security and schema correctness: Define Bearer/JWT, OAuth2, API key, or basic auth schemes and use struct tags (swaggertype, enums, swaggerignore, example) to produce correct schemas for tricky Go types.

Quick Start

Use the golang-swagger skill to run swag init, annotate your Go handlers and models, and then wire the Swagger UI so it shows at /swagger/index.html.

Frequently Asked Questions about golang-swagger

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

FAQPage Schema
How do I generate Swagger/OpenAPI documentation from Go code annotations?

To generate OpenAPI docs from Go code, you annotate HTTP handlers using swaggo/swag syntax like @Summary, @Param, and @Router, then run swag init to produce the spec. This Skill guides annotation syntax and swag init execution for accurate API contracts.

How do I wire Swagger UI into my Go HTTP framework?

You wire Swagger UI into Go HTTP frameworks by registering the generated spec endpoint at /swagger/index.html. This Skill provides middleware integration for Gin, Echo, Fiber, Chi, and net/http to serve the interactive UI.

Can I define JWT and Bearer token security schemes in swaggo/swag annotations?

Yes, you can define JWT, Bearer, OAuth2, API key, and basic auth security schemes in swaggo/swag using the @Security annotation. This Skill helps configure security definitions for protected API operations.

How do I handle complex Go types and schema overrides in Swagger documentation?

You handle complex Go types in Swagger documentation by using struct tags like swaggertype, swaggerignore, and example to override schema generation. This Skill ensures correct schemas for tricky Go types and enums.

Does this Swagger generation approach work with both Gin and Fiber?

Yes, this Swagger generation approach works with Gin, Echo, Fiber, Chi, and net/http. The Skill provides framework-specific middleware integration to register the Swagger UI endpoint across these popular Go HTTP routers.

Why are my Swagger annotations not showing up after running swag init?

Swagger annotations may not show up if swag init fails or annotation syntax is inconsistent across operations, parameters, and responses. This Skill enforces consistent annotation syntax and proper struct tag usage to resolve missing docs.