agentsclimarketplace

Go

Skill cocart-headless/cocart-skills/skills/go

A collection of skills for AI coding agents. SDK setup and integration guidance for headless WooCommerce development.

Install
npx -y skills add cocart-headless/cocart-skills --skill go

Assembled 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

  1. Forgetting context.Background() — Every SDK call requires a context.Context as the first argument. Always pass ctx or a request-scoped context.
  2. Not checking errors — Go SDK returns (response, error) tuples. Always handle the error before accessing response fields.
  3. Using Go < 1.23 — The paginator uses iter.Seq2 range-over-func which requires Go 1.23+. Older versions will fail to compile.
  4. 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

WordPress / WooCommerce Requirements

What ships with it: 3 files

5.4 KB alongside SKILL.md

references/

Keep looking

Skills are one crate of 326,984. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.