Help us improve
Share bugs, ideas, or general feedback.
From go-backend
Go バックエンドの品質チェック(golangci-lint + Swagger 生成)。「lint」「golangci-lint」「静的解析」「swagger」「OpenAPI」「ドキュメント生成」などのキーワードで自動適用。
npx claudepluginhub no-problem-dev/claude-code-plugins --plugin go-backendHow this skill is triggered — by the user, by Claude, or both
Slash command
/go-backend:go-qualityThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Go バックエンドの静的解析と API ドキュメント生成。
Generates and maintains Swagger/OpenAPI docs for Go projects using swaggo/swag — annotation comments, code generation, framework integrations, and security definitions.
Manages Go tool dependencies using the tool directive (Go 1.24+). Detects codegen tools like sqlc, templ, buf, swag via indicator files and adds them to go.mod for reproducible builds.
Applies Go best practices for performance, modern syntax, generics, patterns, testing, error handling, and concurrency when writing or reviewing Go code.
Share bugs, ideas, or general feedback.
Go バックエンドの静的解析と API ドキュメント生成。
以下の優先順位で Go プロジェクトを検出:
GO_BACKEND_DIR(go.mod の存在を確認)go.modbackend/, server/, api/, go/)cd <backend_dir>
# golangci-lint の存在確認
command -v golangci-lint || {
echo "golangci-lint がインストールされていません"
echo "インストール: brew install golangci-lint"
echo "または: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"
}
# Lint 実行
golangci-lint run ./...
プロジェクトルートに .golangci.yml を配置してカスタマイズ可能:
linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
linters-settings:
errcheck:
check-type-assertions: true
cd <backend_dir>
# swag の存在確認(未インストール時は自動インストール)
command -v swag || [[ -f "$HOME/go/bin/swag" ]] || {
echo "swag をインストール中..."
go install github.com/swaggo/swag/cmd/swag@latest
}
# swag コマンドパス
SWAG_CMD=$(command -v swag 2>/dev/null || echo "$HOME/go/bin/swag")
# main.go の検出(GO_MAIN_PATH > cmd/server/main.go > cmd/api/main.go > main.go)
MAIN_PATH="${GO_MAIN_PATH:-}"
if [[ -z "$MAIN_PATH" ]]; then
for p in cmd/server/main.go cmd/api/main.go cmd/main.go main.go; do
[[ -f "$p" ]] && MAIN_PATH="$p" && break
done
fi
# Swagger 生成
$SWAG_CMD init -g "$MAIN_PATH" -o docs --parseDependency --parseInternal
生成されるファイル:
docs/docs.go — Go コードdocs/swagger.json — JSON 仕様docs/swagger.yaml — YAML 仕様golangci-lint: command not found
対処:
brew install golangci-lint
# または
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
swag: command not found
対処:
go install github.com/swaggo/swag/cmd/swag@latest