
Golang Naming
Enforce idiomatic Go naming—New() constructors, prefixed errors, is-prefixed bools—when generating or reviewing backend packages with your agent.
Overview
golang-naming is an agent skill most often used in Build (also Ship) that applies idiomatic Go constructor, error-string, and boolean field naming rules during code generation and review.
Install
npx skills add https://github.com/samber/cc-skills-golang --skill golang-namingWhat is this skill?
- Eval scenario: apiclient package with single primary type and functional options
- Constructor rule: New() not NewClient() when package name already stutters context
- Sentinel error strings must carry package-prefix style (e.g. apiclient: not found)
- Boolean fields use is-prefix (isConnected) per documented assertions
- Custom error type wrapping HTTP status codes alongside sentinel errors
- Documented eval scenario id new-constructor-naming with 3+ naming assertions
- Single-primary-type apiclient fixture with sentinel and custom HTTP errors
Adoption & trust: 3.9k installs on skills.sh; 2k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent exports NewClient from package apiclient, writes vague error strings, and uses ambiguous bool field names that fail Go readability norms.
Who is it for?
Indie backend devs shipping Go APIs or clients who want agent output to match common Go style before code review.
Skip if: Teams writing only Python or TypeScript services, or repos that already enforce naming exclusively via static analysis with no agent drafting.
When should I use this skill?
Generating or reviewing Go packages where exported constructors, errors, and boolean fields must match team idioms.
What do I get? / Deliverables
Generated Go packages use New(), prefixed sentinel errors, and is-prefixed booleans so public APIs read cleanly at call sites.
- Go source files following New(), error-prefix, and is-bool conventions
- Review feedback aligned to documented naming assertions
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Primary shelf is build/backend because the skill encodes package-level naming rules for Go API and client code the builder writes daily. backend subphase reflects HTTP client packages, sentinel errors, and exported types—not frontend or ops-only tasks.
Where it fits
Scaffold apiclient with New(), options, and prefixed not-found errors before wiring HTTP methods.
Rename NewAPIClient to New() and fix bare 'unauthorized' strings before opening a PR.
Refactor legacy bool flags to isConnected when extending connection pooling in a hotfix branch.
How it compares
Procedural Go naming rubric for agents—narrows style drift earlier than waiting for golint or review comments alone.
Common Questions / FAQ
Who is golang-naming for?
Solo and indie builders maintaining Go backends, CLIs, or API clients who want agents to follow constructor and error-string conventions without re-explaining rules each session.
When should I use golang-naming?
Use it in Build while scaffolding packages like apiclient, and in Ship during review passes when renaming exported types, errors, or bool fields before merge.
Is golang-naming safe to install?
It is guidance and eval assertions for code style; review the Security Audits panel on this Prism page like any third-party skill and avoid piping it secrets unrelated to naming.
SKILL.md
READMESKILL.md - Golang Naming
[ { "id": 1, "name": "new-constructor-naming", "description": "New() constructor for single primary type; error strings with package prefix; bool field is-prefix", "prompt": "Create a Go package called `apiclient` that provides an HTTP client for a REST API. The package exports a single primary type — the client struct — along with functional options, sentinel errors, and a custom error type. Include:\n\n1. The client struct with base URL, timeout, http.Client, and a boolean tracking connection state\n2. A constructor accepting a DSN-like connection string and functional options\n3. Sentinel errors for 'not found' and 'unauthorized'\n4. A custom error type wrapping the HTTP status code\n5. A method to fetch a resource by ID\n\nWrite `apiclient.go` with proper Go naming throughout.", "trap": "Model names the constructor NewClient() because the package name is apiclient and 'client' is prominent — anti-stutter means the primary type should use New(). Also likely to write 'not found' error strings without 'apiclient:' prefix, and use bare `connected bool` instead of `isConnected bool`.", "assertions": [ { "id": "1.1", "text": "Constructor is named New() not NewClient() or NewAPIClient() — the package is already called apiclient, so New() is unambiguous and avoids reading 'client' twice at the call site (apiclient.New())" }, { "id": "1.2", "text": "Sentinel error strings include the package name as prefix (e.g., 'apiclient: not found', 'apiclient: unauthorized') — bare strings like 'not found' lose origin when wrapped with fmt.Errorf" }, { "id": "1.3", "text": "The unexported boolean field uses an is/has prefix (isConnected, hasConnection) not a bare adjective (connected) — the is prefix makes it readable as a question" }, { "id": "1.4", "text": "Acronyms in exported identifiers are all-caps (URL not Url, HTTP not Http, ID not Id) — e.g., FetchByID() not FetchById(), BaseURL not BaseUrl" }, { "id": "1.5", "text": "The custom error type uses the Error suffix (e.g., APIError, ResponseError) and NOT a prefix like ErrAPIResponse" } ] }, { "id": 2, "name": "must-prefix-enum-iota", "description": "New() constructor, Status not PoolStatus (anti-stutter), IsHealthy() bool, type-prefixed enums", "prompt": "I'm building a Go package called `dbpool` for managing database connection pools. Please write the code for `pool.go` with:\n\n1. A ConnectionState enum with values: idle, active, closed, errored\n2. An interface that any database driver must implement, with methods for Connect, Ping, Close, and a method that returns whether the connection is healthy\n3. A Pool struct with fields for maximum connections, current count, and the database DSN (data source name)\n4. A constructor that accepts a DSN string and functional options\n5. Methods to get a connection from the pool and return it\n6. A method that returns the pool's current status as a JSON-serializable struct\n7. Error variables for pool exhausted, connection failed, and invalid DSN\n8. A helper that must successfully parse the DSN or panic\n9. Constants for the default pool size (10) and the max idle timeout (5 minutes)\n\nMake sure to follow Go naming best practices.", "trap": "Model uses NewPool() instead of New(), PoolStatus (stutter), bare Healthy() bool without Is prefix, Idle/Active enum values without type prefix, or bare error strings", "assertions": [ { "id": "2.1", "text": "Constructor is named New() not NewPool(), because Pool is the single primary type in the dbpool package — callers write dbpool.New()" }, { "id": "2.2", "text": "The JSON-serializable status struct is named Status (not PoolStatus) since the package is already dbpool — avoids stuttering at call site (dbpool.Status not dbpool.PoolStatus)" }, {