go-ci
Skill85 starsChanged 18 days agoMITView on GitHub
Continuous integration for Go projects: GitHub Actions pipelines, caching, golangci-lint setup, test/coverage gates, vulnerability scanning, SAST (CodeQL, gosec), Dependabot, action pinning, build matrices, Makefile targets. Use when: "set up CI", "GitHub Actions for Go", "add lint to the pipeline", "CI is slow", "coverage gate", "build matrix", "write a Makefile", "run govulncheck in CI". Not for: commit conventions (git-commit), choosing or auditing dependencies (go-dependency-audit), writing the tests themselves (go-test-quality), releases and signing (go-build-release).
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Read a reference file only when the summary below is not enough.
- Very specific: line 95
Commit a .golangci.yml; an unconfigured linter is noise:
- Very specific: line 117
Start from this small set and add linters deliberately.
- Very specific: line 173
If CI does anything make ci doesn't, developers discover failures only after pushing.
- Very specific: line 183
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.
- Very specific: line 190
Start gosec with -no-fail to collect a baseline, then make new findings fail the PR.
- Very specific: line 221
Every nolint carries a linter name and a reason
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go CI
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.
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@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.modAction 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: trueon setup-go handles module and build caches; do not add manualactions/cachesteps 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:
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.
3. Build Matrix — Only When You Ship It
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.
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 tool govulncheck ./... # pinned via `go get -tool` (Go 1.24+)
ci: build lint test vulnIf 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.sumis the cache key input (setup-go does this) and that jobs don't mutate it.
7. Security Gates
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.
8. Dependency Updates and Action Pinning
- Dependabot for both
gomodandgithub-actions, weekly, with minor and patch updates grouped into one PR. Majors stay separate — they need a changelog read. - Pin third-party actions by commit SHA with the version in a comment; a tag can be moved to malicious code, and Dependabot updates SHA pins.
9. Workflow and Repository Hardening
- Per-job permissions on top of a read-only default.
- No
pull_request_targetworkflow that checks out and runs fork code with secrets available. - Branch protection: required checks, a review, no force pushes.
- An AI reviewer loaded with the go-code-review skill is an extra reviewer, never a check that can approve on its own.
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.
Verification Checklist
- Pipeline has all four gates: build, vet+lint, test -race, govulncheck
- Go version sourced from go.mod (
go-version-file), not duplicated permissions: contents: readset at workflow level- Tests run with
-race -shuffle=on .golangci.ymlcommitted with a curated linter set- Every
nolintcarries a linter name and a reason - Matrix limited to versions/platforms actually supported
- Coverage floor enforced, generated code excluded
make cireproduces the pipeline locally, byte-for-byte- Integration tests isolated behind tags, not slowing every push
- CodeQL/gosec results uploaded as SARIF; images scanned before push
- Dependabot covers modules and actions; third-party actions pinned by SHA
- Per-job permissions; no fork code run with secrets
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/go-skills.mdcCursor rule
- go-api-designSkill
- go-architecture-reviewSkill
- go-cliSkill
- go-dependency-injectionSkill
- go-design-patternsSkill
- go-graphqlSkill
- go-grpcSkill
- go-interface-designSkill
- go-openapiSkill
- go-project-layoutSkill
- go-code-reviewSkill
- go-coding-standardsSkill
- go-contextSkill
- go-data-structuresSkill
- go-documentationSkill
- go-error-handlingSkill
- go-modernizeSkill
- go-namingSkill
- go-databaseSkill
- go-concurrency-reviewSkill
- go-defensive-codingSkill
- go-observabilitySkill
- go-performance-reviewSkill
- go-security-auditSkill
- go-troubleshootingSkill
- go-test-qualitySkill
- go-test-table-drivenSkill
- git-commitSkill
- go-binary-sizeSkill
- go-build-releaseSkill
- go-dependency-auditSkill
- go-refactoringSkill
- go-semantic-toolsSkill
- go-skills-routerSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

