Token导航 LogoToken导航

Agent Skill · 前端设计

discount-engine(折扣引擎)

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

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

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

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill discount-engine

这个 Skill 是做什么的

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

用于设置和管理电商平台的折扣逻辑与促销活动。适合构建促销系统、discount-engine 属于前端设计类 Skill,可作为该场景下的辅助能力补充。配置优惠券代码及处理复杂优惠规则如满减、满赠和条件触发。

建议优先使用平台原生功能,适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。自定义实现前应评估业务需求与扩展能力边界。

来源仓库内路径:skills/discount-engine

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

discount-engine 怎么安装?

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

discount-engine 支持哪些 AI 工具?

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

discount-engine 需要什么权限?

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

discount-engine 是免费的吗?

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

discount-engine 用的人多吗?

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

discount-engine 安全吗?

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

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

值得选的地方

  • 同时适配 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只读未明确通过
discount-engine

折扣引擎 · 本页

47019只读未明确通过

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

SKILL.md 原文

Discount Engine

Overview

A discount engine evaluates promotions against a cart and applies the right discounts in the right order. Every major e-commerce platform has one built in — you should configure the platform's native system before considering custom code. This skill covers how to set up complex discount logic (percentage off, fixed amount, BOGO, tiered thresholds, conditional rules) on each platform, and when to use apps or plugins to extend native capabilities.

When to Use This Skill

  • When building a promotions system for a new e-commerce store
  • When adding coupon code support to an existing checkout flow
  • When implementing tiered pricing (e.g., buy 3+ get 10% off, buy 10+ get 20% off)
  • When creating automatic discounts that apply based on cart conditions
  • When you need BOGO, bundle, or gift-with-purchase promotions

Core Instructions

Step 1: Determine the merchant's platform and choose the right tool

PlatformBuilt-in Discount CapabilitiesWhen to Add Apps/Plugins
ShopifyAutomatic discounts, code-based discounts, BOGO, tiered Buy X Get Y — all in Discounts adminShopify Plus Scripts for advanced stacking and custom logic; Bold Discounts for visual rule building
WooCommerceCoupons (core) cover basic casesFor BOGO, tiered quantity pricing, or automatic rule-based discounts: YITH WooCommerce Dynamic Pricing & Discounts ($70/yr) or Dynamic Pricing extension by WooCommerce ($99/yr)
BigCommercePromotions engine supports cart-level and item-level discounts, free products, BOGOBigCommerce's built-in Promotions are powerful — use custom scripts for edge cases
Custom / HeadlessMust build — see belowN/A

Step 2: Set up automatic discounts and BOGO on your platform


Shopify

Automatic discounts (no code required):

  1. Go to Discounts → Create discount → Amount off products (or Amount off order)
  2. Toggle No discount code (makes it automatic — applies without a code)
  3. Set the discount value and conditions
  4. Under Minimum purchase requirements: set a minimum quantity or subtotal to trigger the discount
  5. Set the Active dates — automatic discounts apply to all eligible carts during this window

BOGO (Buy X Get Y):

  1. Go to Discounts → Create discount → Buy X get Y
  2. Set the Customer buys section: quantity and which products/collections qualify
  3. Set the Customer gets section: quantity of free/discounted items and which products
  4. Set the discount percentage (100% = free)
  5. Set a Maximum uses limit if needed

Tiered quantity discounts (Shopify): Native Shopify does not support tiered quantity breaks (e.g., 1–4 units = full price, 5–9 = 10% off, 10+ = 20% off) without an app. Options:

  • Bold Discounts (App Store, ~$20/month): visual interface for tiered pricing rules
  • Wholesale Club (App Store): adds a wholesale/tiered pricing layer for B2B
  • Shopify Plus + Shopify Functions: write a Discount Function in JavaScript that applies the correct tier based on cart line quantities

Stacking rules: In Shopify, each discount can be configured to combine with others:

  1. Edit a discount → scroll to Combinations
  2. Toggle which discount types it can be combined with: product discounts, order discounts, shipping discounts

WooCommerce

WooCommerce core coupons cover single-code, percentage, and fixed-amount discounts. For automatic, rule-based, and BOGO discounts, use the Dynamic Pricing & Discounts plugin.

Installing Dynamic Pricing:

  1. Purchase and install YITH WooCommerce Dynamic Pricing & Discounts or the WooCommerce-branded Dynamic Pricing extension
  2. Go to WooCommerce → Dynamic Pricing → Add Rule

Creating a tiered quantity rule:

  1. Set rule type to Product Pricing or Category Pricing
  2. Add pricing tiers:

- From 1 to 4 quantity: 0% off (full price) - From 5 to 9: 10% off - From 10 to 24: 20% off - From 25 and above: 30% off

  1. Set which products or categories this applies to
  2. Save and publish

BOGO in WooCommerce:

  1. In Dynamic Pricing, create a new rule of type Cart Pricing
  2. Set the condition: "When cart contains X of [product]"
  3. Set the action: "Add Y of [product] at [0% of regular price]"
  4. Or use WooCommerce Smart Coupons for gift-with-purchase

Preventing unintended stacking: In WooCommerce core coupons, tick Individual use only to prevent a coupon from combining with other coupons. For automatic rules in Dynamic Pricing, each rule has a "Stops further rules" option that prevents lower-priority rules from applying.


BigCommerce

BigCommerce has a native Promotions system that covers most discount scenarios.

  1. Go to Marketing → Promotions → Create promotion
  2. Set the Promotion type: cart-level discount, item-level discount, free shipping, free item, BOGO
  3. Configure Conditions:

- Minimum cart subtotal - Specific products or categories included/excluded - Customer groups (for B2B or segment-specific pricing)

  1. Set Actions: the discount amount and which items it applies to
  2. Set Coupon (optional): attach a code to require manual application, or leave blank for automatic
  3. Set Rules for stacking: BigCommerce allows defining whether a promotion can stack with other promotions

Tiered quantity pricing on BigCommerce: Use the Price Lists feature (Plus plan and above):

  1. Go to Products → Price Lists
  2. Create a price list with explicit per-unit prices at different quantity thresholds
  3. Assign the price list to a customer group
  4. Customers in that group automatically see the tiered prices

Custom / Headless

For custom storefronts, the discount engine evaluates applicable discounts and allocates them to cart lines. The key principles are: evaluate server-side, apply in priority order, and enforce stacking rules.

interface Discount {
  id: string;
  type: 'percentage' | 'fixed_amount' | 'bogo' | 'free_shipping';
  value: number;        // percentage (0-100) or cents
  target: 'order' | 'line_item' | 'shipping';
  isStackable: boolean;
  minCartCents?: number;
  minQuantity?: number;
  entitledProductIds?: string[];
  excludedProductIds?: string[];
  startsAt: Date;
  endsAt?: Date;
}

interface CartLine {
  id: string;
  productId: string;
  quantity: number;
  unitPriceCents: number;
}

function evaluateDiscounts(
  cart: { lines: CartLine[]; subtotalCents: number },
  discounts: Discount[]
): { discountId: string; amountCents: number; affectedLineIds: string[] }[] {
  const now = new Date();
  const eligible = discounts.filter(d =>
    d.startsAt <= now && (!d.endsAt || d.endsAt > now)
  );

  // Sort: non-stackable first, then higher-value
  const sorted = [...eligible].sort((a, b) => (a.isStackable ? 1 : -1) - (b.isStackable ? 1 : -1));

  const applications: { discountId: string; amountCents: number; affectedLineIds: string[] }[] = [];
  let nonStackableApplied = false;

  for (const discount of sorted) {
    if (!discount.isStackable && nonStackableApplied) continue;

    // Check minimum cart value
    if (discount.minCartCents && cart.subtotalCents < discount.minCartCents) continue;

    const eligibleLines = cart.lines.filter(line =>
      (!discount.entitledProductIds || discount.entitledProductIds.includes(line.productId)) &&
      (!discount.excludedProductIds || !discount.excludedProductIds.includes(line.productId))
    );
    if (eligibleLines.length === 0) continue;

    let amountCents = 0;
    if (discount.type === 'percentage') {
      amountCents = Math.round(
        eligibleLines.reduce((s, l) => s + l.unitPriceCents * l.quantity, 0) * discount.value / 100
      );
    } else if (discount.type === 'fixed_amount') {
      amountCents = Math.min(discount.value, cart.subtotalCents);
    } else if (discount.type === 'bogo') {
      const buyQty = discount.minQuantity ?? 1;
      for (const line of eligibleLines) {
        const freeItems = Math.floor(line.quantity / (buyQty + discount.value)) * discount.value;
        amountCents += freeItems * line.unitPriceCents;
      }
    }

    if (amountCents > 0) {
      applications.push({ discountId: discount.id, amountCents, affectedLineIds: eligibleLines.map(l => l.id) });
      if (!discount.isStackable) nonStackableApplied = true;
    }
  }

  return applications;
}

Always re-run this evaluation at order creation, not just at cart-add time, to catch race conditions and expired discounts.

Best Practices

  • Always calculate discounts server-side — never trust client-submitted discount amounts; recalculate at checkout
  • Define stacking rules explicitly — decide upfront whether multiple discounts can combine and document the policy for your merchandising team
  • Cap maximum discount amounts — for percentage discounts, set a maximum dollar cap to prevent runaway promotions
  • Exclude sale items from additional promotions — prevent compounding discounts from destroying margins; Shopify and WooCommerce both support "exclude sale items" rules
  • Test rules on staging before activating — particularly important for automatic discounts that apply to all eligible customers without requiring a code
  • Log every discount application — record discount ID, customer, order, and amount for audit trails and promotion ROI reporting
  • Set clear end dates — automatic discounts without an end date continue applying indefinitely; always set an expiry

Common Pitfalls

ProblemSolution
Discount applied after order is placed (stale cart)Re-validate all discounts at order creation; remove expired or invalid ones before charging
BOGO applied to a single-unit cartEnforce a minimum cart quantity equal to the buy quantity before the BOGO triggers
Discount causes an order total to go negativeCap the total discount at the cart subtotal; no order total should go below zero
Automatic and code-based discounts stack unexpectedlyReview the "Combinations" settings on each discount in Shopify; use "Individual use only" in WooCommerce coupons
Tiered discount shows wrong tier when quantity is updatedRecalculate the applicable tier on every cart quantity change, not just at checkout

Related Skills

  • @stripe-integration
  • @checkout-flow-optimization
  • @coupon-management
  • @price-rules-engine
  • @volume-pricing

平台分布

Codex

33.29%
按下载量换算55

Claude

30.45%
按下载量换算50

Cursor

18.2%
按下载量换算30

Gemini CLI

10.14%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

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

安装前确认

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

继续浏览同类 Skills