go-naming — скилл для Claude Code: правила именования в Go
Скилл следит за именами в Go: пакеты, типы, функции, константы, получатели. Пригодится, когда агент создаёт новые типы или экспортируемое API.
npx skills add cxuu/golang-skills --skill go-naming -a claude-codeЧто делает go-naming
Скилл включается, когда агент придумывает имя любому идентификатору в Go: пакету, типу, функции, методу, переменной, константе или получателю. Отдельно он срабатывает при создании новых типов, пакетов и экспортируемых API, даже если про соглашения об именах никто не спрашивал.
Внутри есть скрипт scripts/check-naming.sh и справочники: references/IDENTIFIERS.md про аббревиатуры и экспортируемые имена, references/REPETITION.md про повторы контекста, references/VARIABLES.md про локальные переменные и получатели. Скрипт ловит константы в SCREAMING_SNAKE_CASE, геттеры с префиксом Get, общие имена пакетов вроде util и получатели this или self. После переименования скилл советует прогнать bash scripts/check-naming.sh, а затем go build ./... — иначе легко не заметить сломанную сборку.
Организацию пакетов скилл не разбирает, для этого есть отдельный go-packages. Имена в Go короче, чем в других языках, и часть решений здесь оценочные: суффикс -er для интерфейсов с одним методом и отсутствие Get у простых аксессоров — это рекомендации, а MixedCaps и короткие получатели — обязательные требования.
Какие задачи решает
- привести имена констант к MixedCaps вместо ALL_CAPS
- убрать префикс Get у простых геттеров
- выбрать длину имени переменной под размер области видимости
- переименовать пакет
utilво что-то конкретное - не затенять предобъявленные идентификаторы вроде
errorиlen
Примеры запросов агенту
- Придумай имена для новых типов в пакете заказов, проверь их по go-naming
- У меня константы в SCREAMING_SNAKE_CASE — прогони go-naming и переименуй
- Назови интерфейс для чтения конфига по правилам go-naming
Как установить go-naming
1Через Skills CLI (Vercel)
npx skills add cxuu/golang-skills --skill go-naming -a claude-code2Вручную: положить файлы
~/.claude/skills/go-naming/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/go-naming/
1Через Skills CLI (Vercel)
npx skills add cxuu/golang-skills --skill go-naming -a codex2Вручную: положить файлы
.agents/skills/go-naming/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add cxuu/golang-skills --skill go-naming -a cursor2Вручную: положить файлы
.cursor/skills/go-naming/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install cxuu/golang-skills go-naming2Вручную: положить файлы
.github/skills/go-naming/SKILL.md1Через Skills CLI (Vercel)
npx skills add cxuu/golang-skills --skill go-naming -a gemini-cli2Командой платформы
gemini skills install https://github.com/cxuu/golang-skills --path skills/go-namingВручную: положить файлы
.devin/skills/go-naming/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add cxuu/golang-skills --skill go-naming -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора19
Похожие
Вопросы о go-naming
Как установить go-naming в Claude?
Выполните npx skills add cxuu/golang-skills --skill go-naming -a claude-code. После этого файл скилла лежит в ~/.claude/skills/go-naming/SKILL.md.
Что делает go-naming?
Проверяет и подсказывает имена для идентификаторов Go: пакетов, типов, функций, методов, переменных, констант и получателей. Срабатывает и тогда, когда агент просто создаёт новый тип или экспортируемое API.
Чем go-naming отличается от go-packages?
go-naming отвечает за сами имена, а организацию пакетов разбирает go-packages. Для интерфейсов, ошибок и области объявления есть отдельные скиллы: go-interfaces, go-error-handling, go-declarations.
Исходный текст
SKILL.md · Apache-2.0
---
name: go-naming
description: Use when naming any Go identifier — packages, types, functions, methods, variables, constants, or receivers — to ensure idiomatic, clear names. Also use when a user is creating new types, packages, or exported APIs, even if they don't explicitly ask about naming conventions. Does not cover package organization (see go-packages).
allowed-tools: Bash(bash:*)
---
# Go Naming Conventions
## Resource Routing
- `scripts/check-naming.sh` - Run when checking SCREAMING_SNAKE_CASE constants, Get-prefixed getters, generic package names, or receivers named `this`/`self`.
- `references/IDENTIFIERS.md` - Read when choosing names for initialisms, exported identifiers, or package-level symbols.
- `references/REPETITION.md` - Read when names repeat package, receiver, type, or local context.
- `references/VARIABLES.md` - Read when choosing local variable names, receiver names, or loop identifiers.
## Core Principle
Names should:
- Not feel repetitive when used
- Take context into consideration
- Not repeat concepts that are already clear
Naming is more art than science—Go names tend to be shorter than in other
languages.
---
## Naming Decision Flow
```
What are you naming?
├─ Package → Short, lowercase, singular noun (no underscores, no mixedCaps)
├─ Interface → Method name + "-er" suffix when single-method (Reader, Writer)
├─ Receiver → 1-2 letter abbreviation of type (c for Client); consistent across methods
├─ Constant → MixedCaps; use iota for enums; no ALL_CAPS
├─ Exported func → Verb or verb-phrase in MixedCaps; no Get prefix for getters
├─ Variable → Length proportional to scope distance
│ ├─ Tiny scope (1-7 lines) → single letter (i, n, r)
│ ├─ Medium scope → short word (count, buf)
│ └─ Package-level / wide → descriptive (userAccountCount)
└─ Any name → Check: does it repeat package name or context? If yes, shorten it
```
---
## MixedCaps (Required)
> **Normative**: All Go identifiers must use MixedCaps.
Underscores are allowed only in: test functions (`TestFoo_InvalidInput`),
generated code, and OS/cgo interop.
---
## Package Names
> **Normative**: Packages must be lowercase with no underscores.
Short, lowercase, singular nouns. Avoid generic names like `util`, `common`,
`helper` — prefer specific names: `stringutil`, `httpauth`, `configloader`.
```go
// Good: user, oauth2, tabwriter
// Bad: user_service, UserService, count (shadows var)
```
---
## Interface Names
> **Advisory**: One-method interfaces use "-er" suffix.
Name one-method interfaces by the method plus `-er`: `Reader`, `Writer`,
`Formatter`. Honor canonical method names (`Read`, `Write`, `Close`, `String`)
and their signatures.
---
## Receiver Names
> **Normative**: Receivers must be short abbreviations, used consistently.
One or two letters abbreviating the type, consistent across all methods:
`func (c *Client) Connect()`, `func (c *Client) Send()`.
Never use `this` or `self`.
---
## Constant Names
> **Normative**: Constants use MixedCaps, never ALL_CAPS or K prefix.
Name constants by role, not value: `MaxRetries` not `Three`,
`DefaultPort` not `Port8080`.
```go
const MaxPacketSize = 512
const defaultTimeout = 30 * time.Second
```
---
## Initialisms and Acronyms
> **Normative**: Initialisms maintain consistent case throughout.
Initialisms (URL, ID, HTTP, API) must be all uppercase or all lowercase:
`HTTPClient`, `userID`, `ParseURL()` — not `HttpClient`, `orderId`, `ParseUrl()`.
---
## Function and Method Names
> **Advisory**: No `Get` prefix for simple accessors; use verb-like names for actions.
Getter for field `owner` is `Owner()`, not `GetOwner()`. Setter is
`SetOwner()`. Use `Compute` or `Fetch` for expensive operations.
When functions differ only by type, include type at the end:
`ParseInt()`, `ParseInt64()`.
---
## Variable Names
Variable naming balances brevity with clarity. Key principles:
- **Scope-based length**: Short names (`i`, `v`) for small scopes; longer,
descriptive names for larger scopes
- **Single-letter conventions**: Use familiar patterns (`i` for index,
`r`/`w` for reader/writer)
- **Avoid type in name**: Use `users` not `userSlice`, `name` not `nameString`
- **Prefix unexported globals**: Use `_` prefix for package-level unexported
vars/consts to prevent shadowing
```go
for i, v := range items { ... } // small scope
pendingOrders := filterPending(orders) // larger scope
const _defaultPort = 8080 // unexported global
```
---
## Avoiding Repetition
Go names should not feel repetitive when used. Consider the full context:
- **Package + symbol**: `widget.New()` not `widget.NewWidget()`
- **Receiver + method**: `p.Name()` not `p.ProjectName()`
- **Context + type**: In package `sqldb`, use `Connection` not `DBConnection`
---
## Avoid Built-In Names
Never shadow Go's predeclared identifiers (`error`, `string`, `len`, `cap`,
`append`, `copy`, `new`, `make`, etc.) as variable, parameter, or type names.
**For detailed guidance**: See `go-declarations` — "Avoid Using Built-In Names"
section.
---
## Quick Reference
| Element | Rule | Example |
|---------|------|---------|
| Package | lowercase, no underscores | `package httputil` |
| Exported | MixedCaps, starts uppercase | `func ParseURL()` |
| Unexported | mixedCaps, starts lowercase | `func parseURL()` |
| Receiver | 1-2 letter abbreviation | `func (c *Client)` |
| Constant | MixedCaps, never ALL_CAPS | `const MaxSize = 100` |
| Initialism | consistent case | `userID`, `XMLAPI` |
| Variable | length ~ scope size | `i` (small), `userCount` (large) |
| Built-in names | Never shadow predeclared identifiers | See `go-declarations` |
> **Validation**: After renaming identifiers, run `bash scripts/check-naming.sh` to verify no naming anti-patterns remain. Then run `go build ./...` to confirm the rename didn't break anything.
## Related Skills
- **Interface naming**: See [go-interfaces](../go-interfaces/SKILL.md) when naming interfaces with the `-er` suffix or choosing receiver types
- **Package naming**: See [go-packages](../go-packages/SKILL.md) when naming packages, avoiding `util`/`common`, or resolving import collisions
- **Error naming**: See [go-error-handling](../go-error-handling/SKILL.md) when naming sentinel errors (`ErrFoo`) or custom error types
- **Declaration scope**: See [go-declarations](../go-declarations/SKILL.md) when variable name length depends on scope or when avoiding built-in shadowing
- **Style principles**: See [go-style-core](../go-style-core/SKILL.md) when balancing clarity vs concision in identifier names
© cxuu · Apache-2.0 · cxuu/golang-skills