spree-catalog

Build and customize Spree's catalog — Products with Variants and OptionTypes/OptionValues, Taxonomies and Taxons (nested set), Properties, Images via ActiveStorage, multi-currency Prices, the v5.3+ PriceList feature for customer/segment overrides, MeiliSearch faceted search (v5.4+), product archiving/activation, CSV import/export, and SEO. Use when modeling products, customizing the catalog UI, indexing search, or importing inventory.

17 stars

Best use case

spree-catalog is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build and customize Spree's catalog — Products with Variants and OptionTypes/OptionValues, Taxonomies and Taxons (nested set), Properties, Images via ActiveStorage, multi-currency Prices, the v5.3+ PriceList feature for customer/segment overrides, MeiliSearch faceted search (v5.4+), product archiving/activation, CSV import/export, and SEO. Use when modeling products, customizing the catalog UI, indexing search, or importing inventory.

Teams using spree-catalog should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/spree-catalog/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/spree-commerce/.agent/skills/spree-catalog/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/spree-catalog/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How spree-catalog Compares

Feature / Agentspree-catalogStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build and customize Spree's catalog — Products with Variants and OptionTypes/OptionValues, Taxonomies and Taxons (nested set), Properties, Images via ActiveStorage, multi-currency Prices, the v5.3+ PriceList feature for customer/segment overrides, MeiliSearch faceted search (v5.4+), product archiving/activation, CSV import/export, and SEO. Use when modeling products, customizing the catalog UI, indexing search, or importing inventory.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Spree Catalog

## Before writing code

**Fetch live docs**:
1. Fetch https://spreecommerce.org/docs/developer/core-concepts/architecture — catalog model graph.
2. Web-search `spree meilisearch faceted search v5.4` for the current search backend wiring.
3. Inspect the live `Spree::Product` / `Spree::Variant` source for column names — they shift between minors.
4. Check the latest release notes for any new catalog features (CSV importer scope, Page Builder Product Details Page sections, etc.).
5. For PriceList specifics, fetch the latest pricing-related guide on spreecommerce.org/docs.

## Conceptual Architecture

### Product vs Variant

- **`Product`** — the catalog entity (T-shirt, novel, subscription box). Has a `master_variant`.
- **`Variant`** — the sellable SKU. Even simple products have one master variant; products with options have additional variants per OptionValue combination.

A Variant has:
- A unique SKU
- One `StockItem` per `StockLocation`
- One `Price` per currency
- Zero or more `OptionValue`s defining its position on the option axes

### OptionTypes and OptionValues

```
OptionType: size
  OptionValues: small, medium, large
OptionType: color
  OptionValues: red, blue, black
```

A T-shirt product with `[size, color]` option types has 3 × 3 = 9 variants (or fewer if some combos are unavailable).

### Taxonomies and Taxons

A **Taxonomy** is a category tree (e.g., "Categories", "Collections"). A **Taxon** is a node in that tree using `acts_as_nested_set` (or `awesome_nested_set`). Products are tagged with many Taxons via `Spree::Classification`.

```
Taxonomy: Categories
  ├── Taxon: Apparel
  │     ├── Taxon: Shirts
  │     └── Taxon: Pants
  └── Taxon: Accessories
```

### Properties

Free-form attribute table:
```
Product → ProductProperty(property: Property("Material"), value: "Cotton")
```

Properties show up on the storefront's spec table. Distinct from `Metafield` — properties are user-visible product details; metafields are typically internal custom data.

### Images

Spree uses **ActiveStorage** for images attached to `Variant`s and `Product`s. Variant-level images override product-level for that specific SKU. Image variants (resizing) are computed lazily by ActiveStorage with `libvips` / ImageMagick.

### Pricing Model

- One `Price` row per `(Variant, Currency)`.
- `PriceList` (v5.3+) lets you define an override list scoped to a CustomerGroup, Country, or Store. The pricing resolver picks the right price by precedence: user's CustomerGroup → Store's PriceList → default Price.

### Multi-Currency

Activate currencies on the Store; create one `Price` per Variant per Currency. The storefront and APIs select the right Price based on `Store#default_currency` or the user's selected currency.

### Search Backends

| Backend | Notes |
|---------|-------|
| **MeiliSearch** (v5.4+, recommended) | Faceted, typo-tolerant, fast |
| **Algolia** (community gem) | Hosted, mature |
| **PostgreSQL full-text** | Fallback / dev |

The v5.4 `spree` gem wires MeiliSearch by default when the env vars are present.

### Product Lifecycle

| Event | Cause |
|-------|-------|
| `product.activate` | Product made available |
| `product.archive` | Product hidden (not deleted — preserves order history) |
| `product.out_of_stock` | Inventory hit zero |
| `product.back_in_stock` | Inventory restored |

Use **archive** instead of destroy — preserves order history.

### CSV Import/Export

v5.0+ ships CSV import/export for products, customers, orders. Background-job-driven (Sidekiq), reports errors per row.

## Implementation Guidance

### Creating a Product Programmatically

```ruby
product = Spree::Product.create!(
  name: 'Classic Tee',
  description: '100% cotton',
  price: 19.99,
  shipping_category: Spree::ShippingCategory.first,
  tax_category: Spree::TaxCategory.find_by(name: 'Clothing'),
  available_on: Time.current,
  stores: [Spree::Store.default]
)
```

Then add option types, option values, and variants:

```ruby
size = Spree::OptionType.create!(name: 'tshirt-size', presentation: 'Size')
size.option_values.create!([
  { name: 'small', presentation: 'S' },
  { name: 'medium', presentation: 'M' },
  { name: 'large', presentation: 'L' }
])

product.option_types << size

product.variants.create!(
  sku: 'TEE-S',
  option_values: [size.option_values.find_by(name: 'small')],
  price: 19.99
)
```

### Tagging Products to Taxons

```ruby
taxon = Spree::Taxon.find_by(name: 'Shirts')
product.taxons << taxon
```

### Reading Prices Across Currencies

```ruby
product.master.price_in('USD').amount  # 19.99
product.master.price_in('EUR').display_price  # "€18.50"
```

### Variant-Aware Pricing With PriceList (v5.3+)

```ruby
price = Spree::Pricing::PriceFinder.new(
  variant: variant, store: store, user: user, currency: 'USD'
).call
```

Verify the exact service class name in the version you're on.

### Search Indexing

MeiliSearch indexing is event-driven — `product.updated`, `product.activate`, etc., enqueue background jobs. Force reindex:

```bash
bin/rails spree:search:reindex
```

Verify the exact rake task name in the current release.

### CSV Import

```bash
bin/rails console
> Spree::ImportCsvJob.perform_later('products', file_path: '/path/to/products.csv')
```

Or via admin: Products → Import. Verify the job class name in the live code.

### Storefront Product Page

In the Next.js storefront, the product page is built from API v3 calls:

```typescript
// Server component
const product = await spree.products.find(slug, { include: 'variants,images,taxons' });
```

(Pseudo — verify against `@spree/sdk` docs.)

### Common Pitfalls

- **Destroying products instead of archiving** — breaks order history and reports.
- **Forgetting per-currency Prices** — variants without a Price in the current currency become invisible.
- **Adding option types after variants exist** — new option types invalidate existing variant uniqueness; either rebuild variants or use a migration script.
- **Reindex storms** — bulk updates fire many `product.updated` events; throttle the search-indexing subscriber for batch operations.
- **Master variant edits not reflecting on storefront** — caches. Bust with `Spree::Cache.clear` or version-bumped cache keys.

Always verify model relationships and column names against the live `spree` gem source — catalog modeling evolves more than the order graph.

Related Skills

woo-catalog

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with WooCommerce catalog — product types, categories, tags, attributes, product queries, search, related products, and product visibility. Use when managing products programmatically or customizing the catalog display.

spree-upgrades

17
from OrcaQubits/agentic-commerce-skills-plugins

Upgrade a Spree application — version-to-version migration paths (v4 → v5 is a major rewrite; v5.x → v5.y are simpler), Gemfile pinning strategy, decorator brittleness across versions, deprecated gems to remove (`spree_auth_devise`, `deface`, `spree_backend`), API v2 → v3 migration via `spree_legacy_api_v2`, admin Bootstrap → Tailwind transition, the upgrade guide workflow, and rollback strategy. Use when planning a Spree upgrade or auditing technical debt blocking one.

spree-typescript-sdk

17
from OrcaQubits/agentic-commerce-skills-plugins

Build storefronts and integrations using `@spree/sdk` — the official TypeScript SDK for Spree's API v3 (v5.4+). Covers installation, the resource-builder pattern (`spree.products.list`, `spree.checkout.create`, etc.), Zod schema validation, server-only auth (httpOnly JWTs, never exposing API keys), error handling, typing customizations, and pinning SDK versions to backend Spree releases. Use when integrating Spree into a Next.js / Node.js / TypeScript project.

spree-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Spree applications and extensions with RSpec — `spree_dev_tools` gem (v5.2+) for factories and helpers, FactoryBot patterns (prefer `build` over `create`), Capybara feature specs, controller/request specs, testing decorators and subscribers, dummy app for extension testing, system specs for the Hotwire admin, and CI patterns. Use when writing Spree tests, setting up CI, or refactoring slow specs.

spree-shipping-fulfillment

17
from OrcaQubits/agentic-commerce-skills-plugins

Build and customize Spree's shipping and fulfillment — ShippingMethod, ShippingCategory, Zone/ZoneMember, ShippingRate, the Stock::Estimator service, StockLocation/StockItem/StockMovement, multi-shipment orders, ShippingCalculator classes (FlatRate, FlatPercentItemTotal, PerItem, FlexiRate), shipment state machine, returns (ReturnAuthorization → CustomerReturn → Reimbursement → Refund), and integrating carrier APIs (UPS, FedEx, ShipStation). Use when configuring shipping rules, building fulfillment integrations, or debugging shipping-rate calculations.

spree-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Bootstrap a new Spree project — `create-spree-app` CLI (v5.2+), `spree-starter` Rails backend, the Next.js storefront repo, `bin/rails g spree:install`, sample data, Docker Compose, and the PostgreSQL + Redis + Sidekiq prerequisites. Use when starting a new Spree project from scratch or onboarding an existing repo.

spree-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Secure a Spree deployment — Rails credentials and env-var hygiene, Devise auth (Spree v5 ships it in-core; `spree_auth_devise` is archived), CanCanCan authorization rules, Doorkeeper OAuth2 scopes, Storefront publishable key vs admin API key, webhook HMAC verification, OWASP Top 10 for Rails (mass assignment, CSRF, SQL injection via Ransack, XSS, IDOR through prefixed IDs), PCI scope (Spree never touches raw cards thanks to gateway tokenization), and multi-store data isolation. Use when auditing a Spree app, hardening a deploy, or addressing a security incident.

spree-promotions

17
from OrcaQubits/agentic-commerce-skills-plugins

Build and customize Spree's promotions engine — Promotion + PromotionRule + PromotionAction + CouponCode + Adjustment, the bundled rules (FirstOrder/ItemTotal/Product/Taxon/User/OneUsePerUser/Country/CustomerGroup/etc.), bundled actions (CreateAdjustment/CreateItemAdjustments/FreeShipping/CreateLineItems), Calculator classes, coupon batches with CSV export, the v5.1+ advanced rule-based engine, and authoring custom rules/actions/calculators. Use when modeling promotions, building discount UIs, or extending the promotions engine.

spree-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Profile and optimize a Spree application — N+1 queries with bullet/scout, database indexing strategy for Spree's polymorphic associations, Rails fragment + Russian doll caching, ActiveStorage variant pre-generation, Sidekiq queue tuning, MeiliSearch vs Postgres FTS tradeoffs, Puma worker/thread sizing, CDN strategy for catalog pages, asset precompile time, and load testing. Use when Spree is slow, the database is hot, or you're preparing for a traffic spike (Black Friday, launch).

spree-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Integrate payment gateways with Spree — PaymentMethod model, the v5.4+ PaymentSession provider-agnostic checkout flow, Stripe via `spree_stripe` (Apple/Google Pay, Link, Connect for marketplaces), Adyen via `spree_adyen`, PayPal via `spree_paypal_checkout`, StoreCredit / GiftCard as payment methods, refunds, payment state machine, and authoring a custom gateway. Use when wiring a payment integration, handling webhooks from a gateway, or debugging payment-state issues.

spree-multi-store

17
from OrcaQubits/agentic-commerce-skills-plugins

Configure Spree for multi-store and multi-region commerce — one Rails install running many `Store` records, the v5.4+ `Market` model (currency + locale + payment methods + shipping per region), what's shared vs per-store (products+inventory+customers shared; orders+payments+themes per-store), the Marketplace module (Enterprise — vendors/commission/payouts via Stripe Connect), and the Multi-tenant SaaS model. Use when planning a multi-brand or multi-region Spree deployment.

spree-legacy-api-v2

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with Spree's legacy v2 APIs — JSON:API-style Storefront API at `/api/v2/storefront/*` and Platform API at `/api/v2/platform/*`, Doorkeeper OAuth2 (password grant for storefront, client_credentials + admin scope for platform), the `spree_legacy_api_v2` gem (required in v5+ for backward compatibility), and migration patterns to API v3. Use when maintaining a v2 client during a migration window, integrating an older partner system, or deciding when to cut over to v3.