Skip to content
Back to skills

Generate Go Api Docs From Source Annotations With Swag

ASecurity

Use Swag when an agent needs to turn Go handler annotations into reviewable Swagger 2.0 documentation before API docs, clients, or release checks depend on it.

  • 36 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentsgodockergitapisecuritydocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 2, 2026

npx -y skills add agentskillexchange/skills --skill generate-go-api-docs-from-source-annotations-with-swag --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Generate Go Api Docs From Source Annotations With Swag?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Generate Go Api Docs From Source Annotations With Swag
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/agentskillexchange-generate-go-api-docs-from-source-annotations-with/badge)](https://www.skillsdirectory.com/skills/agentskillexchange-generate-go-api-docs-from-source-annotations-with)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "Generate Go API docs from source annotations with Swag"
slug: "generate-go-api-docs-from-source-annotations-with-swag"
description: "Use Swag when an agent needs to turn Go handler annotations into reviewable Swagger 2.0 documentation before API docs, clients, or release checks depend on it."
github_stars: 12867
verification: "security_reviewed"
source: "https://github.com/swaggo/swag"
author: "swaggo"
publisher_type: "open_source"
category: "Library & API Reference"
framework: "Multi-Framework"
tool_ecosystem:
  github_repo: "swaggo/swag"
  github_stars: 12867
---

# Generate Go API docs from source annotations with Swag

Use Swag when an agent needs to turn Go handler annotations into reviewable Swagger 2.0 documentation before API docs, clients, or release checks depend on it.

## Prerequisites

Go 1.19 or newer; Swag CLI or Docker image; Go API source tree with handler annotations

## Installation

Use the upstream install or setup path that matches your environment:
- go install github.com/swaggo/swag/cmd/swag@latest
- docker run --rm -v $(pwd):/code ghcr.io/swaggo/swag:latest
- Make sure to import the generated docs/docs.go so that your specific configuration gets init'ed. If your General API annotations do not live in main.go, you can let swag know with -g flag.
- Make it OR condition

Requirements and caveats from upstream:
- Alternatively you can run the docker image:
- --dir value, -d value Directories you want to parse,comma separated and general-info file must be in the first one (default: "./")
- | x-name | The extension key, must be start by x- and take only json value | // @x-example-key {"key": "value"} |

Basic usage or getting-started notes:
- [Getting started](#getting-started)
- [Example value of struct](#example-value-of-struct)
- Add comments to your API source code, See [Declarative Comments Format](#declarative-comments-format).

- Source: https://github.com/swaggo/swag
- Extracted from upstream docs: https://raw.githubusercontent.com/swaggo/swag/HEAD/README.md

## Documentation

- https://github.com/swaggo/swag

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/generate-go-api-docs-from-source-annotations-with-swag/)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…