Enforces Go coding standards and style conventions based on Effective Go and Go Code Review Comments. Covers import ordering, variable declarations, struct initialization, receivers, struct tags, and formatting rules. Use when writing or reviewing Go code.
Ships in go-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Idiomatic Go conventions grounded in Effective Go, Go Code Review Comments, and production-proven idioms.
All code MUST pass goimports, go vet, and staticcheck (or golangci-lint run) without errors.
Community default. A project skill or agent-config rule that explicitly supersedes
go-coding-standardstakes precedence over this one.
Detailed reference material, loaded on demand:
references/file-organization.md — declaration grouping, file order,
breaking long signatures.references/receivers-and-tags.md — receiver consistency and struct tag
examples.Read a reference file only when the summary below is not enough.
Group imports in this order, separated by blank lines:
import (
// 1. Standard library
"context"
"fmt"
"log/slog"
"net/http"
// 2. External packages
"github.com/gorilla/mux"
// 3. Internal/project packages
"github.com/myorg/myproject/internal/service"
)
NEVER use dot imports. Use aliasing only to resolve conflicts.
Naming is owned by the go-naming skill: packages, stuttering, initialisms,
getters, receivers, error and test names. Two rules stay here because they
are about declarations: do not shadow predeclared identifiers (len,
new, error, min, max), and unexported package-level variables may
carry a _ prefix (_defaultTimeout) when the codebase uses that
convention.
Use var for top-level declarations. Do NOT specify type when it matches the expression:
// ✅ Good
var _defaultPort = 8080
var _logger = slog.Default()
// ❌ Bad — redundant type
var _defaultPort int = 8080
:= for local variables.var only when zero-value initialization is intentional and meaningful.// ✅ Good — zero value is meaningful
var buf bytes.Buffer
// ✅ Good — short declaration
name := getUserName()
ALWAYS use field names, and omit zero-value fields unless they carry meaning — positional literals break silently when fields are added or reordered:
// ✅ Good
user := User{Name: "Alice", Email: "[email protected]"}
// ❌ Bad — positional
user := User{"Alice", "[email protected]", 0}
Handle errors and special cases first with early returns, so the happy
path stays at the left margin. Drop an else whose if already returns,
and prefer assign-default-then-override:
// ✅ Good — guard clauses; no else
for _, v := range data {
if !v.IsValid() {
continue
}
if err := v.Process(); err != nil {
return fmt.Errorf("process %s: %w", v.ID, err)
}
}
a := 10 // default, then override
if condition {
a = 20
}
const and var declarations in one parenthesized block.Soft limit of 99 characters. Break a long signature one parameter per
line, closing parenthesis on its own line. Examples:
references/file-organization.md.
Use defer for cleanup. It makes intent clear at the point of acquisition:
mu.Lock()
defer mu.Unlock()
f, err := os.Open(path)
if err != nil {
return fmt.Errorf("open %s: %w", path, err)
}
defer f.Close() // read-only; check Close errors on files you write
Reserve the zero value for an explicit Unknown sentinel, so a value that
was never set cannot pass for a real state:
type Status int
const (
StatusUnknown Status = iota
StatusActive
StatusInactive
)
time Package Properlytime.Duration for durations, NOT raw integers.time.Time for instants. Use time.Since(start) instead of time.Now().Sub(start).time.Duration (JSON, YAML), put the unit
in the field name — TimeoutSeconds int — and convert at the edge.// ✅ Good
func poll(interval time.Duration) { ... }
poll(10 * time.Second)
// ❌ Bad
func poll(intervalSecs int) { ... }
poll(10)
Pick one receiver kind per type and use it on every method — a mixed
method set changes with how the value is held. Use a pointer receiver if
any method mutates, the struct holds a sync.Mutex or other no-copy
field, the struct is large, or another method already needs a pointer.
Use a value receiver for small immutable types. Name the receiver one or
two letters after the type (s *Server), the same on every method, never
this or self. Examples: references/receivers-and-tags.md.
The compiler does not check tags, so a typo is silent.
json:"-" for anything that must never leave the process — an
unexported field is skipped silently, which reads as an oversight.omitempty cannot tell "absent" from "zero"; use a pointer or wrapper
when that distinction matters. omitempty never omits a struct — use
omitzero (Go 1.24+), which honors the Go zero value and IsZero(), for
fields like time.Time.go vet — its structtag check catches malformed tags.isOwner,
isAdmin) so the if reads as the business rule.ctx context.Context first, then inputs, then options.Before considering code complete:
goimports runs cleango vet ./... passesgolangci-lint run passes (if configured)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/go-agent-skills:go-coding-standardsfrom go-agent-skills
npx claudepluginhub eduardo-sl/go-agent-skills --plugin go-agent-skills35 skills in this plugin
/git-commitStructured git commit messages following Conventional Commits format for Go projects. Generates well-scoped, atomic commits with clear descriptions. Use when committing changes, writing commit messages, preparing PRs, or reviewing commit history quality. Trigger examples: "commit these changes", "create commit", "commit message", "prepare PR", "squash commits". Not for: code review (go-code-review), changelog generation.
/go-api-designHTTP/REST API design for Go services: handlers, ServeMux routing, middleware, request validation, pagination, idempotency, health checks, error responses, and graceful shutdown. Use when designing APIs, writing HTTP handlers, implementing middleware, or structuring REST endpoints. Trigger examples: "design API", "REST endpoints", "HTTP handler", "middleware pattern", "graceful shutdown", "API versioning". Not for: gRPC services (go-grpc), spec-first OpenAPI work (go-openapi), general architecture (go-architecture-review), concurrency in handlers (go-concurrency-review).
/go-architecture-reviewReview Go project architecture: package structure, dependency direction, layering, separation of concerns, domain modeling, and module boundaries. Use when reviewing architecture, designing package layout, evaluating dependency graphs, or refactoring monoliths into modules. Trigger examples: "review architecture", "package structure", "project layout", "dependency direction", "clean architecture Go", "module boundaries". Not for: code-level style (go-coding-standards), endpoint design (go-api-design).
Other plugins' skills for the same job