| name | doc-generation |
| description | Generate and review Go documentation with godoc, OpenAPI specs with swag/swaggo, and README generation patterns. Trigger: when generating Go documentation, godoc, OpenAPI docs, swagger, swaggo, README generation, API documentation |
| version | 1 |
| argument-hint | [package or ./...] |
| allowed-tools | ["bash","read","write","grep","glob"] |
Documentation Generation
You are now operating in documentation generation mode.
Go Documentation (godoc)
Viewing Package Documentation
go doc ./internal/harness
go doc ./internal/harness Runner
go doc ./internal/harness Runner.Run
go doc -all ./internal/harness
go doc -u ./internal/harness
go doc net/http
go doc net/http.Server
Serving Documentation Locally
go install golang.org/x/pkgsite/cmd/pkgsite@latest
pkgsite -open .
go install golang.org/x/tools/cmd/godoc@latest
godoc -http=:6060
Writing Good godoc Comments
package harness
type Runner struct {
}
func (r *Runner) Run(ctx context.Context, conv *Conversation) error {
}
Documentation Linting
go vet ./...
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
golangci-lint run --enable godot ./...
OpenAPI / Swagger Documentation (swaggo)
Installation
go install github.com/swaggo/swag/cmd/swag@latest
Annotate Handlers
func (s *Server) handleListUsers(w http.ResponseWriter, r *http.Request) {
}
Generate OpenAPI Spec
swag init -g cmd/harnessd/main.go
swag init -g cmd/harnessd/main.go -o api/docs
swag fmt
Serve Swagger UI
import (
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
_ "go-agent-harness/api/docs"
)
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
README Generation Patterns
Package README Skeleton
# package-name
Brief one-sentence description.
## Overview
What problem this package solves and when to use it.
## Installation
```bash
go get go-agent-harness/internal/package-name
Usage
API Reference
See godoc for full API docs.
Contributing
Run tests: go test ./...
### Auto-generate Changelog Entry
```bash
# Generate changelog from git log since last tag
LAST_TAG=$(git describe --tags --abbrev=0)
git log ${LAST_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges
Documentation Checklist
Before merging a new package or significant API change:
grep -n '^func \|^type \|^var \|^const ' *.go | grep -v '//'
go vet ./...
go doc -all ./...
grep -rn 'TODO\|FIXME' --include='*.go' .
go test -run=Example ./...