Install any skill in seconds. Free to start, no credit card required.
Get Started Free →aiskillstore/go-best-practices
Use when reading or writing Go files (.go, go.mod).
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.
Could you write a Go example showing how to define a storage interface for a user model, along with a service function that performs a creation operation and logs events using structured key-value logging from Go's standard library?
| Checked | Without skill | With skill |
|---|---|---|
| The User struct or interface uses a dedicated custom string type for the user identifier. | Missed | Passed |
| The logging is performed using the log/slog standard library package. | Passed | Passed |
| Log calls pass key-value attribute pairs instead of formatted string templates. | Passed | Passed |
The instructions your model reads when the skill loads.
Follows type-first, functional, and error handling patterns from CLAUDE.md. This skill covers language-specific idioms only.
Use Go's type system to prevent invalid states at compile time.
Custom types for domain primitives:
// Distinct types prevent mixing up IDs
type UserID string
type OrderID string
func GetUser(id UserID) (*User, error) {
// Compiler prevents passing OrderID here
}
// Methods attach behavior to the type
func (id UserID) String() string {
return string(id)
}
Interfaces for behavior contracts:
// Define what you need, not what you have
type UserRepository interface {
GetByID(ctx context.Context, id UserID) (*User, error)
Save(ctx context.Context, user *User) error
}
// Accept interfaces, return structs
func ProcessInput(r io.Reader) ([]byte, error) {
return io.ReadAll(r)
}
Enums with iota and exhaustive switch:
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.