Help us improve
Share bugs, ideas, or general feedback.
From go-knowledge-patch
Supplies Go 1.23+ knowledge including new(expr) builtin, errors.AsType, self-referential generics, reflect iterators, and go fix modernizer. Load for post-1.22 Go development.
npx claudepluginhub nevaberry/nevaberry-plugins --plugin go-knowledge-patchHow this skill is triggered — by the user, by Claude, or both
Slash command
/go-knowledge-patch:go-knowledge-patchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Claude's baseline knowledge covers Go through 1.22. This skill provides features from 1.23 (2024) onwards.
Applies modern Go syntax guidelines and features (slices, maps, cmp, min/max, etc.) based on project's detected Go version from go.mod. Avoids outdated patterns.
Applies Go best practices for performance, modern syntax, generics, patterns, testing, error handling, and concurrency when writing or reviewing Go code.
Modernizes Go code to use recent language features, standard library improvements, and idiomatic patterns. Triggers on old patterns or explicit /golang-modernize invocation.
Share bugs, ideas, or general feedback.
Claude's baseline knowledge covers Go through 1.22. This skill provides features from 1.23 (2024) onwards.
| Feature | Syntax |
|---|---|
| Pointer from expression | new(42), new(yearsSince(born)) |
| Self-referential generics | type Adder[A Adder[A]] interface { Add(A) A } |
See references/language-changes.md for details and migration patterns.
| Package | Addition | Purpose |
|---|---|---|
errors | AsType[T](err) | Generic type-safe error matching |
bytes | Buffer.Peek(n) | Read next n bytes without advancing |
log/slog | NewMultiHandler(h...) | Fan out to multiple log handlers |
reflect | Type.Fields(), .Methods(), .Ins(), .Outs() | Iterator methods on types |
reflect | Value.Fields(), .Methods() | Iterator methods yielding type+value |
testing | T.ArtifactDir() | Directory for test output artifacts |
See references/stdlib-updates.md for full API details and examples.
| Command | Purpose |
|---|---|
go fix ./... | Rewritten modernizer — updates code to current idioms |
//go:fix inline | Directive for custom API migration rules |
See references/tooling.md for modernizer details.
| File | Contents |
|---|---|
language-changes.md | new(expr), self-referential generic constraints |
stdlib-updates.md | errors.AsType, bytes.Buffer.Peek, slog.NewMultiHandler, reflect iterators, testing artifacts |
tooling.md | go fix modernizers, //go:fix inline directive |
new(expr) Replaces ptr() Helpers (1.26)The most common impact — eliminates the ubiquitous ptr[T any](v T) *T helper:
// Before: needed a helper or temp variable
func ptr[T any](v T) *T { return &v }
p := ptr(42)
// After: built-in
p := new(42)
p := new(yearsSince(born)) // useful for optional struct fields
errors.AsType — No More Temp Variables (1.26)// Before
var pathErr *fs.PathError
if errors.As(err, &pathErr) {
use(pathErr)
}
// After — no separate variable needed
if pe, ok := errors.AsType[*fs.PathError](err); ok {
use(pe)
}
Range over struct fields, method sets, and function signatures:
for sf, v := range reflect.ValueOf(s).Fields() {
fmt.Println(sf.Name, v)
}