Sets up GitHub Actions CI for Go projects: build, vet/lint with golangci-lint, test with race detector and coverage gates, vulnerability scanning with govulncheck, CodeQL, gosec, Dependabot, action pinning, build matrices, and Makefile targets.
Ships in go-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A Go pipeline has exactly four gates: build, vet/lint, test with race detector, vulnerability scan. Everything else is optimization.
Detailed reference material, loaded on demand:
references/security-and-automation.md — CodeQL and gosec SARIF,
Dependabot config, SHA pinning, repository hardening, Trivy, an AI
review workflow.Read a reference file only when the summary below is not enough.
name: ci
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
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@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v9 # v7+ runs golangci-lint v2
with:
version: v2.6 # pin a minor; v2.6+ has `modernize`
vuln:
runs-on: ubuntu-latest
steps:
- uses: golang/govulncheck-action@v1
with:
go-version-file: go.mod
Action major versions move several times a year. Treat the ones above as
a snapshot, and let Dependabot's github-actions ecosystem keep them
current rather than editing them by hand.
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.Commit a .golangci.yml; an unconfigured linter is noise:
version: "2" # required: golangci-lint v2 rejects v1 files
linters:
default: standard # errcheck, govet, ineffassign, staticcheck, unused
enable:
- errorlint # %w misuse, == on errors
- gosec # security patterns
- revive # style, replaces golint
- misspell
exclusions:
rules:
- path: _test\.go
linters: [gosec] # test code may use weak randomness etc.
golangci-lint v2 moved exclusions from issues.exclude-rules to
linters.exclusions.rules and made the version key mandatory. A v1 file
fails to load, and golangci-lint migrate converts one in place.
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.
strategy:
matrix:
go: [oldstable, stable] # the two releases the Go team supports
os: [ubuntu-latest, macos-latest, windows-latest]
Libraries: test the two supported Go releases. setup-go resolves
stable/oldstable at run time, so the matrix never goes stale.
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.
- 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.
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 tool govulncheck ./... # pinned via `go get -tool` (Go 1.24+)
ci: build lint test vuln
If CI does anything make ci doesn't, developers discover failures
only after pushing. Keep them identical.
go test ./... already parallelizes across packages; don't shard a
small repo.go test -tags=integration ./....go.sum is the
cache key input (setup-go does this) and that jobs don't mutate it.Beyond govulncheck: CodeQL (security-extended) and gosec as SARIF
uploads to the Security tab, and Trivy on any container image you build.
Start gosec with -no-fail to collect a baseline, then make new findings
fail the PR.
gomod and github-actions, weekly, with minor and
patch updates grouped into one PR. Majors stay separate — they need a
changelog read.pull_request_target workflow that checks out and runs fork code
with secrets available.Snippets for sections 7-9: references/security-and-automation.md.
Tag-triggered releases — GoReleaser, signing, SBOMs, provenance — are
owned by the go-build-release skill.
go-version-file), not duplicatedpermissions: contents: read set at workflow level-race -shuffle=on.golangci.yml committed with a curated linter setnolint carries a linter name and a reasonmake ci reproduces the pipeline locally, byte-for-byteWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
35 skills in this plugin
/git-commitStructured git commit messages following Conventional Commits format for Go projects. Generates well-scoped, atomic commits with clear descriptions. Use when committing changes, writing commit messages, preparing PRs, or reviewing commit history quality. Trigger examples: "commit these changes", "create commit", "commit message", "prepare PR", "squash commits". Not for: code review (go-code-review), changelog generation.
/go-api-designHTTP/REST API design for Go services: handlers, ServeMux routing, middleware, request validation, pagination, idempotency, health checks, error responses, and graceful shutdown. Use when designing APIs, writing HTTP handlers, implementing middleware, or structuring REST endpoints. Trigger examples: "design API", "REST endpoints", "HTTP handler", "middleware pattern", "graceful shutdown", "API versioning". Not for: gRPC services (go-grpc), spec-first OpenAPI work (go-openapi), general architecture (go-architecture-review), concurrency in handlers (go-concurrency-review).
/go-architecture-reviewReview Go project architecture: package structure, dependency direction, layering, separation of concerns, domain modeling, and module boundaries. Use when reviewing architecture, designing package layout, evaluating dependency graphs, or refactoring monoliths into modules. Trigger examples: "review architecture", "package structure", "project layout", "dependency direction", "clean architecture Go", "module boundaries". Not for: code-level style (go-coding-standards), endpoint design (go-api-design).
/go-binary-sizeReduce the size of compiled Go binaries and container images: linker flags, inlining budget, CGO and build tags, embedded assets, dependency weight, and measuring what actually costs bytes. Use when a binary or image is too large, when shrinking a CLI for distribution, or when auditing what a dependency adds to the build. Trigger examples: "binary is too big", "shrink the binary", "reduce image size", "strip symbols", "what is making my binary large", "ldflags -s -w". Not for: runtime speed and allocations (go-performance-review), CI setup (go-ci), release pipelines and signing (go-build-release), dependency CVEs (go-dependency-audit).
/go-build-releaseBuild and release Go binaries that are reproducible and verifiable: version stamping, -trimpath builds, cross-compilation, GoReleaser, checksums, SBOMs, cosign signing, build provenance attestations, and container images with ko or a multi-stage Dockerfile. Use when: "release a Go binary", "set up GoReleaser", "cross-compile", "reproducible build", "sign the release", "generate an SBOM", "build provenance", "publish a container image", "version command shows (devel)". Not for: test and lint pipelines (go-ci), shrinking the binary or image (go-binary-size), auditing dependencies (go-dependency-audit).
/go-cliBuild command-line tools in Go: flag handling, subcommands, stdin/stdout discipline, exit codes, signal handling, and when Cobra/Viper earn their weight over the standard library. Use when: "build a CLI", "add a subcommand", "parse flags", "exit codes", "handle Ctrl+C", "cobra command", "read from stdin", "CLI UX". Not for: HTTP APIs (go-api-design), scaffolding (go-project-layout), service configuration (go-architecture-review).
/go-agent-skills:go-cifrom go-agent-skills
npx claudepluginhub eduardo-sl/go-agent-skills --plugin go-agent-skillsOther plugins' skills for the same job