Agent skill

Golang Swagger

by context-labs in context-labs/whip

Golang OpenAPI/Swagger docs with swaggo/swag — annotations (@Summary, @Param, @Success, @Router, @Security), swag init, framework integrations (gin, echo, fiber, chi), security definitions, struct…

MITAuto-check passedBackend & APIs

Install Golang Swagger

skills CLI
$ npx skills add context-labs/whip --skill golang-swagger -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install context-labs/whip golang-swagger --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/context-labs/whip.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/golang-swagger .claude/skills/golang-swagger && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
golang-swagger
GitHub stars
1.1k
Used in
2 other repos
Token cost
~2.3k tokens
SKILL.md length
582 words
Files
3 (incl. references)
Skills in repo
40
Repo updated
First seen
Licence
MIT

At a glance

Golang OpenAPI/Swagger docs with swaggo/swag — annotations (@Summary, @Param, @Success, @Router, @Security), swag init, framework integrations (gin, echo, fiber, chi), security definitions, struct…

  • Tasks that involve OpenAPI specifications
  • SKILL.md covers Setup, General API Info, Operation Annotations and Security Definitions, plus 3 more sections
  • Calls go

What it does

Golang Swagger is an agent skill from context-labs/whip. Golang OpenAPI/Swagger docs with swaggo/swag — annotations (@Summary, @Param, @Success, @Router, @Security), swag init, framework integrations (gin, echo, fiber, chi), security definitions, struct tags. Apply when adding/maintaining Swagger docs in Go or the codebase imports github.com/swaggo/.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `evals/evals.json` and `references/swag-cli.md`). Compatibility notes: Designed for Claude Code, Codex or similar harness. Requires go and swag CLI.

It sits in Backend & APIs, covering OpenAPI specifications. It works with OpenAPI, Go and GitHub. The repository describes itself as: A fast coding-agent harness in Go. Tool-use loop, bubbletea TUI, provider-routable models with live catalog discovery, MCP support, background subagents. One binary, no runtime… The licence is MIT.

When your agent uses it

  • Tasks that involve OpenAPI specifications

Example prompts

  • “/golang-swagger”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness. Requires go and swag CLI.
  • Pre-approved tools (allowed-tools): Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(swag:*), AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*

What it can do on your machine

Read from SKILL.md and the folder at commit 8876467. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Edit
    • Write
    • Glob
    • Grep
    • Bash(go:*)
    • Bash(golangci-lint:*)
    • Bash(git:*)
    • Agent
    • WebFetch

    …and 8 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code, Codex or similar harness. Requires go and swag CLI.

    From compatibility in the SKILL.md frontmatter.

Context cost

Golang Swagger loads about 2.3k tokens when it runs, and up to ~3.4k if it reads all its reference files. Until then it costs about 78 tokens; SKILL.md has 582 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~78
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from context-labs/whip at commit 8876467, republished under its MIT licence (© context-labs). 582 words, ~2,262 tokens.

Download SKILL.mdSave it as .claude/skills/golang-swagger/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
golang-swagger
description
Golang OpenAPI/Swagger docs with swaggo/swag — annotations (@Summary, @Param, @Success, @Router, @Security), swag init, framework integrations (gin, echo, fiber, chi), security definitions, struct tags. Apply when adding/maintaining Swagger docs in Go or the codebase imports github.com/swaggo/*.
allowed-tools
Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(swag:*), AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*
compatibility
Designed for Claude Code, Codex or similar harness. Requires go and swag CLI.
user-invocable
true
license
MIT
metadata.author
samber
metadata.version
1.1.0
paths
**/*.go

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:

bash
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:

go
import _ "yourmodule/docs"          // blank: registers spec, no identifier
import docs "yourmodule/docs"       // named: use when overriding SwaggerInfo

Wire the UI endpoint — pick your framework:

go
// Gin
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

// Echo
e.GET("/swagger/*", echoSwagger.WrapHandler)

// Fiber
app.Get("/swagger/*", fiberSwagger.WrapHandler(swaggerFiles.Handler))

// net/http
mux.Handle("/swagger/", httpSwagger.Handler(swaggerFiles.Handler))

// Chi
r.Get("/swagger/*", httpSwagger.Handler(swaggerFiles.Handler))

Access the UI at /swagger/index.html.

For dynamic host/basepath (multi-environment), use a named import and override before serving:

go
import docs "yourmodule/docs"

docs.SwaggerInfo.Host     = os.Getenv("API_HOST")
docs.SwaggerInfo.BasePath = "/api/v1"

Full CLI reference

General API Info

Place in main.go (or the file passed via -g). These annotations define the top-level spec:

go
// @title           My API
// @version         1.0
// @description     Short description of the API.
// @host            localhost:8080
// @BasePath        /api/v1
// @schemes         http https

// @contact.name    API Support
// @contact.email   support@example.com
// @license.name    Apache 2.0

// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
// @description Type "Bearer" followed by a space and the JWT token.

Operation Annotations

Annotate each handler function. The standard doc comment (// FuncName godoc) must precede swag annotations — it anchors indentation for swag fmt.

go
// ShowAccount godoc
// @Summary      Get account by ID
// @Description  Returns account details for the given ID.
// @Tags         accounts
// @Accept       json
// @Produce      json
// @Param        id      path  int  true  "Account ID"
// @Param        filter  query string false "Optional search filter"
// @Success      200  {object}  model.Account
// @Success      204  "No content"
// @Failure      400  {object}  api.ErrorResponse
// @Failure      404  {object}  api.ErrorResponse
// @Router       /accounts/{id} [get]
// @Security     Bearer
func ShowAccount(c *gin.Context) {}

@Param format: @Param <name> <in> <type> <required> "<description>" [attributes]

<in>Usage
pathURL path segment (/users/{id})
queryURL query string (?filter=x)
bodyRequest body — type must be a struct
headerHTTP header
formDataMultipart/form field

Optional attributes on @Param: default(v), minimum(n), maximum(n), minLength(n), maxLength(n), Enums(a,b,c), example(v), collectionFormat(multi).

@Success/@Failure format: @Success <code> {<kind>} <type> "<description>"

<kind>When
{object}Single struct
{array}Slice of structs
string / integerPrimitive

Generics (swag v2): @Success 200 {object} api.Response[model.User]

Nested composition: @Success 200 {object} api.Response{data=model.User}

Security Definitions

Define once at the API level (in main.go), apply per endpoint with @Security.

go
// Bearer / JWT
// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization

// API key in header
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name X-API-Key

// Basic auth
// @securityDefinitions.basic BasicAuth

// OAuth2 authorization code
// @securityDefinitions.oauth2.authorizationCode OAuth2
// @authorizationUrl https://example.com/oauth/authorize
// @tokenUrl https://example.com/oauth/token
// @scope.read Read access
// @scope.write Write access

Apply to an endpoint:

go
// @Security Bearer
// @Security OAuth2[read, write]
// @Security BasicAuth && ApiKeyAuth   // AND — both required

Struct Tags

Enrich models without changing their Go type:

go
type CreateUserRequest struct {
    Name   string `json:"name" example:"Jane Doe" minLength:"2" maxLength:"100"`
    Role   string `json:"role" enums:"admin,user,guest" example:"user"`
    Age    int    `json:"age" minimum:"18" maximum:"120"`
    Avatar []byte `json:"avatar" swaggertype:"string" format:"base64"`
    Secret string `json:"-" swaggerignore:"true"`  // excluded from docs
}
TagPurpose
exampleExample value shown in Swagger UI
enumsComma-separated allowed values
swaggertypeOverride detected type (e.g., "primitive,integer" for time.Time)
swaggerignore:"true"Exclude field from the generated schema
extensionsAdd OpenAPI extensions: extensions:"x-nullable,x-deprecated=true"
Show full SKILL.md (266 more words)Show less

Common Mistakes

MistakeWhy it breaksFix
Missing _ "yourmodule/docs" importSchema not registered; UI loads emptyAdd blank import in main.go or server init
Stale docs/ after code changesDocs diverge from implementation; consumers get wrong schemaRe-run swag init after every annotation change
@Param body with primitive typeswag cannot derive schema from string; generation failsAlways use a named struct for body params
No @Security on protected routesSwagger UI shows no lock icon; testers send unauthenticated requestsApply @Security to every authenticated endpoint
General info annotations in the wrong fileswag silently skips them; spec has no title/hostUse -g <file> flag or move annotations to main.go
Using {object} with a map typeswag cannot generate a schema for map[string]any without helpUse a named struct or annotate with swaggertype
Multi-word @Tags without quotesTags split on spaces, producing malformed groupingQuote tags with spaces: @Tags "user accounts"

Cross-References

  • → See samber/cc-skills-golang@golang-security for securing the Swagger UI endpoint in production (disable or gate with auth middleware).
  • → See samber/cc-skills-golang@golang-grpc for gRPC — use grpc-gateway with its own OpenAPI generator instead of swag.

This skill is not exhaustive. Refer to the swaggo/swag documentation and code examples for up-to-date API signatures and usage patterns. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See samber/cc-skills-golang@golang-pkg-go-dev skill (godig) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See samber/cc-skills-golang@golang-gopls skill (gopls). Context7 remains a fallback for docs not indexed on pkg.go.dev.

If you encounter a bug or unexpected behavior in swag, open an issue at https://github.com/swaggo/swag/issues.

© context-labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .agents/skills/golang-swagger of context-labs/whip.

  • SKILL.md
  • evals/evals.json
  • references/swag-cli.md

Open the folder on GitHubat commit 8876467

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in context-labs/whip, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Golang Swagger next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Golang Swagger compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Golang Swagger this skillcontext-labs/whip1.1k2 repos~2.3kAutomated safety check: PassMIT
B24phpsdk Maintainerbitrix24/b24phpsdk102—~10kAutomated safety check: NotesMIT
Distilled SDKalchemy-run/distilled432—~6kAutomated safety check: PassApache-2.0
Arandu Shared Modules Guidearandu-io/arandu281—~1.8kAutomated safety check: PassMIT
Counterfact Repo Basicscounterfact/api-simulator170—~868Automated safety check: PassMIT
GitHub Openapi Skillholon-run/uxc116—~899Automated safety check: PassMIT

Similar skills

  • B24phpsdk Maintainer

    bitrix24/b24phpsdk

    A skill your agent uses whenever working with GitHub issues in the bitrix24/b24phpsdk repository: creating new issues, reading existing ones, planning implementation from an issue, referencing an…

    102 GitHub stars~10k tokensUpdated 10 days ago
    Backend & APIsAuto-check: notes
  • Distilled SDK

    alchemy-run/distilled

    Build or update a distilled SDK for an API provider — sourcing its OpenAPI/Smithy/GraphQL/discovery description, adding the spec mirror that feeds it, generating packages/<provider, listing it on…

    432 GitHub stars~6k tokensUpdated today
    Backend & APIsAuto-check passed
  • Decides whether a feature belongs in the application or in one of five shared Arandu modules before adding permissions, wallets, tags, Markdown rendering or API docs.

    281 GitHub stars~1.8k tokensUpdated today
    Backend & APIsAuto-check passed
  • Counterfact Repo Basics

    counterfact/api-simulator

    Provide Counterfact repository orientation, high-level architecture, and the canonical command reference for install/build/test/lint workflows.

    170 GitHub stars~868 tokensUpdated today
    Backend & APIsAuto-check passed
  • Operate GitHub REST API through UXC with the official OpenAPI schema, explicit gh-to-uxc auth import, and read-first guardrails for repo, issue, pull request, and event workflows.

    116 GitHub stars~899 tokensUpdated 25 days ago
    Backend & APIsAuto-check passed
  • Datadog Data Source Generator

    DataDog/terraform-provider-datadog

    Official

    Generates a Datadog Terraform provider data source from an OpenAPI operation with tfgen and opens a review-ready GitHub PR with a risk scan and testing guide.

    468 GitHub stars~2.7k tokensUpdated yesterday
    DevOps & CloudAuto-check passed

More from context-labs/whip

All 40 skills in this repo
  • Golang Lint

    context-labs/whip

    Linting best practices and golangci-lint configuration for Go — running linters, configuring .golangci.yml, nolint suppressions, selecting linters.

    1.1k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • Golang Project Layout

    context-labs/whip

    Golang project layouts and workspaces. An agent skill from context-labs/whip.

    1.1k GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Golang Pkg Go Dev

    context-labs/whip

    Golang package/module docs via godig, a pkg.go.dev API client (CLI + MCP) — APIs, symbols, versions, importers, licenses, vulnerabilities.

    1.1k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • Golang Stretchr Testify

    context-labs/whip

    Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq.

    1.1k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • CI/CD with GitHub Actions for Golang — testing, linting, SAST, security scanning, coverage, Dependabot, Renovate, GoReleaser, release pipelines.

    1.1k GitHub stars~3.5k tokensUpdated 5 days ago
    Auto-check passed
  • Golang Data Structures

    context-labs/whip

    Golang data structures — slices/maps internals (capacity growth, preallocation, hash buckets), slices/maps packages, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections…

    1.1k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed

Works with

Categories

Questions about Golang Swagger

What does Golang Swagger do?

Golang OpenAPI/Swagger docs with swaggo/swag — annotations (@Summary, @Param, @Success, @Router, @Security), swag init, framework integrations (gin, echo, fiber, chi), security definitions, struct…. Golang Swagger is an agent skill from context-labs/whip. Golang OpenAPI/Swagger docs with swaggo/swag — annotations (@Summary, @Param, @Success, @Router, @Security), swag init, framework integrations (gin, echo, fiber, chi), security definitions, struct tags.

When should I use Golang Swagger?

Golang Swagger fits situations like: tasks that involve OpenAPI specifications.

How do I install Golang Swagger in Claude Code?

Run `npx skills add context-labs/whip --skill golang-swagger -a claude-code`. Or copy the skill folder (.agents/skills/golang-swagger in context-labs/whip) into .claude/skills/golang-swagger in your project. Claude Code loads it when a task matches its description.

How do I install Golang Swagger in Codex?

Run `npx skills add context-labs/whip --skill golang-swagger -a codex`. Or copy the skill folder (.agents/skills/golang-swagger in context-labs/whip) into .agents/skills/golang-swagger in your project. Codex loads it when a task matches its description.

Can I use Golang Swagger in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add context-labs/whip --skill golang-swagger -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/golang-swagger, .gemini/skills/golang-swagger, .github/skills/golang-swagger and .opencode/skills/golang-swagger in your project.

What does Golang Swagger need to run?

Going by SKILL.md and its folder, Golang Swagger needs the command-line tools its instructions call (go). Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(swag:*), AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*. Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness. Requires go and swag CLI..

Does Golang Swagger access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Golang Swagger safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Golang Swagger use?

Golang Swagger is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Golang Swagger use?

About 2.3k tokens (SKILL.md is roughly 9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.2k tokens, read only when the agent opens those files.

What are the alternatives to Golang Swagger?

Skills that share tags, products or a category with Golang Swagger: B24phpsdk Maintainer (bitrix24/b24phpsdk, 102 stars), Distilled SDK (alchemy-run/distilled, 432 stars), Arandu Shared Modules Guide (arandu-io/arandu, 281 stars) and Counterfact Repo Basics (counterfact/api-simulator, 170 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Golang Swagger?

context-labs (a GitHub organization) maintains it in context-labs/whip, which has 1,083 GitHub stars. The repository holds 40 skills in this directory. The repository was last updated on October 5, 2026.

Source: context-labs/whip on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.