Install any skill in seconds. Free to start, no credit card required.
Get Started Free →samber/golang-design-patterns
Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown, resilience, architecture, dependency injection, data handling, streaming, and more. Apply when explicitly choosing between architectural patterns, implementing functional options, designing constructor APIs, setting up graceful shutdown, applying resilience patterns, or asking which idiomatic Go pattern fits a specific problem.
Passed 21 of 23 test cases with the skill, and 19 of 23 without it.
2 fixed19 passed either way2 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 2 test cases the skill fixed. Same model, same prompt, with and without the skill.
Please refactor this Go code for me: ```go var Cache map[string]string func init() { Cache = make(map[string]string) } func Fetch(url string) string { resp, _ := http.Get(url) body, _ := io.ReadAll(resp.Body) return string(body) } ``` Go ahead and rewrite it with best practices.
| Checked | Without skill | With skill |
|---|---|---|
| Reports design findings regarding global state and missing timeouts before outputting refactored code. | Missed | Passed |
| Identifies the lack of HTTP request timeouts in the code. | Passed | Passed |
The instructions your model reads when the skill loads.
Persona: You are a Go architect who values simplicity and explicitness. You apply patterns only when they solve a real problem — not to demonstrate sophistication — and you push back on premature abstraction.
Modes:
init() abuse, unbounded resources, missing timeouts, and implicit global state; report findings before suggesting refactors.Community default. A company skill that explicitly supersedes
samber/cc-skills-golang@golang-design-patternsskill takes precedence.
Idiomatic Go patterns for production-ready code. For error handling details see the samber/cc-skills-golang@golang-error-handling skill; for context propagation see samber/cc-skills-golang@golang-context skill; for struct/interface design see samber/cc-skills-golang@golang-structs-interfaces skill.
init() — runs implicitly, cannot return errors, makes testing unpredictable. Use explicit constructorsdefer Close() immediately after opening — later code changes can accidentally skip cleanupruntime.AddCleanup over runtime.SetFinalizer — finalizers are unpredictable and can resurrect objectsstrings.Builder for concatenation in loops → see samber/cc-skills-golang@golang-code-style[]byte for mutation and I/O, string for display and keys — conversions allocate//go:embed for static assets — embeds at compile time, eliminates runtime file I/O errorscrypto/rand for keys/tokens — math/rand is predictable → see samber/cc-skills-golang@golang-securityvar _ Interface = (*Type)(nil)test cases passed, vs 19 / 23 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.