agentleFS
sadrmaneshsadrmanesh/commerce-agent-skills/skills/product-catalog-modeling/SKILL.md

product-catalog-modeling

Skill1 starsChanged 18 days agoMITView on GitHub

Model a sellable catalog of simple products, variants, attributes, SKUs, and stock, and check the model before importing it. Use when designing product data, variation matrices, inventory rules, or catalog imports.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill before writing import code or a product schema.

    line 13
  2. Distinctive:

    Put the price and the stock record on the purchasable unit.

    line 20
  3. Very specific:

    Run node scripts/validate-catalog.mjs --file catalog.json from this skill directory and fix every reported error before importing.

    line 21
  4. Distinctive:

    Keep option values stable.

    line 73
  5. Distinctive:

    Every SKU resolves to one purchasable unit.

    line 85
  6. Distinctive:

    After import, the storefront price and stock for one variant match that variant's record, not the parent.

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Product catalog modeling

Use this skill before writing import code or a product schema. The document checked by scripts/validate-catalog.mjs is a planning model. It is not a WooCommerce export. Map it to WooCommerce with the variation notes. An example that passes the checker is assets/example-catalog.json.

Procedure

  1. Decide the purchasable unit. A simple product is purchased as itself. A variable product is purchased as one variant. A grouped product is a collection of other products. An external product is sold somewhere else.
  2. Give every purchasable unit one SKU. SKUs are unique across the catalog, including variants.
  3. Model variation attributes as a fixed set of options. Every variant picks exactly one option for every variation attribute. Two variants cannot share a combination.
  4. Put the price and the stock record on the purchasable unit. A variable parent does not have its own price or SKU in this model.
  5. Run node scripts/validate-catalog.mjs --file catalog.json from this skill directory and fix every reported error before importing.

Document shape

{
  "products": [
    {
      "id": "shirt",
      "type": "variable",
      "sku": null,
      "name": "Cotton shirt",
      "attributes": [
        { "code": "color", "name": "Color", "options": ["blue", "red"], "variation": true }
      ],
      "variants": [
        {
          "id": "shirt-blue",
          "sku": "SHIRT-BLUE",
          "attributes": { "color": "blue" },
          "price": "19.00",
          "currency": "USD",
          "stock": { "managed": true, "quantity": 4, "backorders": "no", "status": "instock" }
        }
      ]
    }
  ]
}

Rules the checker enforces:

  • type is simple, variable, external, or grouped.
  • price is a major-unit string with two decimal places, such as "19.00". currency is an ISO 4217 code. Map to the store's decimal setting at the boundary. Do not send this string through a binary float.
  • Simple and external products require sku, price, and currency. External products also require productUrl.
  • Variable products require sku: null, no parent price, at least one attribute with "variation": true, and at least one variant. Each variant sets exactly those attributes.
  • Grouped products list children ids and do not carry a price.
  • stock.managed: true requires an integer quantity of zero or more. stock.managed: false requires quantity: null. backorders is no, notify, or yes.
  • Optional stock.status is instock, outofstock, or onbackorder. When quantity is managed, status should agree with quantity and backorders. The checker does not infer status for you.

Inventory rules

  • Managed stock is a quantity you decrement on paid orders and restore on cancel or refund, using the platform's stock API once.
  • Unmanaged stock is a status you set by hand (instock or outofstock). Do not also store a quantity.
  • Backorders mean you accept orders at zero. notify shows the shopper that the item is on backorder. yes allows it quietly. no stops the sale at zero.
  • A variable parent's availability is the rollup of its variants. Do not maintain a second parent quantity that can disagree with the variants.
  • Reservation during checkout, when the platform holds stock for unpaid orders, is part of available-to-sell. Do not subtract that hold a second time in your importer.

Attributes

  • A variation attribute changes the purchasable unit (size, color). It belongs in attributes with variation: true and on each variant.
  • A descriptive attribute (material, care) is not a variant axis. Store it with variation: false or as content. Do not create a variant per descriptive value.
  • Keep option values stable. Translate the display label, not the option code. The search skill depends on stable facet ids.

Gotchas

  • A parent price range is derived from variants. Writing a parent price and different variant prices hides which amount will be charged.
  • Duplicate SKUs across a simple product and a variant make stock and fulfillment ambiguous.
  • Cartesian explosions are real. Three attributes with ten options are a thousand variants. Split the product or drop an axis before generating them.
  • Currency is a property of the price, not of the shopper's browser. A multi-currency display converts from the stored currency. It does not create a second SKU.

Verification

  • The checker exits 0 on the catalog file.
  • Every SKU resolves to one purchasable unit.
  • A variant combination that is not for sale is absent, not stored with a blank price.
  • After import, the storefront price and stock for one variant match that variant's record, not the parent.

Evaluation

Worked examples and the checks they must satisfy are in evals/tasks.json.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.