Go
Writes, debugs, and reviews Go: goroutine leaks, data races, nil interfaces, slices and maps, go.mod, and net/http. Use when Go panics or misbehaves — "all…
от clawic★ 23 звезды на GitHub
Установить Go в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
User preferences live in ~/Clawic/data/go/config.yaml (see Configuration); nothing else is stored on the user's machine. If you have data at an old location (~/go/ or ~/clawic/go/), move it to ~/Clawic/data/go/, and say in one line that you moved it and from where. Note that ~/go/ may also be the user's GOPATH — never write skill data there, and never delete it.
When To Use
- Writing or reviewing Go — scan Core Rules and Output Gates before committing
- Any panic,
fatal error:, or race warning whose cause is not obvious in ten seconds - Hangs, goroutine growth, rising RSS, and CPU that appears without traffic
- Concurrency design: channels vs mutexes, worker pools, cancellation, fan-in/fan-out
- Toolchain and dependency work: modules, versions, build tags, cross-compilation, containers
- API and package design decisions: interfaces, generics, error contracts, layout
- Not for Kubernetes operators, gRPC service design, or web-framework internals — those live in their own skills
Quick Reference
| Situation | Play |
|---|---|
| Goroutine count only goes up; process never releases memory | Every go needs an exit path: closed channel, ctx.Done(), or a bounded loop → concurrency.md |
WARNING: DATA RACE, or "it only fails under load" |
Read both stacks in the report; the fix is a mutex, a channel, or atomic — never a time.Sleep → concurrency.md |
| A call hangs forever, or shutdown never completes | Missing deadline or a cancel() that was never deferred → context.md |
errors.Is/errors.As stopped matching after a refactor |
Someone wrapped with %v instead of %w, or dropped Unwrap() → errors.md |
A returned error is non-nil but holds nothing |
Concrete nil pointer in an interface: nil only when type AND value are nil → interfaces.md |
Deciding between a type parameter, an interface, and any |
Interface first; type parameters when the body is identical for every type → generics.md |
| Append mutated data someone else was holding | b := a[1:3] shares the array; cap(a[i:j]) == cap(a)-i → collections.md |
Byte/rune confusion, len() disagreeing with what you see, slow concatenation |
range yields runes; strings.Builder for loops → strings.md |
| Struct copies, embedding, tags, map keys that panic, oversized structs | Comparability, promotion, and field alignment → structs.md |
Timers, tickers, DST, parsing 2006-01-02, elapsed time that goes negative |
Monotonic clock for durations, wall clock for instants → time.md |
JSON decodes but fields are zero, big integers lose digits, omitempty misfires |
Exported fields + tags; numbers land as float64 in any → json.md |
| Writing handlers or clients: timeouts, middleware, graceful shutdown, leaked bodies | Never http.DefaultClient in a service; drain and close every body → http.md |
database is locked, connection pool exhaustion, NULLs, transactions that leak |
rows.Close() on every path; size the pool against the DB limit → database.md |
Reading/writing files and streams; Close() errors; partial writes |
io.Reader/io.Writer composition; write temp then os.Rename → io.md |
| Building a CLI: flags, exit codes, signals, piping, stdin detection | flag for simple, exit through main so defers run → cli.md |
| Nothing appears in the logs; deciding what to log and at which level | log/slog handler and level; attributes, not formatted strings → logging.md |
| Writing tests, table tests, fakes, fuzzing, benchmarks, golden files | Subtests + t.Parallel(); -race on the suite → testing.md |
| A panic stack, a hung binary, or a flake you cannot reproduce | SIGQUIT stack dump, -race, GODEBUG, delve → debugging.md |
| "It is slow" — before optimizing anything | Benchmark, then pprof; fix the top line or nothing → performance.md |
| RSS grows, GC runs constantly, or a container gets OOM-killed | GOGC, GOMEMLIMIT, escape analysis, retained references → memory.md |
go.mod/go.sum errors, version selection, replace, private repos, monorepos |
MVS picks the minimum that satisfies everyone, not the latest → modules.md |
Build tags, cross-compilation, go:embed, cgo, -ldflags, go generate |
CGO_ENABLED=0 GOOS=… GOARCH=… go build → build.md |
| Shipping the binary: container image, GOMAXPROCS in a cgroup, health, rollout | Static binary + explicit resource ceilings → deployment.md |
| Untrusted input, secrets, tokens, TLS, templates, dependency CVEs | crypto/rand, html/template, govulncheck → security.md |
| Naming, package boundaries, receivers, exported API shape, linters | Package name is part of every identifier; no stutter → idioms.md |
| Choosing or upgrading a Go version; a feature that "should exist" but doesn't | Two releases are supported at a time; upgrade with -race and vet first → versions.md |
| Anything else | Core Rules below, then reduce to a main.go that reproduces it in under 30 |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _meta.json
- build.md
- cli.md
- collections.md
- concurrency.md
- context.md
- database.md
- debugging.md
- deployment.md
- errors.md
- generics.md
- http.md
- idioms.md
- interfaces.md
- io.md
- json.md
- logging.md
- memory.md
- modules.md
- performance.md
- security.md
- strings.md
- structs.md
- testing.md
- time.md
- versions.md
FAQ
Что делает скилл Go?
Writes, debugs, and reviews Go: goroutine leaks, data races, nil interfaces, slices and maps, go.mod, and net/http. Use when Go panics or misbehaves — "all goroutines are asleep - deadlock!", "concurrent map writes", "send on closed channel", "assignment to entry in nil map", or a WARNING: DATA RACE from `go test -race`; when a goroutine, timer, or connection leaks and memory climbs; when a service hangs for want of a timeout; when errors.Is or errors.As stops matching after a %v wrap; when a slice mutates its parent, a map iterates in a new order, or a typed nil returned as error compares non-nil; when go.mod, go.sum, workspaces, replace, or a /v2 path fight over dependencies; when cross-compiling, cgo, build tags, go:embed, or a static container binary fail; when tests are flaky under -race or -parallel or benchmarks lie; when GOGC, GOMEMLIMIT, GOMAXPROCS, or escape analysis need tuning; or when writing handlers, CLIs, database access, or generics. Not for Kubernetes operators or framework internals.
Как установить скилл Go?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Go запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…