/go:go-developmentfrom go
Use when you write or change Go (.go), go.mod, .golangci.yml or .goreleaser.yaml: a feature, fix, refactor or review, even a small one and even when conventions are not mentioned. House rules: errors, context, slog, os/exec, process groups.
Ships in go. 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.
Baseline: the Google Go Style Guide (guide, decisions, best practices); the rules below add to it or settle what it leaves open, and the lint template enforces it wherever a linter can.
The floor is the oldest supported Go release (two are supported at a time; 1.26 while 1.27 is current). Libraries declare the lowest go version whose features they use, never above that floor. Binaries we ship track the latest release: go 1.27.0 plus toolchain go1.27.x, so GOTOOLCHAIN=auto and actions/setup-go with go-version-file: go.mod build with the same compiler everywhere. Bump both with go get [email protected] [email protected].
go tool: go get -tool golang.org/x/vuln/cmd/govulncheck, then go tool govulncheck ./.... The host needs only go (and goreleaser for local snapshots). No go install of tools, no tools.go. go tool executables are cached in the Go build cache (Go 1.24+), so every worktree shares one build per toolchain and no make target installs a tool into the worktree (host-hygiene, Shared stores).golangci-lint.mod). This is a deliberate deviation: upstream recommends its prebuilt binary and does not recommend go tool, but documents this isolated modfile for those who use it anyway. We accept a locally built binary for one pin per repo and no host install; never let its dependencies mix with yours or update them by hand: go get -tool -modfile=golangci-lint.mod github.com/golangci/golangci-lint/v2/cmd/[email protected]. It is the only linter and formatter entry point: govet, staticcheck (which absorbed gosimple and stylecheck in v2), gofumpt and gci all run inside it.ALL: linters.default: all, then disable a linter only with the reason inline. Start from references/golangci.yml: its revive rules carry Google's naming, doc-comment, import and error-string decisions. Silence one finding with //nolint:<linter> // reason; nolintlint rejects a bare one.help, fmt, lint, vuln, test, check (= lint + test), build. lint runs golangci-lint once per target GOOS, because files behind //go:build windows are invisible to a Linux or macOS run. vuln needs the network, so it runs in CI as its own job, not inside check.go fix ./... (the modernizers since 1.26) runs in make fmt: it rewrites code to current idioms (for range n, min/max, slices, strings.Cut, wg.Go). Accept its diff; the modernize linter flags what it would change.Read references/PROJECT_SETUP.md when scaffolding: layout, go.mod, the tool modfile, the Makefile, CI and Dependabot (the pipeline itself: ci-cd; on GitHub, github-actions).
cmd/<name>/main.go is thin; everything else is under internal/, which the compiler keeps private.pkg/. A library module puts its public API in the root package and its helpers in internal/; an application has no public packages at all.supervise, runstate, billing), not by technical layer (handlers/, models/, services/): a change to one feature stays in one package. Never util, common, helpers, types (revive package-naming rejects them and a top-level pkg/).var other than sentinel errors and immutable values a Must function builds at startup (regexp.MustCompile), no init(), no flag.CommandLine (test-only flags like -update excepted), no slog.SetDefault outside main. main builds the dependencies and calls run(ctx, args, getenv, stdout, stderr) error, which tests call directly. Configuration is flags on a flag.FlagSet with env fallbacks read through the injected getenv.*Factory, a registry or a new package tree.*Factory, *Manager, *Helper, Abstract*, Base* unless the type really is that pattern. A New function is the factory.dupl, and goconst at three uses, flag it).Config, passed by value or pointer, zero value means defaults) when most callers set something; variadic functional options (...Option) only when most callers set nothing and the options may grow. Never both on one constructor.iter.Seq helpers, typed wrappers), not hypothetical future types. Generic methods (1.27) cannot satisfy interface methods.slices, maps, iter (return iter.Seq/iter.Seq2 for streams instead of callbacks or full slices), log/slog, uuid (1.27), encoding/json/v2 in modules on 1.27 (strict UTF-8, no duplicate names, omitzero), os.Root for every path that comes from outside, errors.AsType (1.26).http.Client always has a Timeout or a per-request deadline, every request takes a context, and every body is closed (noctx, bodyclose enforce it). Never http.DefaultClient.fmt.Errorf("load run %s: %w", id, err), lowercase, no "failed to". Add what the callee's error lacks, never repeat it: *os.PathError already names the path, *url.Error the method and URL. %v deliberately cuts the chain.var ErrNotFound = errors.New(...)) when callers branch on the condition; typed (*ExitError) when they need data from it, always returned and matched as a pointer; match with errors.Is and errors.AsType[*T], never == or a type assertion (errorlint).errors.Join for several failures (cleanup after a failed operation, closing many resources).MustX functions only for startup-time constants and test helpers, never on input.ctx context.Context is the first parameter of anything that blocks or does I/O; never stored in a struct. Use context.WithTimeoutCause/WithCancelCause so context.Cause says why; context.WithoutCancel for work that must finish after the request ends (a final state write, telemetry flush); context.AfterFunc instead of a goroutine waiting on ctx.Done().log/slog with a JSON handler for daemons, built in main and passed down. Attributes only (slog.String, LogAttrs), constant messages, snake_case keys (sloglint enforces it). Secrets implement slog.LogValuer and redact themselves. OpenTelemetry providers are built in main and shut down with a WithoutCancel context and a timeout.errgroup.WithContext when goroutines can fail, with SetLimit(n) for a bounded pool; sync.WaitGroup.Go when they cannot. Every blocking send or receive selects on ctx.Done(). The sender closes a channel, never the receiver.Read references/PATTERNS.md for the main/run skeleton, error types, worker pool, graceful shutdown, iter.Seq, os.Root atomic writes and HTTP client code.
os/exec code that outlives a single short command.CGO_ENABLED=0 go build -trimpath, set per command, never exported globally (the race detector needs cgo on Linux and Windows). The version comes from the git tag that go build stamps since 1.24 (debug.ReadBuildInfo().Main.Version), not -ldflags -X into a global.GOFLAGS=-trimpath for every command, so worktrees share the build cache. Without it, the cache key of a package built from a local directory (the main module, a replace to a path) includes that absolute directory, so the same sources in two worktrees are compiled and stored twice; with it, the directory leaves the key. -trimpath is itself part of the key, so builds with and without it never share entries: set it once, in the Makefile (export GOFLAGS := -trimpath $(GOFLAGS)) and in the CI workflow's env, not on single commands. File paths in stack traces and debug info become module paths, so a debugger needs a source-path mapping (delve's substitute-path).-race, -cover, CGO_ENABLED and GOOS/GOARCH variant is its own set of cache entries. On a shared host run the narrow loop locally (go test ./internal/foo/..., make lint LINT_GOOS=$(go env GOOS)) and leave the race, cover and per-GOOS matrix to CI, which runs make check on every PR. Cache budget and cleanup: the host-hygiene skill.releases): release-please owns the version, tag and notes; goreleaser builds, archives, checksums, SBOMs and the Homebrew cask from that tag, and the workflow attests the artifacts. Read references/RELEASE.md when setting it up.Google rules the template cannot enforce, so a reviewer checks them: no Get prefix on accessors (Counts, not GetCounts; HTTP Get is fine); names do not repeat the package (widget.New, not widget.NewWidget when the package has one type) or carry their type (users, not usersMap); name length grows with scope; %q for strings in messages; an API does not tell a nil slice from an empty one; synchronous functions, with the caller adding concurrency; doc comments say what a caller needs (cancellation, concurrency safety, who closes what), not how.
GOOS=windows go tool golangci-lint run builds the linter itself for Windows and fails with exec format error. Resolve the host binary once with go tool -n and set GOOS only on that (the Makefile in PROJECT_SETUP.md does).go line above the installed toolchain makes GOTOOLCHAIN=auto download a toolchain; a repackaged Go with GOTOOLCHAIN=local refuses to build instead. Read the error, then upgrade the host Go rather than lowering the go line.go mod tidy -diff (in lint) fails on an untidy module without touching files; make fmt tidies.go vet flags fmt.Errorf("%w", p) when p is *E and E (not *E) implements error: give the Error method one receiver kind and use it everywhere.encoding/json in 1.27 is backed by v2 even in v1 code; error texts changed. Never match on JSON error strings.setup-envtest use --bin-dir <a dir in the worktree> puts hundreds of MB of read-only binaries in every worktree: drop --bin-dir (host-hygiene, Shared stores).What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub giocaizzi/harness --plugin go