Go
A collection of skills for AI coding agents. SDK setup and integration guidance for headless WooCommerce development.
npx -y skills add cocart-headless/cocart-skills --skill goAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
CoCart Go SDK patterns for headless WooCommerce. Use when setting up CoCart in Go projects using net/http, Gin, Echo, Fiber, or any Go HTTP framework.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.7 KB, 760 tokens by cl100k_base, as published. Nobody here has run it
CoCart Go SDK Skill
You are an expert in the CoCart Go SDK (cocart-headless/cocart-go). When a user adds "use CoCart" to a prompt and their project is Go-based, apply this skill.
Note: The Go SDK is still in development and not yet production-ready. Mention this when relevant and encourage users to report bugs.
Installation
go get github.com/cocart-headless/cocart-sdk-go
Requirements: Go 1.23+ (required for iter.Seq2 range-over-func used by the paginator). Zero external dependencies — uses only the Go standard library.
Quick Start
package main
import (
"context"
"fmt"
"log"
cocart "github.com/cocart-headless/cocart-sdk-go"
)
func main() {
ctx := context.Background()
client := cocart.NewClient("https://your-store.com")
// Browse products (no auth required)
products, err := client.Products().All(ctx, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println("Products:", string(products.Body))
// Add to cart (guest session created automatically)
response, err := client.Cart().AddItem(ctx, 123, 2)
if err != nil {
log.Fatal(err)
}
fmt.Println("Added item:", response.Get("item_key", ""))
}
Configuration Options
client := cocart.NewClient(
"https://your-store.com",
cocart.WithCartKey("existing_cart_key"),
cocart.WithBasicAuth("[email protected]", "password"),
cocart.WithJWTToken("your-jwt-token"),
cocart.WithWooCommerceKeys("ck_xxxxx", "cs_xxxxx"),
cocart.WithTimeout(15 * time.Second),
cocart.WithMaxRetries(2),
cocart.WithRESTPrefix("wp-json"),
cocart.WithNamespace("cocart"),
cocart.WithETag(true),
cocart.WithDebug(true),
)
Common Mistakes
- Forgetting
context.Background()— Every SDK call requires acontext.Contextas the first argument. Always passctxor a request-scoped context. - Not checking errors — Go SDK returns
(response, error)tuples. Always handle the error before accessing response fields. - Using Go < 1.23 — The paginator uses
iter.Seq2range-over-func which requires Go 1.23+. Older versions will fail to compile. - Ignoring the second return from
Get()—cart.Get("totals.total", "")takes a default value. Don't discard it or you'll get empty strings silently.
When to Load References
- Configuring authentication (guest, Basic Auth, consumer keys, JWT) → references/authentication.md
- Working with cart operations (add, update, remove, coupons, currency) → references/cart.md
- Querying products (list, search, filter, pagination) → references/products.md
WordPress / WooCommerce Requirements
- WooCommerce installed and active
- CoCart plugin installed (free tier available)
- CoCart Plus for advanced features
- Optional: CoCart JWT Authentication for JWT auth
What ships with it: 3 files
5.4 KB alongside SKILL.md
references/
- authentication.md967 B
- cart.md2.7 KB
- products.md1.8 KB