golang-naming

Apply idiomatic Go naming conventions to packages, identifiers, and tests.

2|Updated Mar 13, 2023
One-click install
npx skills add https://github.com/haipham22/golang-sample --skill golang-naming-haipham22
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-naming
Source: https://github.com/haipham22/golang-sample/tree/main/.agents/skills/golang-naming
Command: npx skills add https://github.com/haipham22/golang-sample --skill golang-naming-haipham22

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you choose clear, idiomatic names for Go code so packages, types, functions, variables, constants, errors, and tests read naturally and avoid common stuttering or convention mistakes.

Core Features & Use Cases

  • Package naming guidance for lowercase, singular, single-word packages that avoid generic names like utils or helpers.
  • Identifier rules for constructors, receivers, booleans, acronyms, getters, setters, enums, and error values.
  • Test naming guidance for table-driven cases, subtests, and helper functions.
  • Use it when reviewing or refactoring Go code, naming new APIs, or deciding between competing identifier patterns such as New versus NewTypeName, IsConnected versus connected, or StatusUnknown versus StatusReady.

Quick Start

Ask this Skill to review your Go names or rewrite a snippet so it follows idiomatic Go naming conventions.

Frequently Asked Questions about golang-naming

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the idiomatic Go naming conventions for packages and identifiers?

Idiomatic Go naming conventions require lowercase, singular, single-word packages that avoid generic names like utils, and specific identifier rules for constructors, receivers, booleans, acronyms, and errors to ensure code reads naturally without stuttering.

How do I name tests and subtests in a Go project?

To name tests and subtests in a Go project, apply standard test naming guidance for table-driven cases, subtests, and helper functions. This ensures predictable test naming that aligns with standard library style rules.

Should I use New or NewTypeName for Go constructors?

When deciding between New versus NewTypeName for Go constructors, apply idiomatic naming rules to enforce standard library style. This prevents stuttering and ensures your API design reads naturally without redundant type names.

How do I name error values and boolean variables in Go?

To name error values and boolean variables in Go, follow identifier rules that enforce lowercase error strings and clear boolean prefixes like IsConnected. This avoids stuttering and matches standard library style expectations.

Can this Skill help review and refactor existing Go code for naming issues?

Yes, you can use this Skill to review and refactor existing Go code. It improves code by applying idiomatic conventions for packages, identifiers, constructors, booleans, enums, errors, and tests during your code review process.

What is the best way to avoid stuttering in Go package and type names?

The best way to avoid stuttering in Go package and type names is to apply standard library style rules that enforce stutter-free names. This ensures packages, types, and functions read naturally without redundant name patterns.