/go-service-guide:patternsfrom go-service-guide
Documents Go project patterns: functional options, must pattern, caching decorator, error handling, config, HTTP clients, DynamoDB key design, feature flags, and validation.
Ships in go-service-guide. 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.
References: Examples
Use With* functions for configurable constructors:
func NewClient(baseURL string, options ...ClientOption) *Client {
opts := defaultOptions()
for _, option := range options {
option(opts)
}
// create client...
}
client := NewClient(url, WithTimeout(30*time.Second), WithRetryCount(3))
Allowed only in cmd/, internal/apps/ - to fail fast on misconfiguration.
func Must[T any](f func() (T, error)) T {
v, err := f()
if err != nil { panic(err) }
return v
}
Wrap clients with cache layer for transparent caching.
| Rule | Example |
|---|---|
| Wrap with context | fmt.Errorf("get order %s: %w", id, err) |
| Check with Is/As | errors.Is(err, ErrNotFound) |
| Handle once | Don't log AND return |
| Custom errors | var ErrFoo = errors.New() or type FooError struct{} |
| Type | Path |
|---|---|
| App config | config/appconfig/{env}.json |
| Infra config | config/appconfig/infra-{env}.json |
| SSM | /myservice/{env}/app/config |
Rules: No ARNs in app config, no secrets in files, use time.Duration with custom unmarshaler
client := tracing.NewRestyClient(baseURL,
tracing.WithTimeout(30*time.Second),
tracing.WithRetryCount(3),
tracing.WithExponentialBackoff(true),
)
Use composite keys (PK + SK), GSIs for query patterns.
Fallback defaults, check at service layer, log evaluations.
Use camelCase for JSON tags and query params.
Use ozzo-validation for struct validation.
| Library | Purpose |
|---|---|
chi | HTTP router |
samber/lo | Collections/utilities |
ozzo-validation | Validation |
resty | HTTP client |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
go-patterns, functional-options, error-handling, http-client, dynamodb
npx claudepluginhub cemezgin/go-service-guide --plugin go-service-guide6 skills in this plugin
/architectureClean/hexagonal architecture rules, folder structure, interface ownership, and dependency direction. Use when creating new packages, services, or understanding codebase structure./concurrencyGoroutine ownership, errgroup patterns, worker pools, and graceful shutdown. Use when writing concurrent code or parallel request handling./go-styleUber Go style guide rules for guidelines, performance, and code style. Use when writing or reviewing Go code for style compliance./observabilityTracing with OpenTelemetry and structured logging with slog. Use when adding observability to services, handlers, or debugging production issues./testingTesting patterns including table-driven tests, mock setup, and coverage requirements. Use when writing tests or setting up test infrastructure.Other plugins' skills for the same job