滞销商品降价优化
markdown-optimizer
通过运行内置的 markdown_optimizer.py 脚本,为每件滞销商品推荐折扣百分比和新价格,同时遵循来自门店政策智能体的定价护栏规则(绝不硬编码这些规则)。应在 sales-analysis-chart 识别出滞销商品之后,并通过门店政策智能体的 get_markdown_policy 获取降价护栏规则之后使用。该脚本应用最大折扣上限和利润底线,计算每件商品的新价格和利润,标记那些在利润底线内无法有效促销而应转为清仓处理的商品,并绘制推荐折扣图表。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 21
- Forks
- 18
01 前言 Front Matter
- name
- markdown-optimizer
- description
- Recommend a discount percentage and new price for each slow-moving product by running the bundled markdown_optimizer.py script, respecting pricing guardrails that come from the Store Policy Agent (never hardcode them). Use after sales-analysis-chart has identified the slow movers and after fetching the markdown guardrails via the Store Policy Agent's get_markdown_policy. The script applies the max-discount cap and margin floor, computes each new price and margin, flags items that cannot be meaningfully promoted within the floor for clearance instead, and renders a recommended-discount chart.
02 资源文件 1
- 脚本markdown_optimizer.py6.1 KB
03 SKILL.md 正文
Markdown Optimizer (BlastBox Omega)
This skill decides how much to mark down each slow-moving product by running the
bundled markdown_optimizer.py script. You do not write any Python and you do
not hardcode the pricing rules: the guardrails come from the Store Policy Agent
via get_markdown_policy(markdown_type) and are passed to the script as CLI flags. This
keeps all policy in one place (the Policy Agent owns it).
When to use
After sales-analysis-chart has produced the structured slow_movers list, and after
you have fetched the guardrails from the Store Policy Agent. Use it whenever a
manager asks what to mark down and by how much within policy.
Inputs (gather these first, then pass them as flags)
- Slow movers - the
slow_moversJSON fromsales-analysis-chart: a list of{sku, name, price, cost}(extra keys are ignored). - Guardrails - call the Store Policy Agent -
get_markdown_policy("promo"). It returnsmax_discount_pct,margin_floor_pct, andmin_useful_promo_discount_pct(e.g.30,15,10). Pass all three. Do not invent or hardcode them. For a clearance pass, callget_markdown_policy("clearance")and use--markdown-type clearance.
Run the bundled script
For a promo markdown, pass the slow movers and the three guardrails:
python3 markdown_optimizer.py \
--markdown-type promo \
--max-discount 30 --margin-floor 15 --min-useful 10 \
--slow-movers '[{"sku":"SKU-VR-NEBULA","name":"Nebula VR Headset","price":199.99,"cost":70.00},
{"sku":"SKU-GALAXY-PAD","name":"Galaxy Pad Controller","price":49.99,"cost":18.00}]'
For a clearance pass (no promo math, every item flagged for a manager decision):
python3 markdown_optimizer.py --markdown-type clearance \
--slow-movers '[{"sku":"SKU-OMEGA-CORE","name":"Omega Core Console","price":399.99,"cost":320.00}]'
The script prints one line per item, then RECOMMENDATIONS_JSON=<json>, and writes
markdowns.png (a bar chart of the recommended promo discounts).
What the script does (for your report, not for you to reimplement)
- floor price =
cost / (1 - margin_floor_pct/100)- the lowest price that still keeps the required gross margin. - recommended discount % =
min(max_discount_pct, floor-allowed %). When the cap binds you get the headline discount; when the floor binds the new margin equals the floor (bindingsays which). - Items whose floor-allowed discount is below
min_useful_promo_discount_pctcome back withflag_clearance: true- they can't be meaningfully promoted, so they should be cleared out via a clearance pass (a separate decision requiring a manager flag).
Report
- Present a table: product, current price, recommended discount %, new price, new margin, and whether the margin floor or max-discount cap was binding.
- Call out any item flagged for clearance, noting clearance is a separate manager
decision (
get_markdown_policy("clearance")). - Hand the finalized promo set (
RECOMMENDATIONS_JSON) to merch-report-pdf for the shareable report.
Notes
- The bundled script is
markdown_optimizer.py; it depends only onmatplotlib(available in the runtime) and prints recommendations even if the chart is skipped. - The guardrail numbers MUST come from the Store Policy Agent. If they are missing, fetch them before running - do not guess.
- All data is mock; recommendations are for demo purposes only.
04 同仓库更多 Skills
退货换货单 PDF 生成
slip-pdf-generator
生成一份可打印的 BlastBox 退货 / RMA / 换货单据 PDF,供店员交给客户。在退货、保修换货、会员取消或升级流程结束且所有金额最终确定后使用。该技能运行内置的 Python 脚本,将确认后的单据数据渲染为真实的 PDF 文件。
会员积分对账与兑换
points-reconciliation
在复杂的消费流程(购买、退货、促销倍数、过期)之后,核对客户的 BlastPoints 会员积分余额,并将净余额转换为店铺消费额度。当店员询问某会员的积分时,或在应追回此前已赚取积分的退货之后使用。该技能运行内置的 Python 脚本,按基础赚取率、促销倍数、等级奖励、积分追回和过期规则计算,然后输出积分账目和可兑换的店铺消费额度。
按比例退款与换购结算
prorated-refund-calculator
当客户取消 BlastPass 会员资格时计算精确的分摊退款,以及瑕疵品换购更高价机型时的净结算金额。在商店策略代理(Store Policy Agent)确认退款规则且会员 MCP 返回会员详情后使用。该技能运行内置的 Python 脚本以确保计算精确。
电子会员卡 PNG 生成
membership-card-png
通过运行内置的 card_png.py 脚本,生成电子 BlastPass 会员卡的 PNG 图片。适用于会员自助补办遗失/被盗/损坏的卡片,或任何需要在屏幕上展示卡片(而非打印)的场景。该技能接收 Membership MCP(get_membership)返回的会员详情,以及 reissue_card 返回的 new_card_serial,并将它们作为命令行参数传递给内置的 Python(matplotlib)脚本,渲染出 CR80 尺寸的会员卡并生成真实的 PNG 文件。它仅根据已获取的值渲染卡片——从不自行查询任何信息或编造数据。
电子会员卡 PNG 生成
membership-card-png
通过运行内置的 card_png.py 脚本,生成电子 BlastPass 会员卡的 PNG 图片。适用于会员自助补办遗失/被盗/损坏的卡片,或任何需要在屏幕上展示卡片(而非打印)的场景。该技能接收 Membership MCP(get_membership)返回的会员详情,以及 reissue_card 返回的 new_card_serial,并将它们作为命令行参数传递给内置的 Python(matplotlib)脚本,渲染出 CR80 尺寸的会员卡并生成真实的 PNG 文件。它仅根据已获取的值渲染卡片——从不自行查询任何信息或编造数据。
退货换货单据 PDF 生成
slip-pdf-generator
生成可打印的 BlastBox 退货 / RMA / 换货单据 PDF,供店员交给顾客。在退货、保修换货、会员取消或升级流程结束、所有金额最终确定后使用。该技能运行内置的 Python 脚本,将已确认的单据信息渲染为真实的 PDF 文件。