askill
go-api-docs

go-api-docsSafety 95Repository

API documentation with OpenAPI/Swagger generated from code annotations, plus service-level README conventions. Trigger: When documenting API endpoints, generating Swagger specs, or writing service documentation.

0 stars
1.2k downloads
Updated 2/9/2026

Package Files

Loading files...
SKILL.md

When to Use

  • Documenting HTTP API endpoints
  • Generating OpenAPI/Swagger specs
  • Writing service README files
  • Documenting gRPC services (protobuf is self-documenting)

Critical Patterns

PatternRule
Swagger from annotationsUse swaggo/swag to generate OpenAPI from Go comments
Spec lives with serviceEach service generates its own docs/swagger.json
Proto is self-documentinggRPC services use protobuf comments as docs
README per serviceEach service has a README with setup, architecture, API summary
Keep specs in syncRegenerate on every API change — add to CI

Swagger Annotations (swaggo/swag)

See assets/swagger_main.go

See assets/swagger_handler.go

Serve Swagger UI

See assets/swagger_ui.go

Protobuf Documentation

Protobuf files are self-documenting. Use comments:

See assets/caregiver.proto

Service README Template

See assets/README_TEMPLATE.md

Commands

# Install swag CLI
go install github.com/swaggo/swag/cmd/swag@latest

# Generate docs
swag init -g cmd/server/main.go -o docs

# Dependencies
go get github.com/swaggo/gin-swagger
go get github.com/swaggo/files
go get github.com/swaggo/swag

# View docs
open http://localhost:8080/swagger/index.html

# Makefile target
.PHONY: swagger
swagger:
	swag init -g cmd/server/main.go -o docs

Anti-Patterns

Don'tDo
Manually write OpenAPI YAMLGenerate from code annotations
Swagger in productionDisable Swagger UI in production
Outdated READMERegenerate swagger on API changes, keep README current
No docs for eventsDocument published/consumed events in README
Undocumented protobufAdd comments to every service, rpc, and message

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

75/100Analyzed 2/20/2026

Solid technical skill for Go API documentation with clear structure, commands, and patterns. Includes When to Use section, critical patterns table, command examples, and anti-patterns. Deducted points for empty asset file references that should contain example code. Generic and reusable across projects.

95
80
80
65
75

Metadata

Licenseunknown
Version-
Updated2/9/2026
Publisher333-333-333

Tags

apici-cdgithub