go-naming

cxuu/golang-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/cxuu/golang-skills --skill go-naming
0 commentsdiscussion
summary

Names should:

skill.md

Go Naming Conventions

Available Scripts

  • scripts/check-naming.sh — Scans Go code for naming anti-patterns: SCREAMING_SNAKE_CASE constants, Get-prefixed getters, bad package names (util/helper/common), and receivers named "this"/"self". Run bash scripts/check-naming.sh --help for options.

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.

// Good: user, oauth2, tabwriter
// Bad:  user_service, UserService, count (shadows var)

Read references/IDENTIFIERS.md when naming packages, deciding on import aliases, or choosing between generic and specific package names.


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.

Read references/IDENTIFIERS.md when defining new interfaces or implementing well-known method 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.

Read references/IDENTIFIERS.md when choosing receiver names or ensuring consistency across methods.


Constant Names

Normative: Constants use MixedCaps, never ALL_CAPS or K prefix.

Name constants by role, not value: MaxRetries not Three, DefaultPort not Port8080.

const MaxPacketSize = 512
const defaultTimeout = 30 * time.Second

Read references/IDENTIFIERS.md when naming constants or choosing between role-based and value-based names.


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().

Read references/IDENTIFIERS.md when using initialisms in compound names or for the full case table.


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().

Read references/IDENTIFIERS.md when designing getter/setter APIs or naming function variants.


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
for i, v := range items { ... }           // small scope
pendingOrders := filterPending(orders)    // larger scope
const _defaultPort = 8080                 // unexported global

Read references/VARIABLES.md when naming local variables in functions over 15 lines.


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

Read references/REPETITION.md when a package name and its exported symbols feel redundant.


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 when naming interfaces with the -er suffix or choosing receiver types
  • Package naming: See go-packages when naming packages, avoiding util/common, or resolving import collisions
  • Error naming: See go-error-handling when naming sentinel errors (ErrFoo) or custom error types
  • Declaration scope: See go-declarations when variable name length depends on scope or when avoiding built-in shadowing
  • Style principles: See go-style-core when balancing clarity vs concision in identifier names
how to use go-naming

How to use go-naming on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add go-naming
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/cxuu/golang-skills --skill go-naming

The skills CLI fetches go-naming from GitHub repository cxuu/golang-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/go-naming

Reload or restart Cursor to activate go-naming. Access the skill through slash commands (e.g., /go-naming) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.637 reviews
  • Sakura Wang· Dec 28, 2024

    go-naming fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Yusuf Ghosh· Nov 19, 2024

    I recommend go-naming for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Neel Harris· Oct 10, 2024

    Solid pick for teams standardizing on skills: go-naming is focused, and the summary matches what you get after install.

  • Kwame Johnson· Sep 25, 2024

    go-naming fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Advait Abbas· Sep 17, 2024

    Registry listing for go-naming matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Oshnikdeep· Sep 13, 2024

    Solid pick for teams standardizing on skills: go-naming is focused, and the summary matches what you get after install.

  • Sakura Yang· Sep 9, 2024

    I recommend go-naming for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Advait Reddy· Aug 28, 2024

    Solid pick for teams standardizing on skills: go-naming is focused, and the summary matches what you get after install.

  • Benjamin Perez· Aug 16, 2024

    go-naming has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Layla Diallo· Aug 8, 2024

    Useful defaults in go-naming — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

showing 1-10 of 37

1 / 4