agentsclimarketplace

Go idioms

Skill Cadasto/go-coding-plugin/skills/go-idioms

AI plugin for coding standards for Go

Install
npx -y skills add Cadasto/go-coding-plugin --skill go-idioms

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

Modern idiomatic Go (the `modernize` analyzer set). This skill should be used when the user writes, reviews, or modernizes Go and wants current-version idioms — range-over-int, `min`/`max`, `slices`/`maps`, `strings.Cut`, `cmp.Or`, `sync.OnceFunc`, iterators, `slog.LogAttrs`, `new(expr)` (Go 1.26), dropped loop-var copies. Framed so advice equals tooling (`go fix ./...` on Go 1.26, or `golangci-lint --enable-only=modernize`). Errors→`go-errors`, concurrency→`go-concurrency`, tests→`go-testing`. Not for golangci-lint configuration (use `go-linting`) or non-Go languages.

SKILL.md

3.6 KB, as published. Nobody here has run it

go-idioms — modern Go (modernize)

Advice == tooling. The modernize analyzers flag and usually auto-fix everything below. Run them, don't hand-audit. As of Go 1.26 the rewritten go fix is the canonical runner — it ships the full modernizer suite in the toolchain itself:

go fix ./...                                        # Go 1.26+: applies the built-in modernizers
golangci-lint run --enable-only=modernize --fix     # any toolchain (same analyzers, via golangci-lint)

Both draw on the same golang.org/x/tools engine as gopls, so their fixes agree. This skill explains why and catches what review notices before the tool runs. Check go.mod first — gate each idiom on the module's Go version (the Since column below); don't apply a Go 1.26 idiom to a repo pinned to 1.25 or older.

Prefer → over (since)

PreferOverSince
new(expr) — e.g. Field: new(30), new(int64(req.Limit))a ptr[T](v) helper (auto-rewritten by the newexpr fixer) or a hand-written tmp := v; &tmp, for optional/pointer fields1.26
for i := range nfor i := 0; i < n; i++1.22
min(a, b) / max(a, b) builtinshand-rolled helpers1.21
(drop) x := x loop-var copypre-1.22 capture workaround1.22
slices.Sort/Contains/Equal, slices.Collect, maps.Keyshand-rolled sort/contains/dedup1.21–1.23
strings.Cut / CutPrefix / CutSuffixIndex + manual slicing1.18/1.20
cmp.Or(a, b, …)nested if x == "" { x = y }1.22
sync.OnceFunc / OnceValuesync.Once + a captured var1.21
iter.Seq[V] / range-over-funcVisit(callback) patterns, exposing slices1.23
slog.LogAttrs(ctx, lvl, msg, attrs…) on hot pathskey-value variadic slog (allocates)1.21
errors.Joinmanual multi-error concat → go-errors1.20
wg.Go(...)wg.Add(1)/defer wg.Done()go-concurrency1.25
for b.Loop()for i := 0; i < b.N; i++go-testing1.24
typed atomic.Int64bare-int atomic.Add*go-concurrency1.19

Idioms are a moving target — let the tool (pinned to the repo's toolchain) be the source of truth so advice never drifts from the user's go fix. Go 1.26 also lifts the ban on a generic type referencing itself in its own type-parameter list (e.g. type Adder[A Adder[A]] interface{ Add(A) A }), so self-referential constraints no longer need a workaround — but that's a hand-written pattern, not something a modernizer rewrites.

Sources


Decomposition inspired by samber/cc-skills-golang (MIT © 2026 Samuel Berthe); rules grounded in the sources above.

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.