Skip to content
Back to skills

Golang Naming

ASecurity

Choose idiomatic, searchable Go names for packages, files, identifiers, receivers, methods, interfaces, errors, tests, and examples. Use when naming new APIs or reviewing names for clarity and compatibility.

  • 24 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 9, 2026
ai-agentsgotestingapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned November 9, 2026

npx -y skills add aiproxer/aiproxer --skill golang-naming --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Golang Naming?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Golang Naming
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aiproxer-golang-naming/badge)](https://www.skillsdirectory.com/skills/aiproxer-golang-naming)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: golang-naming
description: "Choose idiomatic, searchable Go names for packages, files, identifiers, receivers, methods, interfaces, errors, tests, and examples. Use when naming new APIs or reviewing names for clarity and compatibility."
---

# Go naming

Names should make the smallest useful promise. Prefer the vocabulary already used by the package and its callers; do not rename a public symbol merely to satisfy a preference.

## Focused review

For a review, keep the work read-only unless fixes are requested. Establish the review base, supported versions, and relevant contract; inspect changed code plus the callers and tests needed to assess it. Stay within this skill’s lens.

- Trace a name to its callers and contract; flag a misleading promise, ambiguous unit, ownership/mutation surprise, or domain collision with a concrete reading consequence.
- Check rename compatibility beyond Go callers: JSON/tags, reflection, config keys, generated code, metrics, CLI flags, plugins, examples, and external consumers.
- Inspect initialisms, stutter, package qualifiers, receiver consistency, and searchable vocabulary using local conventions; avoid inventing mandatory prefixes or mutation suffixes.
- Check test/example names are discoverable and build filename suffixes select intended targets. Separate correctness/compatibility findings from optional naming preferences.

Report each actionable finding with severity, confidence, file/symbol, trigger, consequence, and smallest remedy. Separate introduced/worsened defects from pre-existing debt, and state executed checks versus inference. If none survives validation, say so and identify coverage gaps.

## Identifiers

- Use mixedCaps, not underscores or Hungarian prefixes. Initialisms stay consistently capitalized (`URL`, `HTTP`, `ID`, `JSON`).
- Keep local names short when scope is short (`i`, `err`, `ctx`) and descriptive when values live longer or have similar peers.
- Avoid stutter: `http.Server`, not `http.HTTPServer`; `user.Name`, not `user.UserName` unless the distinction matters.
- Use `NewType` for constructors when that convention is useful, but do not create constructors just to validate a zero-value-safe type.
- Name booleans as predicates (`Enabled`, `HasItems`, `CanRetry`) and avoid double negatives.

Receiver names are short and consistent within a type; they are not part of the method’s API. A method named `Read` does not implement `io.Reader` by name alone—the exact `Read([]byte) (int, error)` signature and method set are required.

## Packages and files

Package names are lowercase, concise, and singular where natural; avoid generic names like `util`, `common`, or `misc`. A `cmd/` tree is a useful convention for commands, not a Go requirement. The `internal/` rule is lexical: code under an `internal` directory may be imported only by code within that directory’s parent tree, regardless of module boundaries.

Use file suffixes and build constraints to communicate platform or role (`_test.go`, `_linux.go`, `_windows.go`). Keep generated-file markers intact. File names do not determine package visibility.

## Types, methods, and errors

Prefer names that describe behavior or domain concepts, not implementation details. Interface names may use `-er` when the single behavior is clear (`io.Reader`), but multi-method interfaces need not be forced into that suffix. Keep interfaces small and define them near the consumer.

Sentinel errors use `Err` plus a meaningful noun/adjective (`ErrNotFound`). Custom error types describe the failure (`ParseError`) and expose fields only when callers need them. Test names state behavior (`TestParserRejectsEmptyInput`); subtest names should distinguish cases without encoding incidental implementation.

See [identifier details](references/identifiers.md), [functions and methods](references/functions-methods.md), [packages and files](references/packages-files.md), [types and errors](references/types-errors.md), and [testing names](references/testing.md).

Files in this skill

  • SKILL.md3.9 KB
  • evals/evals.json25.1 KB
  • references/functions-methods.md962 B
  • references/identifiers.md887 B
  • references/packages-files.md897 B
  • references/testing.md589 B
  • references/types-errors.md866 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.