agentleFS
rundopsrundops/dops/.claude/skills/clean-code-naming/SKILL.md

clean-code-naming

Skill3 starsChanged 8 months agoMITView on GitHub

Go naming conventions and Clean Code naming principles. Use when creating, renaming, or reviewing names of functions, variables, types, constants, packages, or interfaces in Go code. Triggers on new type definitions, function signatures, variable declarations, and package naming.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 4 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No underscores, no mixedCaps

    line 14
  2. Very specific:

    Avoid generic names: util, common, helpers, misc — find a more specific name

    line 16
  3. Very specific:

    Do NOT prefix with I (no IReader) — this is not Go idiom

    line 23
  4. Distinctive:

    Use MixedCaps (exported) or mixedCaps (unexported)

    line 28
  5. Very specific:

    Start with a verb: Get, Set, New, Create, Parse, Validate

    line 29
  6. Very specific:

    No Hungarian notation, no type prefixes (strName, intCount)

    line 41
  7. Very specific:

    Avoid data, info, temp, tmp, val — they say nothing

    line 43
  8. Very specific:

    Not ALL_CAPS (that's not Go idiom, except for generated code)

    line 48
  9. Very specific:

    Avoid stutter with package name: user.User is fine, but user.UserService stutters — prefer user.Service

    line 56
  10. Very specific:

    If the spec says "deployment target", the type is DeploymentTarget, not Dest or Location

    line 61
  11. Very specific:

    Do not rename well-established Go conventions (err, ctx, ok, i)

    line 66
  12. Distinctive:

    Do not add comments to compensate for bad names — fix the name instead

    line 67
  13. Distinctive:

    Do not use abbreviations unless they are universally understood in the domain

    line 68
  14. Very specific:

    Do not use var names that shadow builtin or imported names

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Clean Code Naming for Go

Apply these naming principles to all Go code. Go idioms take precedence over generic Clean Code advice.

Package Names

  • Short, lowercase, single-word names: http, fmt, user
  • No underscores, no mixedCaps
  • Name should describe what the package provides, not what it contains
  • Avoid generic names: util, common, helpers, misc — find a more specific name
  • The package name is part of the call site: http.Get not httputil.HTTPGet

Interface Names

  • Single-method interfaces use the method name + er suffix: Reader, Writer, Closer, Formatter
  • Multi-method interfaces describe the capability: ReadWriter, Handler
  • Do NOT prefix with I (no IReader) — this is not Go idiom
  • Define interfaces where they are consumed, not where they are implemented

Function and Method Names

  • Use MixedCaps (exported) or mixedCaps (unexported)
  • Start with a verb: Get, Set, New, Create, Parse, Validate
  • Getters omit Get: use Name() not GetName() (Go convention)
  • Setters use Set: SetName()
  • Constructors use New: NewServer, NewClient
  • Boolean-returning functions read as questions: IsValid, HasPermission, CanRetry
  • The name should make the function's behavior obvious — if you need a comment to explain what it does, rename it

Variable Names

  • Short names in small scopes: i, n, r, w, err, ctx are idiomatic Go
  • Longer, descriptive names in larger scopes or when the type isn't obvious
  • Receivers are 1-2 letters, consistent across methods: s for Server, c for Client
  • No Hungarian notation, no type prefixes (strName, intCount)
  • Boolean variables read as predicates: ok, found, done, valid
  • Avoid data, info, temp, tmp, val — they say nothing

Constants

  • MixedCaps like variables: MaxRetries, DefaultTimeout
  • Not ALL_CAPS (that's not Go idiom, except for generated code)
  • Group related constants with iota when sequential values make sense

Type Names

  • Nouns that describe what the type is: Server, Request, Config
  • No Type suffix: User not UserType
  • No Struct suffix: Config not ConfigStruct
  • Avoid stutter with package name: user.User is fine, but user.UserService stutters — prefer user.Service

Spec Traceability

  • Names in code should mirror the domain language used in specs
  • If the spec says "deployment target", the type is DeploymentTarget, not Dest or Location
  • Consistent vocabulary between spec and code eliminates translation overhead

What NOT to Do

  • Do not rename well-established Go conventions (err, ctx, ok, i)
  • Do not add comments to compensate for bad names — fix the name instead
  • Do not use abbreviations unless they are universally understood in the domain
  • Do not use var names that shadow builtin or imported names

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.