Token导航 LogoToken导航

Agent Skill · 前端设计

variant-matrix(变体矩阵)

variant-matrix 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

variant-matrix 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 6,634。

总安装 475周安装 20GitHub Stars 19下载 166核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:variant-matrix(变体矩阵)
来源仓库:https://github.com/finsilabs/awesome-ecommerce-skills
仓库路径:skills/variant-matrix
安装命令:
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill variant-matrix
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill variant-matrix

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

variant-matrix 用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。它适合围绕代码变更、仓库状态或协作事项进行整理。通过 npx skills add 命令从指定 GitHub 仓库安装并使用。安装前建议确认权限范围和是否会触发文件读写操作。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/variant-matrix

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill var…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

variant-matrix 怎么安装?

在终端执行 npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill variant-matri…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

variant-matrix 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

variant-matrix 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

variant-matrix 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

variant-matrix 用的人多吗?

公开数据是累计安装 475 次,近一周安装 20 次,下载 166 次,GitHub 19 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

variant-matrix 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
variant-matrix

变体矩阵 · 本页

47519只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Variant Matrix

Overview

Product variants let one product listing cover all size/color/material combinations — each with its own price, SKU, and inventory. Platforms generate the full matrix of combinations from your option values and handle the variant selector UI automatically. The main tasks are: entering options correctly, generating all SKUs, setting per-variant pricing and inventory, and managing large matrices efficiently.

When to Use This Skill

  • When modeling apparel, footwear, or accessories where products have multiple option axes
  • When importing products from a supplier CSV with flat variant rows that need to be grouped
  • When building an admin interface for merchants to manage variant pricing and inventory
  • When a variant selector on the product page needs to disable unavailable combinations

Core Instructions

Step 1: Determine platform and understand the variant model

PlatformOptionsMax VariantsVariant Fields
ShopifyUp to 3 options (e.g., Size, Color, Style)100 per productPrice, SKU, barcode, inventory, weight, image
WooCommerceUnlimited attributes used as variationsPractically unlimited (performance degrades at ~50+)Price, sale price, SKU, stock, weight, dimensions, image
BigCommerceUnlimited options per product600 SKUs per productPrice adjustment, SKU, stock, weight, image
Custom / HeadlessDesign your ownUnlimitedDesign your own variant fields

Step 2: Platform-specific variant setup


Shopify

Creating variants from options:

  1. Go to Admin → Products → [Product]
  2. Scroll to the Options section
  3. Click Add option to add the first axis (e.g., Size)
  4. Enter the option values: XS, S, M, L, XL
  5. Add a second option (e.g., Color): Red, Blue, Black
  6. Shopify generates all combinations automatically (5 × 3 = 15 variants)
  7. Scroll to the Variants section to see the generated matrix

Setting per-variant details:

  • Click any variant row to edit its price, SKU, inventory, weight, and image
  • Or use Edit variants bulk view to update multiple variants at once

Bulk variant management:

  • Select multiple variants using checkboxes → Edit to update price or inventory for a group
  • For large catalogs: use Matrixify (App Store) to import a CSV with one row per variant — the most efficient way to set up a large matrix

Disabling unavailable combinations:

  • Variants that have no inventory automatically show "Sold Out" on the product page
  • Shopify's variant selector does not auto-disable unavailable combinations by default — most themes require adding logic or using a theme app to grey out sold-out options

Adding/removing option values after launch:

  • Add a new size (e.g., "XXL"): go to the Options section, add the value
  • Shopify adds new variants for the new value; existing variants are unchanged
  • Archive discontinued variants instead of deleting — deletion removes order history links

WooCommerce

Creating variations from attributes:

  1. Create global attributes: Products → Attributes → Add Attribute (e.g., Size with values XS, S, M, L, XL)
  2. On your product, go to the Attributes tab
  3. Select your attribute (Size), check Used for variations, click Add
  4. Add all values this product uses
  5. Go to the Variations tab
  6. Click Generate variations → WooCommerce creates one variation per combination
  7. Expand each variation to set price, SKU, stock, and image

Bulk variation updates:

  • WooCommerce's variation editor can be slow for products with 20+ variations
  • Use WP All Import Pro for importing large variation matrices via CSV
  • Or use the Variable Product Bulk Edit plugin for batch price/inventory updates

SKU generation: WooCommerce doesn't auto-generate SKUs. Enter them manually or use a pattern:

  • Convention: [PRODUCT-CODE]-[SIZE]-[COLOR] → e.g., SHIRT-M-RED
  • Use WP All Import to set SKUs in bulk from a spreadsheet

BigCommerce

Creating options and variants:

  1. Go to Products → [Product] → Variations tab
  2. Click Create options and add your option set (Size, Color, etc.)
  3. BigCommerce generates the matrix of SKUs automatically
  4. Click any SKU row to set:

- Price adjustment (e.g., +$5 for XL) - SKU code - Stock quantity - Image

Option Sets:

  • Go to Products → Option Sets to create reusable option groups
  • Create a "Clothing Sizes" option set with XS–3XL once, then assign it to all apparel products
  • Saves significant time when managing large catalogs

Bulk SKU management:

  • Go to Products → Import & Export to export the catalog with all variant SKUs
  • Edit in Excel and re-import for bulk price/inventory/SKU updates

Custom / Headless

Build variant generation from Cartesian product of options, with diff logic to safely update existing catalogs:

// lib/variantMatrix.ts

// Generate all variant combinations from option value arrays
// Input:  [['S','M','L'], ['Red','Blue']]
// Output: [['S','Red'], ['S','Blue'], ['M','Red'], ['M','Blue'], ['L','Red'], ['L','Blue']]
export function cartesianProduct(arrays: string[][]): string[][] {
  return arrays.reduce(
    (acc, values) => acc.flatMap(combo => values.map(v => [...combo, v])),
    [[]] as string[][]
  );
}

// Generate variant records with auto-generated SKUs
export function generateVariants(baseSku: string, optionNames: string[], optionValues: string[][]) {
  const combinations = cartesianProduct(optionValues);
  return combinations.map(combo => ({
    sku: [baseSku, ...combo].join('-').toUpperCase().replace(/\s+/g, '-'),
    options: Object.fromEntries(optionNames.map((name, i) => [name, combo[i]])),
    price: null,       // Set individually or via bulk rule
    inventoryQuantity: 0,
    published: true,
  }));
}

// Compute what to create vs. archive when option values change
export function diffVariants(
  existingVariants: { options: Record<string, string> }[],
  newCombinations: string[][],
  optionNames: string[]
) {
  const existingKeys = new Set(existingVariants.map(v => optionNames.map(n => v.options[n]).join('|')));
  const newKeys = new Set(newCombinations.map(c => c.join('|')));

  const toCreate = newCombinations.filter(combo => !existingKeys.has(combo.join('|')));
  const toArchive = existingVariants.filter(v => !newKeys.has(optionNames.map(n => v.options[n]).join('|')));

  return { toCreate, toArchive };
}

// Variant selector logic — which values are available given current selections?
export function getAvailableOptionValues(
  variants: { options: Record<string, string>; inventoryQuantity: number }[],
  currentSelections: Record<string, string>,
  targetOptionName: string
): string[] {
  return variants
    .filter(v =>
      Object.entries(currentSelections)
        .filter(([name]) => name !== targetOptionName)
        .every(([name, value]) => v.options[name] === value)
      && v.inventoryQuantity > 0
    )
    .map(v => v.options[targetOptionName])
    .filter(Boolean);
}

Step 3: Define a SKU naming convention

Consistent SKUs are critical for warehouse operations, reporting, and supplier communication. Establish a naming pattern before importing products.

Recommended format:

[PRODUCT-CODE]-[OPTION1]-[OPTION2]

Rules:
- Max 20 characters total
- All uppercase
- Hyphens between segments, no spaces
- Use standard size abbreviations: XS, S, M, L, XL, 2XL
- Use 3-letter color codes: RED, BLU, BLK, WHT, NVY, GRN
- Example: SHIRT-M-BLU → Blue shirt, Medium
           SHOE-10-NVY → Navy shoe, Size 10

Use Matrixify (Shopify) or WP All Import (WooCommerce) to bulk-assign SKUs following this pattern for an existing catalog.


Step 4: Manage large variant matrices

For products with many combinations (50+ variants):

Shopify: The 100-variant limit may be an issue for products with 3+ options. Strategies:

  • Combine two options into one (e.g., "Size/Width" instead of separate Size and Width options)
  • Create separate product records for each color and use metafields to link them
  • Use Shopify's native Bundles for configurable products that require more flexibility

WooCommerce: Performance degrades with 50+ variations on one product. Use WooCommerce Performance Optimizations or YITH WooCommerce Variations Table to improve the admin and storefront experience.

Lazy variant creation: For extremely large matrices (e.g., custom paint colors × finish × size = 500+ SKUs), generate variants on demand when first ordered rather than pre-creating all combinations:

// For very large matrices: create variants on first request rather than upfront
export async function ensureVariantExists(productId: string, options: Record<string, string>) {
  const key = Object.values(options).join('|');
  const existing = await db.productVariants.findFirst({ where: { productId, variantKey: key } });
  if (existing) return existing;

  const product = await db.products.findUnique({ where: { id: productId } });
  return db.productVariants.create({
    data: {
      productId,
      sku: generateSku(product.baseSku, options),
      variantKey: key,
      options,
      price: applyPricingRules(product, options),
      inventoryQuantity: 0,
    },
  });
}

Best Practices

  • Archive variants, never delete them — deleted variants break historical orders that reference them; mark as published: false when discontinued
  • Use the platform's bulk edit tools for price and inventory updates — editing 100 variants one at a time is impractical; all platforms support bulk edits
  • Limit options to 2–3 axes — beyond 3 options (e.g., size × color × material), the variant selector becomes confusing and the matrix grows exponentially
  • Test the variant selector before launch — verify that selecting an unavailable combination shows the correct "sold out" state and that the price/image updates correctly
  • Validate SKU uniqueness before bulk importing — a SKU collision during import silently skips the conflicting row or throws an error depending on the platform

Common Pitfalls

ProblemSolution
Shopify 100-variant limit reachedCombine options or create separate products per color; use metafields to group related products in the storefront
Variant image not switching on option selectAssign variant-specific images explicitly per variant; the platform can only switch images if the variant has its own image set
Adding a new option value creates duplicate variantsUse diff logic to detect which combinations are genuinely new; Shopify handles this correctly in the admin, but custom imports need deduplication
Large matrix slows product page loadFor 100+ variants, fetch variant availability via API on option change rather than embedding all variants in the initial page HTML
SKU collisions during bulk importNormalize SKU segments before generating: toUpperCase().replace(/[^A-Z0-9]/g, '-'); check for duplicates before saving

Related Skills

  • @product-data-modeling
  • @inventory-tracking
  • @catalog-import-export

平台分布

Codex

32.68%
按下载量换算54

Claude

32.35%
按下载量换算54

Cursor

20.04%
按下载量换算33

Gemini CLI

9.19%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills