From go-backend
Go バックエンドの品質チェック(golangci-lint + Swagger 生成)。「lint」「golangci-lint」「静的解析」「swagger」「OpenAPI」「ドキュメント生成」などのキーワードで自動適用。
npx claudepluginhub no-problem-dev/claude-code-plugins --plugin go-backendThis skill uses the workspace's default tool permissions.
Go バックエンドの静的解析と API ドキュメント生成。
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Builds DCF models with sensitivity analysis, Monte Carlo simulations, and scenario planning for investment valuation and risk assessment.
Calculates profitability (ROE, margins), liquidity (current ratio), leverage, efficiency, and valuation (P/E, EV/EBITDA) ratios from financial statements in CSV, JSON, text, or Excel for investment analysis.
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