Command Palette

Search for a command to run...

Назад к скиллам
скилл № 76504

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от 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 go directive in go.mod unless 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):

  1. gofumpt -l -w .
  2. goimports-reviser -company-prefixes "$(go list -m | cut -d/ -f1-2)" -project-name "$(go list -m)" ./...
  3. go vet ./..., go-critic check ./..., staticcheck ./..., and gohawk ./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, and cfg for standalone variables (plus standard initialisms such as ID, 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 *Params for long-lived dependency constructors with more than four required arguments, counting ctx; use *Opts for 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 in const (...)/var (...) blocks. Group imports as stdlib, third-party, then internal.
  • Enums: String type plus an All* slice for validation.
  • Constructors: Use NewX for required dependencies and fluent WithXxx methods returning the receiver for optional overrides. Skip NewX when a same-package struct needs no defaults, validation, or hidden fields.
  • Parameters: Put ctx context.Context first in every context-taking function or method signature (after the receiver, if any); never store it in *Params or *Opts. Outside long-lived dependency constructors, limit signatures to four explicit parameters, excluding the receiver; count ctx and handles such as tx. Above four, group cohesive per-call inputs in a named *Opts struct, 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; ...T hides arity and silently ignores extra arguments. Add a plain parameter and update call sites (passing nil or a zero value where unused), or use *Opts / WithXxx.
  • Interfaces & embedding: Define consumer-side interfaces only when swapping implementations (interface.go when shared), with a compile-time check (var _ Store = (*MockStore)(nil)). Access embedded fields explicitly (s.Logger.Info(...), not s.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 and net/netip (netip.Addr, netip.Prefix, netip.AddrPort) over net.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
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • 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), без исполняемых скриптов.

Похожие скиллы

Сравнить conventions-go с