agentsclimarketplace

Go dev

Skill pszypowicz/claude-skills/plugins/go-dev/skills/go-dev

A small Claude Code marketplace: ado, swift-concurrency, modern-swift, go-dev, worktrees.

Install
npx -y skills add pszypowicz/claude-skills --skill go-dev

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Go development with toolchain-first verification workflow. Use whenever the user (1) writes, modifies, debugs, or reviews Go code, (2) works with go.mod, go.sum, or Go module dependencies, (3) writes or runs Go tests, benchmarks, or fuzz tests, (4) mentions go doc, go vet, go fix, go test, go build, go mod, gofmt, staticcheck, golangci-lint, govulncheck, or pprof, (5) asks about Go error handling (errors.Is/As/AsType/Join), concurrency (goroutines, channels, sync, context), interfaces, or package design, (6) encounters Go compiler errors, test failures, or race conditions, (7) profiles Go code for performance or works with PGO, (8) asks about Go best practices, code review, or idiomatic Go, (9) works with files ending in .go or _test.go, (10) wants to modernize Go code to 1.21-1.26 features. Trigger this skill proactively when the user is working in a Go codebase even if they do not explicitly ask for Go help - the toolchain-first workflow (verify APIs with go doc before coding, run go vet after) catches bugs that hallucinated signatures and skipped static analysis miss. Do NOT trigger for pure educational or comparative content about Go that does not involve writing or debugging code (e.g. tutorials for blog posts, Java vs Go decision documents, explanations of the Go scheduler for learning purposes).

SKILL.md

21.8 KB, ~4.4k tokens by cl100k_base, as published. Nobody here has run it

Go Development

Session Init

At the start of any Go session, detect the project's Go version:

  1. Read go.mod and extract the go directive (e.g., go 1.26)
  2. This version controls which language features and stdlib APIs are available
  3. If you are about to suggest a feature gated behind a newer version, stop and note the incompatibility

Version Feature Table

VersionKey additions
1.21log/slog, slices, maps, min/max/clear builtins, context.AfterFunc, context.WithoutCancel, sync.OnceFunc/OnceValue, PGO auto
1.22for i := range n, math/rand/v2, enhanced http.ServeMux routing (method+pattern), loopvar semantic change
1.23iter.Seq/iter.Seq2, range-over-func, unique.Handle, structs.HostLayout
1.24testing.T.Context, testing.T.Chdir, os.Root, generic type aliases, go tool runs module tools, testing/synctest, omitzero JSON tag
1.25sync.WaitGroup.Go, testing.T.Attr, testing.T.Output, sync.Map range-over-func, os.OpenRoot
1.26errors.AsType[T], testing.T.ArtifactDir, go test -artifacts, go fix command (21 fixers), new vet analyzers (waitgroup, hostport), new(expr) shorthand

Toolchain-First Workflow

This is the core of this skill. Go ships a powerful toolchain - use it instead of guessing.

Before Writing Code

When about to use a stdlib or third-party API you are not certain about, verify the signature first:

go doc <package>.<Symbol>          # exact function/type/method
go doc -all <package>.<Type>       # full type with all methods
go doc -src <package>.<Symbol>     # source code when implementation matters

Token efficiency matters: go doc fmt.Fprintf returns 5 lines. go doc fmt returns hundreds. Always use the most specific query that answers your question.

For third-party packages, they must be importable (in go.mod) before go doc works. For stdlib, it always works.

After Writing or Modifying Code

Pick the verification level that matches the scope of the change:

Full - new files, unfamiliar APIs, concurrency code, public interface changes:

gofmt -d .                              # format check (should produce no output)
go vet ./...                            # static analysis
go build ./...                          # compilation check
go test -race -count=1 ./...            # tests with race detector, cache bypassed

Or use the bundled script: ${CLAUDE_SKILL_DIR}/scripts/go-quality-check.sh ./...

Standard - modifying existing code in patterns the project already uses:

go vet ./...
go test -count=1 -run TestRelevant ./path/to/pkg/...

Light - formatting, comments, documentation, renaming:

gofmt -d <changed-file>

When Modernizing Code

Go 1.26 introduced go fix, which applies automated improvements:

go fix -diff ./...     # preview changes as unified diff
go fix ./...           # apply all fixes

This replaces patterns like interface{} with any, sort.Slice with slices.Sort, manual wg.Add/Done with wg.Go, and many more. Always preview with -diff first.

When Debugging Test Failures

go test -v -run TestName -count=1 ./pkg/...    # verbose, cache-bypassed
go test -race -count=1 ./...                    # if concurrency is involved
go test -coverprofile=c.out ./... && go tool cover -func=c.out  # coverage gaps

When Adding Dependencies

  1. Prefer stdlib when the stdlib solution is adequate
  2. Run go doc on the candidate package to verify its API before committing to it
  3. go get <module>@latest && go mod tidy
  4. go mod why <module> to verify it is actually used

Tool Command Reference

go doc

PatternWhat it returns
go doc fmtPackage synopsis
go doc fmt.FprintfSpecific function signature and doc
go doc -all fmt.StringerFull type including all methods
go doc -src fmt.FprintfSource code of the function
go doc -short fmtOne-line per symbol
go doc -u net/http.TransportInclude unexported fields
go doc cmd/goGo command documentation

go vet analyzers (37 total)

AnalyzerWhat it catches
appendsMissing values after append
assignUseless assignments
atomicCommon sync/atomic mistakes
boolsBoolean operator mistakes
buildtagInvalid //go:build directives
compositesUnkeyed composite literals
copylocksLocks passed by value
defersCommon defer mistakes
errorsasWrong types passed to errors.As
hostportBad address format for net.Dial
httpresponseHTTP response handling mistakes
loopclosureLoop variable capture in nested functions
lostcancelContext cancel function not called
printfPrintf format string mismatches
shadowVariable shadowing (via -vettool)
slogInvalid structured logging calls
stdversionUses of too-new stdlib symbols
structtagMalformed struct tags
testsMistaken test/example/benchmark signatures
unmarshalNon-pointer passed to unmarshal
unusedresultUnused results from certain calls
waitgroupMisuses of sync.WaitGroup

(Run go tool vet help for the full list of all 37.)

go fix fixers (21 total, Go 1.26+)

FixerWhat it modernizes
anyinterface{} -> any
fmtappendf[]byte(fmt.Sprintf(...)) -> fmt.Appendf
forvarRemove redundant loop variable re-declarations
mapsloopExplicit map loops -> maps package calls
minmaxif/else chains -> min/max builtins
newexprSimplify with new(expr) (1.26)
omitzeroomitempty -> omitzero for struct fields
rangeint3-clause for -> for i := range n
slicescontainsLoop searches -> slices.Contains
slicessortsort.Slice -> slices.Sort
stringsbuilderString concatenation += -> strings.Builder
stringscutstrings.Index patterns -> strings.Cut
stringscutprefixHasPrefix/TrimPrefix -> CutPrefix
stringsseqSplit/Fields ranges -> SplitSeq/FieldsSeq iterators
testingcontextcontext.WithCancel in tests -> t.Context()
waitgroupwg.Add(1); go func() { defer wg.Done()... } -> wg.Go(f)

(Run go tool fix help for the full list.)

go test key flags

FlagPurpose
-raceEnable race detector
-count=1Bypass test cache
-run <regex>Run only matching tests
-vVerbose output
-shortSkip long-running tests (tests check testing.Short())
-shuffle=onRandomize test order
-failfastStop on first failure
-coverEnable coverage analysis
-coverprofile=fWrite coverage profile to file
-coverpkg=patternApply coverage to matching packages
-bench=<regex>Run matching benchmarks
-benchmemReport allocations in benchmarks
-benchtime=5sBenchmark duration
-fuzz=<regex>Run matching fuzz tests
-timeout=10mTest timeout (default 10m)
-cpuprofile=fWrite CPU profile
-memprofile=fWrite memory profile
-artifactsStore test artifacts in output directory (1.26+)

go build key flags

FlagPurpose
-raceEnable race detector
-pgo=autoProfile-guided optimization (auto uses default.pgo)
-gcflags='-m'Show escape analysis
-gcflags='-S'Show assembly output
-ldflags='-s -w'Strip debug info (smaller binary)
-ldflags='-X main.version=v1.0'Embed build-time values
-trimpathRemove filesystem paths from binary
-tags=<list>Build constraint tags
-o <file>Output file path

go mod subcommands

CommandPurpose
go mod tidySync go.mod/go.sum with imports
go mod downloadDownload modules to cache
go mod graphPrint module dependency graph
go mod vendorCreate vendored copy
go mod verifyVerify dependencies match go.sum
go mod why <mod>Explain why a module is needed
go mod edit -go=1.26Update go directive

gofmt flags

FlagPurpose
-dPrint diff (do not modify files)
-lList files with formatting differences
-sSimplify code
-wWrite changes to files

External tools

Check availability before use. These are not part of the Go toolchain:

ToolCheckPurpose
staticcheckwhich staticcheckExtended static analysis beyond go vet
golangci-lintwhich golangci-lintMeta-linter running 100+ linters
govulncheckwhich govulncheckScan dependencies for known vulnerabilities

If unavailable, go vet covers the most critical checks. Do not block on missing external tools.

Common Diagnostics

DiagnosticCauseFixReference
declared and not usedUnused variableRemove it or use it-
imported and not usedUnused importRemove import; use _ alias only during active development-
cannot use X as type YType mismatchRun go doc on both types; check interface satisfactionreferences/interfaces-and-design.md
data race detectedConcurrent unsynchronized accessUse mutex, channel, or atomic; see concurrency patternsreferences/concurrency.md
err is shadowed during return:= in inner scope shadows outer errUse = instead of := or rename inner variablereferences/error-handling.md
loop variable X captured by func literalPre-1.22 loop var captureGo 1.22+ fixes this; for older: copy variable before closure-
possible misuse of sync.WaitGroupAdd called inside goroutineCall Add before starting goroutine, not inside itreferences/concurrency.md
context.Background used in long-lived operationMissing context propagationAccept context.Context as first parameter; pass from callerreferences/concurrency.md
go directive in go.mod too oldgo.mod version < required featureRun go mod edit -go=<version> to updatereferences/modules-and-deps.md
Any ioutil.* usageDeprecated since Go 1.16ioutil.ReadAll -> io.ReadAll; ioutil.ReadFile -> os.ReadFile; etc.references/modern-go.md
HTTP handler decodes body without size limitDoS via unbounded request bodyWrap r.Body with http.MaxBytesReader(w, r.Body, maxBytes)references/security.md
http.Server{} without timeoutsVulnerable to slowloris attacksSet ReadTimeout, WriteTimeout, IdleTimeoutreferences/security.md

Proactive Behaviors

These are the rules for when to use tools without being asked:

  • Verify before asserting: run go doc <pkg>.<Symbol> before claiming any API signature you have not used in this session. This is the single most important behavior - wrong signatures waste the user's time.
  • Vet after structural changes: run go vet ./... after creating new files, adding exported functions, or modifying concurrency code.
  • Format check before done: run gofmt -d <file> before presenting code as complete. If it produces output, the code has formatting issues.
  • Race detection for concurrency: run go test -race -count=1 ./... after modifying code involving goroutines, channels, shared state, or sync primitives.
  • Version gate features: check the go directive in go.mod before suggesting features from newer versions. Use the version feature table above.
  • Modernize with go fix: when reviewing existing code, run go fix -diff ./... to identify modernization opportunities. Present the diff to the user before applying.
  • Never suggest deprecated APIs: ioutil (deprecated 1.16), math/rand.Seed (unnecessary since 1.20), // +build (replaced by //go:build).
  • Prefer errors.Is/As/AsType: over type assertions or string matching on errors. Use errors.AsType[T] on Go 1.26+.
  • Limit HTTP request bodies: when writing HTTP handlers that decode request bodies, always use http.MaxBytesReader to prevent denial-of-service via unbounded uploads. This is easy to forget and hard to catch in code review.
  • Set HTTP server timeouts: when creating http.Server, always set ReadTimeout, WriteTimeout, and IdleTimeout. A server without timeouts is vulnerable to slowloris attacks.

When NOT to run tools:

  • Do not run go test when only editing comments or documentation
  • Do not run go vet when the user is just asking a question, not writing code
  • Do not run go doc for universally known functions (fmt.Println, len, append, etc.)

Idiomatic Go Principles

These are the philosophical foundations. When reviewing or writing Go code, apply these as judgment calls, not rigid rules:

  • Clear is better than clever. Readable code is maintainable code. Prefer explicit control flow over clever one-liners.
  • Accept interfaces, return structs. Functions should accept the smallest interface that satisfies their needs and return concrete types. This maximizes flexibility for callers and clarity for the API.
  • Define interfaces at the consumer, not the provider. The package that uses an interface should define it, keeping it as small as needed.
  • Errors are values. Handle them, don't ignore them. Wrap with context using fmt.Errorf("doing X: %w", err). See references/error-handling.md.
  • Make the zero value useful. Design types so their zero value is valid and usable (e.g., sync.Mutex, bytes.Buffer).
  • Composition over inheritance. Use struct embedding for reuse, not deep hierarchies.
  • Keep packages focused. Organize by domain, not by layer. A user package, not a models package.
  • defer for cleanup. Place defer immediately after acquiring a resource. It communicates cleanup intent right where the resource is opened.
  • Unexported by default. Export only what is part of the public API. Unexported symbols can be changed freely.
  • Pointer vs value receivers. Be consistent per type. Use value receivers for small, immutable types. Use pointer receivers for mutation or large structs. A type with any pointer receiver should use pointer receivers everywhere.

Reference Router

Open the reference file that matches the question. Load only one at a time.

Foundations

  • Error handling (wrapping, sentinel errors, error types, errors.Is/As/AsType, errors.Join) -> references/error-handling.md
  • Concurrency (goroutines, channels, sync primitives, context, patterns, pitfalls) -> references/concurrency.md
  • Testing (table tests, subtests, benchmarks, fuzzing, golden files, coverage, helpers) -> references/testing.md

Modern Go

  • Version-gated features (1.21-1.26 features, deprecated patterns, go fix guide) -> references/modern-go.md

Applied Topics

  • Performance (profiling, pprof, PGO, escape analysis, benchstat, allocation reduction) -> references/performance.md
  • Interface and API design (small interfaces, composition, functional options, generics) -> references/interfaces-and-design.md
  • Modules and dependencies (go.mod, versioning, workspace mode, vendoring) -> references/modules-and-deps.md
  • Security (input validation, SQL injection, path traversal, TLS, crypto, govulncheck) -> references/security.md

For a problem-based router ("I need to..."), see references/_index.md.

Verification Checklist

Before declaring work done on Go code:

  1. gofmt -d . produces no output
  2. go vet ./... produces no diagnostics
  3. go build ./... succeeds
  4. go test -race -count=1 ./... passes
  5. No deprecated patterns (ioutil, math/rand.Seed, // +build)
  6. Error values wrapped with %w where callers need errors.Is/errors.As
  7. Exported functions and types have doc comments
  8. context.Context is threaded through where cancellation matters
  9. HTTP handlers use http.MaxBytesReader for request body limits
  10. HTTP servers have ReadTimeout, WriteTimeout, IdleTimeout set
  11. go mod tidy has been run if dependencies changed

What ships with it: 10 files

62.4 KB alongside SKILL.md, 1 of them executable

scripts/

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.