spree-data-model

spree-data-model is a skill for Claude Code, Codex from spree/agent-skills. It costs 154 tokens per session (2,079 once invoked), scanned A, original, MIT.

An explanation of how Spree Commerce's main shop records relate to one another, including products, sellable versions, cart items, orders, payments, shipments, and stock.

In plain words
What is it for?
Use it when tracing catalog-to-order data, designing features, querying records, or finding how inventory, customers, stores, payments, and shipments connect.
Why use it?
It gives a clear map of the data behind a shop, which makes it easier to understand where information belongs and how a product becomes part of an order. It also reduces confusion between a cart and a completed order.

Skill for Claude CodeCodex

Part of the spree plugin — 26 skills, 2 commands, 1 agent, 2 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/spree/agent-skills/spree-data-model
Any agent
npx skills add spree/agent-skills --skill spree-data-model
Clone the repo
git clone --depth 1 https://github.com/spree/agent-skills

Made for: Claude Code, Codex.

Or install spree, the plugin that ships this one along with the rest of its 26 skills, 2 commands, 1 agent, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for spree-data-model

README.md
[![agentmods](https://agentmods.dev/badge/skills/spree/agent-skills/spree-data-model.svg)](https://agentmods.dev/skills/spree/agent-skills/spree-data-model)
Your own site
<a href="https://agentmods.dev/skills/spree/agent-skills/spree-data-model"><img src="https://agentmods.dev/badge/skills/spree/agent-skills/spree-data-model.svg" alt="Measured on agentmods" height="20"></a>
Per session 154 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,079 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00154 $0.02079
Opus 5 $0.00077 $0.01040
Sonnet 5 $0.00031 $0.00416
Haiku 4.5 $0.00015 $0.00208

Measured 5d ago against content hash 73c2d8eeace1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

spree-data-model scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/spree-data-model/SKILL.md · 155 lines

How it starts

The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Spree Data Model

A relationship map for the most-asked-about Spree models. Field-level documentation lives in the installed @spree/docs package at node_modules/@spree/docs/dist/developer/core-concepts/.

The catalog → cart pipeline

Product → Variant → LineItem → Order
  • Product is the brand-level entity (name, slug, description, category).
  • Variant is the sellable SKU. Every Product has at least one Variant. Variants carry SKU, prices, dimensions, and link to inventory.
  • LineItem links a Variant to an Order with quantity and price frozen at add-time.
  • Order is the customer's transaction — the cart-in-progress and, after checkout, the completed transaction (same record, different state).

Variants relate to stock via StockItem (one per Variant per StockLocation) and the StockMovement history.

Master vs default variant

A Product has a master variant (legacy concept, is_master: true) and a computed default_variant method: when Spree::Config[:track_inventory_levels] is on, the first purchasable variant; otherwise the first non-master variant by position; master is only the fallback when the product has no other variants. product.default_variant_id just returns that computed variant's id. Neither is a database column in 5.5 — don't query or migrate against default_variant_id (a default_variant_id FK on spree_products is planned for 6.0, implementation not started; see docs/plans/6.0-remove-master-variant.md). Use product.variants for the non-master sellable variants and product.variants_including_master only when you genuinely need the master row included.

The multi-channel / multi-store axis

Store → Channel → ProductPublication → Product

Available since Spree 5.5.

  • Store is the top-level brand (one organization = one Store, typically).
  • Channel is a selling surface within a Store: the online storefront, in-person POS, marketplace integrations (Amazon, eBay), B2B wholesale, mobile apps. Every Store has at least a default Channel named "Online Store".
  • ProductPublication is the join: which Products are visible on which Channel, with optional published_at / unpublished_at windows for scheduling.
  • Order has channel_id so revenue can be attributed per channel.

Read the full file on GitHub · 155 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 155 lines · 154 tokens per session scan A 73c2d8eeace1

Subscribe to this mod's changes

spree-data-model is a skill published in the GitHub repository spree/agent-skills (4 stars, last pushed 2mo ago), licensed MIT. It adds 154 tokens to every session and 2,079 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

postgres-commit-history-article

Analyze PostgreSQL git commit history between two commit ids and, when valuable DBA/application-developer changes exist, write a Chinese Markdown article for WeChat/公众号 readers with examples checked against SQL tests, docs, or relevant source. Use when the user is inside a PostgreSQL source checkout and provides two…

digoal/blog · 127 tokens

b2c-custom-objects

Store and query custom business data using CustomObjectMgr, OCAPI Data API, and Shopper Custom Objects API. Use this skill whenever the user needs to create, read, update, or search custom object instances, build processing queues with status fields, choose between site-scoped and organization-scoped storage, or query…

SalesforceCommerceCloud/b2c-developer-tooling · 104 tokens

b2c-querying-data

Write efficient data queries in B2C Commerce for products, customers, and orders. Use this skill whenever the user needs to search products on a storefront page, look up customer profiles, query orders, paginate search results, or fix slow category pages. Also use when they ask about performance problems with data…

SalesforceCommerceCloud/b2c-developer-tooling · 108 tokens

woocommerce-performance

Identify performance issues in WooCommerce PHP code. Use when writing or reviewing code that loads collections of post-based objects (products, orders), renders product lists with images, reads multiple options in a loop or method, or writes SQL queries involving joins, aggregates, meta lookups, or range queries.

woocommerce/woocommerce · 62 tokens

rp-mapper

Maps discovered source entities and fields to Wix targets and documents lossiness. Use when creating machine-readable mapping artifacts and review markdown after discovery.

wix/skills · 31 tokens

sfcc-caching

Unified caching playbook for SFCC (page cache vs custom cache vs service response cache). Use this when improving performance, reducing external calls, designing cache keys/TTLs, or debugging stale cache behavior.

taurgis/sfcc-dev-mcp · 46 tokens