MCP HubMCP Hub
SKILL·FDE4BF

go-ci

eduardo-sl
更新日 27 days ago
5 閲覧
69
9
69
GitHubで表示
メタtestingdesign

について

このClaudeスキルは、開発者がGitHub Actionsを使用してGoプロジェクトの継続的インテグレーションパイプラインを設定・最適化するのを支援します。キャッシュ設定、golangci-lint、テストカバレッジゲート、govulncheckによる脆弱性スキャン、ビルドマトリックス、Makefileターゲットの構成を提供します。テスト作成、コミット規約、依存関係監査ではなく、CIワークフローの実装や改善が必要な場合にご利用ください。

クイックインストール

Claude Code

推奨
メイン
npx skills add eduardo-sl/go-agent-skills -a claude-code
プラグインコマンド代替
/plugin add https://github.com/eduardo-sl/go-agent-skills
Git クローン代替
git clone https://github.com/eduardo-sl/go-agent-skills.git ~/.claude/skills/go-ci

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Go CI

A Go pipeline has exactly four gates: build, vet/lint, test with race detector, vulnerability scan. Everything else is optimization.

1. Baseline GitHub Actions Workflow

name: ci
on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod   # single source of truth
          cache: true               # caches module + build cache
      - run: go build ./...
      - run: go vet ./...
      - run: go test -race -shuffle=on -coverprofile=coverage.out ./...

  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - uses: golangci/golangci-lint-action@v6
        with:
          version: latest

  vuln:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...

Key decisions baked in:

  • go-version-file: go.mod — never hardcode the Go version in two places.
  • cache: true on setup-go handles module and build caches; do not add manual actions/cache steps for Go on top of it.
  • -race -shuffle=on — races and order-dependent tests fail in CI, not production.
  • permissions: contents: read — least privilege by default.
  • Lint in a separate job — it fails fast and parallelizes with tests.

2. golangci-lint Configuration

Commit a .golangci.yml; an unconfigured linter is noise:

linters:
  enable:
    - errcheck      # unchecked errors
    - govet
    - staticcheck
    - errorlint     # %w misuse, == on errors
    - gosec         # security patterns
    - revive        # style, replaces golint
    - misspell
issues:
  exclude-rules:
    - path: _test\.go
      linters: [gosec]  # test code may use weak randomness etc.

Start from this small set and add linters deliberately. Enabling everything produces hundreds of findings nobody triages. nolint directives require a reason: //nolint:gosec // G404: jitter, not crypto.

3. Build Matrix — Only When You Ship It

strategy:
  matrix:
    go: ['1.23', '1.24']         # only versions you support
    os: [ubuntu-latest, macos-latest, windows-latest]

Libraries: test the two newest Go versions (the Go team supports two). Services deployed on Linux: skip the OS matrix — it doubles cost for platforms you never ship. Cross-compilation is cheaper than emulation: GOOS=windows go build ./... catches most portability breaks.

4. Coverage Gate

- run: go test -race -coverprofile=coverage.out ./...
- name: enforce coverage floor
  run: |
    total=$(go tool cover -func=coverage.out | awk '/^total:/ {sub(/%/,"",$3); print $3}')
    echo "coverage: ${total}%"
    awk -v t="$total" 'BEGIN { exit (t < 70.0) }'

Gate on a floor that ratchets up, not a target that gets gamed. Exclude generated code via //go:generated files' build tags or grep filters, not by lowering the floor.

5. Makefile — Local Mirror of CI

CI must run what developers run. One definition, two callers:

.PHONY: build lint test vuln ci

build:
	go build ./...

lint:
	golangci-lint run

test:
	go test -race -shuffle=on -coverprofile=coverage.out ./...

vuln:
	go run golang.org/x/vuln/cmd/govulncheck@latest ./...

ci: build lint test vuln

If CI does anything make ci doesn't, developers discover failures only after pushing. Keep them identical.

6. Speed Rules

  • Split lint / test / vuln into parallel jobs (as in §1).
  • go test ./... already parallelizes across packages; don't shard a small repo.
  • Integration tests behind a build tag run in a separate job or on a schedule, not on every push: go test -tags=integration ./....
  • If the build cache misses constantly, check that go.sum is the cache key input (setup-go does this) and that jobs don't mutate it.

Verification Checklist

  1. Pipeline has all four gates: build, vet+lint, test -race, govulncheck
  2. Go version sourced from go.mod (go-version-file), not duplicated
  3. permissions: contents: read set at workflow level
  4. Tests run with -race -shuffle=on
  5. .golangci.yml committed with a curated linter set
  6. Every nolint carries a linter name and a reason
  7. Matrix limited to versions/platforms actually supported
  8. Coverage floor enforced, generated code excluded
  9. make ci reproduces the pipeline locally, byte-for-byte
  10. Integration tests isolated behind tags, not slowing every push

GitHub リポジトリ

eduardo-sl/go-agent-skills
パス: skills/(workflow)/go-ci
0
FAQ

よくある質問

go-ci Skillとは何ですか?

go-ci はeduardo-sl が作成した Claude Skillです。Skillは、Claudeが必要に応じて読み込む指示とリソースをまとめ、追加の指示なしで go-ci に関連するタスクを実行できるようにします。

go-ci をインストールするには?

このページのインストールコマンドを使用してください。go-ci をプラグインとして Claude Code に追加するか、リポジトリを skills ディレクトリにクローンし、Claudeを再起動してSkillを読み込みます。

go-ci はどのカテゴリに属しますか?

go-ci は メタ カテゴリに属します。

go-ci は無料で利用できますか?

はい。go-ci は AIMCP に掲載されており、無料でインストールできます。

関連スキル

content-collections
メタ

このスキルは、Content Collections(Markdown/MDXファイルを型安全なデータコレクションに変換するTypeScriptファーストのツール)の本番環境でテストされた設定を提供します。Zodバリデーションによる型安全性を実現し、ブログ、ドキュメントサイト、コンテンツ重視のVite + Reactアプリケーション構築時にご利用ください。Viteプラグインの設定、MDXコンパイルから、デプロイ最適化、スキーマバリデーションまで、すべてを網羅しています。

スキルを見る
polymarket
メタ

このスキルは、開発者がPolymarket予測市場プラットフォームを活用したアプリケーション構築を可能にします。API統合による取引や市場データの取得に加え、WebSocketを介したリアルタイムデータストリーミングにより、ライブ取引や市場活動を監視できます。取引戦略の実装や、ライブ市場更新を処理するツールの作成にご利用ください。

スキルを見る
creating-opencode-plugins
メタ

このスキルは、開発者がコマンド、ファイル、LSP操作など25種類以上のイベントタイプにフックするOpenCodeプラグインを作成することを支援します。JavaScript/TypeScriptモジュール向けに、プラグイン構造、イベントAPI仕様、および実装パターンを提供します。カスタムイベント駆動ロジックでOpenCode AIアシスタントのライフサイクルをインターセプト、監視、または拡張する必要がある場合にご利用ください。

スキルを見る
sglang
メタ

SGLangは、高性能なLLMサービングフレームワークであり、RadixAttentionプレフィックスキャッシュを活用したJSON、正規表現、エージェントワークフロー向けの高速で構造化された生成を特長とします。特にプレフィックスが繰り返されるタスクにおいて、大幅に高速な推論を実現し、複雑な構造化出力やマルチターン対話に最適です。制約付きデコードが必要な場合や、広範なプレフィックス共有を伴うアプリケーションを構築する場合は、vLLMなどの代替案ではなくSGLangを選択してください。

スキルを見る