Install any skill in seconds. Free to start, no credit card required.
Get Started Free →xu-xiang/golang-patterns
编写稳健、高效且易于维护的 Go 应用程序的惯用模式、最佳实践和约定。
Passed 22 of 23 test cases with the skill, and 21 of 23 without it.
1 fixed21 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
A test case the skill fixed. Same model, same prompt, with and without the skill.
I need to fetch several URLs concurrently in Go and cancel all remaining HTTP requests if any single fetch returns an error. I am thinking of writing manual goroutines with custom error channels and atomic boolean flags for cancellation. What standard extended library package pattern simplifies this?
| Checked | Without skill | With skill |
|---|---|---|
| Uses golang.org/x/sync/errgroup for managing concurrent operations with cancellation. | Passed | Passed |
| Captures loop variables inside the iteration before passing them into goroutine closures. | Missed | Passed |
The instructions your model reads when the skill loads.
用於建構穩健、高效且可維護應用程式的慣用 Go 模式和最佳實務。
Go 偏好簡單而非聰明。程式碼應該明顯且易讀。
// 良好:清晰直接
func GetUser(id string) (*User, error) {
user, err := db.FindUser(id)
if err != nil {
return nil, fmt.Errorf("get user %s: %w", id, err)
}
return user, nil
}
// 不良:過於聰明
func GetUser(id string) (*User, error) {
return func() (*User, error) {
if u, e := db.FindUser(id); e == nil {
return u, nil
} else {
return nil, e
}
}()
}
test cases passed, vs 21 / 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.