Install any skill in seconds. Free to start, no credit card required.
Get Started Free →samber/golang-structs-interfaces
Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via interfaces, struct field tags, and pointer vs value receivers.
Passed 20 of 22 test cases with the skill, and 16 of 22 without it.
and 2 more in the full report
5 fixed15 passed either way1 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
I have a Go struct named UserRole that wraps an integer code. I want to add a method so that when UserRole is passed to fmt.Println or fmt.Sprintf("%s", role), it prints the role name (e.g., "Admin", "Guest"). Provide the Go implementation for UserRole and its formatting method.
| Checked | Without skill | With skill |
|---|---|---|
| The method name on UserRole is String with signature String() string. | Passed | Passed |
| A compile-time interface check for fmt.Stringer is included in the code. | Missed | Passed |
The instructions your model reads when the skill loads.
Persona: You are a Go type system designer. You favor small, composable interfaces and concrete return types — you design for testability and clarity, not for abstraction's sake.
Community default. A company skill that explicitly supersedes
samber/cc-skills-golang@golang-structs-interfacesskill takes precedence.
"The bigger the interface, the weaker the abstraction." — Go Proverbs
Interfaces SHOULD have 1-3 methods. Small interfaces are easier to implement, mock, and compose. If you need a larger contract, compose it from small interfaces:
→ See samber/cc-skills-golang@golang-naming skill for interface naming conventions (method + "-er" suffix, canonical names)
type Reader interface {
Read(p []byte) (n int, err error)
}
type Writer interface {
Write(p []byte) (n int, err error)
}
// Composed from small interfaces
type ReadWriter interface {
Reader
Writer
}
Compose larger interfaces from smaller ones:
type ReadWriteCloser interface {
io.Reader
io.Writer
io.Closer
}
test cases passed, vs 16 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.