conventions-go
MANDATORY for any work on Go files (*.go). Load this before editing, reviewing, or creating any *.go file. House Go conventions covering tooling, naming…
от Integralist★ 31 звезда на GitHub
Установить conventions-go в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
[!NOTE] If invoked directly with no specific task, load these conventions and stop.
House deltas for Go (CLIs, libraries, and services). In an established repo, match its existing architecture where it differs.
- Match the
godirective ingo.modunless the task includes an upgrade. - For an HTTP/API service built as handlers → service → repository, also read SERVICE-ARCHITECTURE.md. Do not apply that layering to other programs.
Tooling
Prefer gopls over text search/sed when available (go_rename_symbol plus
rg for comments/docs/strings, go_symbol_references before breaking
signatures, go_diagnostics for type errors).
Before finishing Go changes, run on changed packages (or use the repo's equivalent Make/lint targets):
gofumpt -l -w .goimports-reviser -company-prefixes "$(go list -m | cut -d/ -f1-2)" -project-name "$(go list -m)" ./...go vet ./...,go-critic check ./...,staticcheck ./..., andgohawk ./path/to/pkg/...
Preview modernizer rewrites with go fix -diff ./path/to/pkg/... when
modernizing. Fix root causes over suppressions; when a suppression is needed,
use the exact syntax in
LINTER-DIRECTIVES.md. See
TOOLING.md for install commands, go fix options,
and go doc lookups.
Naming and declarations
- Role-based names: Apply the delete-the-type test—names should make sense
without their type and at the point of use (including in tests) without
reading the assignment or query behind them. Spell out words in full with no
clipped stems inside identifiers, and qualify generic nouns or predicates
with their domain subject and format; reserve
ctx,err,req,resp, andcfgfor standalone variables (plus standard initialisms such asID,URL,TLS). Prefix generic structs with their domain (DNSClient) unless the package already narrows them (redis.Client). When a second value of the same kind enters scope, rename both. - Standard suffixes/prefixes: Start default constants with
default(defaultDebugPort). Use*Paramsfor long-lived dependency constructors with more than four required arguments, countingctx; use*Optsfor cohesive per-call inputs. - Layout: Sort struct fields and constructor assignments alphabetically
(embedded structs first). Tag internal-only exported struct fields
json:"-". Group related constants/variables inconst (...)/var (...)blocks. Group imports as stdlib, third-party, then internal. - Enums: String type plus an
All*slice for validation. - Constructors: Use
NewXfor required dependencies and fluentWithXxxmethods returning the receiver for optional overrides. SkipNewXwhen a same-package struct needs no defaults, validation, or hidden fields. - Parameters: Put
ctx context.Contextfirst in every context-taking function or method signature (after the receiver, if any); never store it in*Paramsor*Opts. Outside long-lived dependency constructors, limit signatures to four explicit parameters, excluding the receiver; countctxand handles such astx. Above four, group cohesive per-call inputs in a named*Optsstruct, keeping context and dependencies explicit. If inputs do not form a cohesive group, redesign rather than pack unrelated values into a struct. Never use a variadic parameter (...T) to simulate an optional argument or avoid updating existing call sites;...Thides arity and silently ignores extra arguments. Add a plain parameter and update call sites (passingnilor a zero value where unused), or use*Opts/WithXxx. - Interfaces & embedding: Define consumer-side interfaces only when
swapping implementations (
interface.gowhen shared), with a compile-time check (var _ Store = (*MockStore)(nil)). Access embedded fields explicitly (s.Logger.Info(...), nots.Info(...)). - Magic literals: Name literals that carry domain meaning—even when used
only once. In particular, never use bare integers as positional slice/array
indexes (
listeners[2]) or role-based length checks (len(listeners) > 2); implicit ordering hides what each slot means. Use named constants (slackListenerIndex) or struct fields, and define constants for repeated custom literals. - Stdlib preferences: In new code, use stdlib constants (
http.MethodGet,http.StatusOK,os.Interrupt) over magic literals andnet/netip(netip.Addr,netip.Prefix,netip.AddrPort) overnet.IP/*net.IPNet.
Functions
- Compose multi-step flows: When a function or transaction callback combines multiple distinct steps (SQL queries, validation blocks, or loops), extract each cohesive step into an unexported helper or method so the caller reads as an ordered sequence. Note non-obvious ordering constraints in a brief comment, and avoid pass-through wrappers that add no
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/LINTER-DIRECTIVES.md
- references/SERVICE-ARCHITECTURE.md
- references/TOOLING.md
FAQ
Что делает скилл conventions-go?
MANDATORY for any work on Go files (*.go). Load this before editing, reviewing, or creating any *.go file. House Go conventions covering tooling, naming, error wrapping, logging, concurrency, testing, and package layout.
Как установить скилл conventions-go?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл conventions-go запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…