.agents/skills/go-naming/SKILL.md
Go naming conventions for packages, functions, methods, variables, constants, and receivers from Google and Uber style guides. Use when naming any identifier in Go code—choosing names for types, functions, methods, variables, constants, or packages—to ensure clarity, consistency, and idiomatic style.
npx skillsauth add phant-app/phant go-namingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Normative: Core naming rules (MixedCaps, no underscores) are required per Google's canonical Go style guide. Advisory guidance provides best practices for clarity and maintainability.
Names should:
Naming is more art than science—Go names tend to be shorter than in other languages.
Normative: All Go identifiers must use MixedCaps.
Go uses MixedCaps or mixedCaps (camel case), never underscores (snake case).
// Good
MaxLength // exported constant
maxLength // unexported constant
userID // variable
URLParser // type with initialism
// Bad
MAX_LENGTH // no snake_case
max_length // no underscores
User_Name // no underscores in names
Names may contain underscores only in these cases:
TestFoo_InvalidInput, BenchmarkSort_LargeSliceNote: Filenames are not Go identifiers and may contain underscores.
Normative: Packages must be lowercase with no underscores.
Package names must be:
tabwriter not tab_writer)// Good: user, oauth2, k8s, tabwriter
// Bad: user_service (underscores), UserService (uppercase), count (shadows var)
Advisory: Don't use generic package names.
Avoid names that tempt users to rename on import: util, common, helper,
model, base. Prefer specific names: stringutil, httpauth, configloader.
When renaming imports, the local name must follow package naming rules:
import foopb "path/to/foo_go_proto" (not foo_pb with underscore).
Advisory: One-method interfaces use "-er" suffix.
By convention, one-method interfaces are named by the method name plus an -er
suffix to construct an agent noun:
// Standard library examples
type Reader interface { Read(p []byte) (n int, err error) }
type Writer interface { Write(p []byte) (n int, err error) }
type Formatter interface { Format(f State, verb rune) }
type CloseNotifier interface { CloseNotify() <-chan bool }
Honor canonical method names (Read, Write, Close, String) and their
signatures. If your type implements a method with the same meaning as a
well-known type, use the same name—call it String not ToString.
Normative: Receivers must be short abbreviations, used consistently.
Receiver variable names must be:
| Long Name (Bad) | Better Name |
|-----------------------------|--------------------------|
| func (tray Tray) | func (t Tray) |
| func (info *ResearchInfo) | func (ri *ResearchInfo)|
| func (this *ReportWriter) | func (w *ReportWriter) |
| func (self *Scanner) | func (s *Scanner) |
// Good - consistent short receiver
func (c *Client) Connect() error
func (c *Client) Send(msg []byte) error
func (c *Client) Close() error
// Bad - inconsistent or long receivers
func (client *Client) Connect() error
func (cl *Client) Send(msg []byte) error
func (this *Client) Close() error
Normative: Constants use MixedCaps, never ALL_CAPS or K prefix.
// Good
const MaxPacketSize = 512
const defaultTimeout = 30 * time.Second
// Bad
const MAX_PACKET_SIZE = 512 // no snake_case
const kMaxBufferSize = 1024 // no K prefix
Advisory: Constants should explain what the value denotes.
// Good - names explain the role
const MaxRetries = 3
const DefaultPort = 8080
// Bad - names just describe the value
const Three = 3
const Port8080 = 8080
Normative: Initialisms maintain consistent case throughout.
Initialisms (URL, ID, HTTP, API) should be all uppercase or all lowercase:
| English | Exported | Unexported |
|-----------|-----------|------------|
| URL | URL | url |
| ID | ID | id |
| HTTP/API | HTTP | http |
| gRPC/iOS | GRPC/IOS | gRPC/iOS |
// Good: HTTPClient, userID, ParseURL()
// Bad: HttpClient, orderId, ParseUrl()
Advisory: Don't use
Getprefix for simple accessors.
If you have a field called owner (unexported), the getter should be Owner()
(exported), not GetOwner(). The setter, if needed, is SetOwner():
// Good
owner := obj.Owner()
if owner != user {
obj.SetOwner(user)
}
// Bad: c.GetName(), u.GetEmail(), p.GetID()
Use Compute or Fetch for expensive operations:
db.FetchUser(id), stats.ComputeAverage().
Advisory: Use noun-like names for getters, verb-like names for actions.
// Noun-like for returning values
func (c *Config) JobName(key string) string
func (u *User) Permissions() []Permission
// Verb-like for actions
func (c *Config) WriteDetail(w io.Writer) error
When functions differ only by type, include type at the end:
ParseInt(), ParseInt64(), AppendInt(), AppendInt64().
For a clear "primary" version, omit the type:
Marshal() (primary), MarshalText() (variant).
Variable naming balances brevity with clarity. Key principles:
i, v) for small scopes; longer,
descriptive names for larger scopesi for index,
r/w for reader/writer)users not userSlice, name not nameString_ prefix for package-level unexported
vars/consts to prevent shadowing// Good - scope-appropriate naming
for i, v := range items { ... } // small scope
pendingOrders := filterPending(orders) // larger scope
// Good - unexported global with prefix
const _defaultPort = 8080
For detailed guidance: See references/VARIABLES.md
Go names should not feel repetitive when used. Consider the full context:
widget.New() not widget.NewWidget()p.Name() not p.ProjectName()sqldb, use Connection not DBConnection// Bad - repetitive
func (c *Config) WriteConfigTo(w io.Writer) error
package db
func LoadFromDatabase() error // db.LoadFromDatabase()
// Good - concise
func (c *Config) WriteTo(w io.Writer) error
package db
func Load() error // db.Load()
For detailed guidance: See references/REPETITION.md
| 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) |
go-interfacesgo-style-corego-error-handlinggo-testinggo-defensivego-performancedata-ai
Beginner-first implementation planning from an approved design. Use after brainstorming, or when the user already approved requirements and wants a step-by-step Laravel implementation plan before coding.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
development
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.