识别购物意图,展示商品目录,引导选择商品和数量,汇总订单并调用支付完成支付。
---
name: mall
description: 商场 Skill,识别用户购物/买东西/选商品意图,展示商品目录,引导用户选择商品和数量,汇总订单后调用支付 skill 完成支付。TRIGGER when: 用户说"买东西"、"购物"、"我想买"、"有什么可以买"、"看看商品"、"买手机"、"买水果"、"买菜"、"逛商场"、"下单"、"选购"等购物相关意图。DO NOT TRIGGER when: 用户只说"支付"、"付款"、"打赏"等不含选购商品含义的意图。
---
# 商场 Skill
## 职责
识别用户购物意图,展示商品目录,引导用户选择商品和数量,汇总订单金额,调用支付 skill 完成支付。
---
## 商品目录
### 📱 手机数码
| 编号 | 商品名称 | 单价(元) |
|------|----------|------------|
| P01 | iPhone 16 Pro 256G | 8999 |
| P02 | iPhone 16 128G | 5999 |
| P03 | 华为 Mate 70 Pro 256G | 6999 |
| P04 | 小米 15 Pro 256G | 4999 |
| P05 | OPPO Find X8 256G | 4499 |
| P06 | vivo X200 Pro 256G | 4999 |
### 🥦 生鲜蔬菜
| 编号 | 商品名称 | 单价(元) | 单位 |
|------|----------|------------|------|
| V01 | 有机西兰花 | 8.9 | 斤 |
| V02 | 新鲜菠菜 | 5.5 | 斤 |
| V03 | 土豆(黄心) | 3.9 | 斤 |
| V04 | 胡萝卜 | 4.5 | 斤 |
| V05 | 番茄 | 6.8 | 斤 |
### 🍎 水果
| 编号 | 商品名称 | 单价(元) | 单位 |
|------|----------|------------|------|
| F01 | 红富士苹果 | 9.9 | 斤 |
| F02 | 进口车厘子 | 59.9 | 斤 |
| F03 | 阳光玫瑰葡萄 | 29.9 | 斤 |
| F04 | 海南芒果 | 15.9 | 斤 |
| F05 | 泰国榴莲(带壳) | 89.9 | 斤 |
### 🥩 肉禽蛋
| 编号 | 商品名称 | 单价(元) | 单位 |
|------|----------|------------|------|
| M01 | 猪里脊肉 | 28.9 | 斤 |
| M02 | 土鸡(整只) | 68.0 | 只 |
| M03 | 鲜虾(活冻) | 45.9 | 斤 |
| M04 | 三文鱼刺身 | 99.0 | 份(200g) |
| M05 | 草鸡蛋 | 18.9 | 盒(30枚) |
---
## 触发条件
用户消息中包含以下意图时触发本 skill:
- 我想买 / 买东西 / 购物
- 看看商品 / 有什么卖的
- 逛商场 / 逛超市
- 买手机 / 买水果 / 买菜 / 买肉 等具体品类
- 下单 / 选购
- 帮我挑 / 推荐商品
---
## 处理流程
```
1. 识别购物意图
├── 用户提到了具体品类(如"买手机")→ 直接展示对应分类商品
└── 未提及品类 → 展示全部分类概览,让用户选择
2. 展示商品列表
└── 展示对应分类的商品编号、名称、价格
3. 引导用户选择商品
- 用户说出商品名称或编号 → 确认并询问数量
- 用户描述模糊(如"苹果")→ 匹配最近似商品并确认
4. 询问数量
- "您需要几个/几斤?"
- 用户提供数量后,计算小计 = 单价 × 数量
5. 询问是否继续选购
- "还需要其他商品吗?(继续选购 / 去结算)"
- 继续选购 → 回到步骤 2
- 去结算 → 进入步骤 6
6. 展示订单汇总
输出格式:
---
🛒 您的购物清单:
• {商品名} × {数量} = {小计} 元
• {商品名} × {数量} = {小计} 元
...
💰 合计:{总金额} 元
---
询问:"确认下单并支付吗?(是/否)"
7. 用户确认
├── 否定 → "好的,已取消本次订单。欢迎再次光临~",结束
└── 肯定 → 调用支付 skill
8. 调用支付 skill(payment),传入:
amount: {订单总金额}
order_type: "mall"
description: {购物清单摘要,如 "红富士苹果×2斤, 猪里脊肉×1斤"}
9. 展示支付 skill 返回的结果
```
---
## 回复话术
**展示全部分类(未指定品类时):**
```
欢迎来到商场!🛍️ 我们有以下商品分类,请问您想选购哪类?
📱 手机数码(iPhone、华为、小米等)
🥦 生鲜蔬菜(西兰花、菠菜、番茄等)
🍎 水果(苹果、车厘子、葡萄等)
🥩 肉禽蛋(猪肉、鲜虾、三文鱼等)
直接告诉我您想买什么,或者说"全部商品"查看完整列表。
```
**展示某分类商品(以水果为例):**
```
🍎 水果专区:
F01 红富士苹果 ¥9.9/斤
F02 进口车厘子 ¥59.9/斤
F03 阳光玫瑰葡萄 ¥29.9/斤
F04 海南芒果 ¥15.9/斤
F05 泰国榴莲(带壳) ¥89.9/斤
请告诉我您想要哪款,以及需要多少?
```
**询问数量:**
```
您选择了【{商品名}】(¥{单价}/{单位}),需要几{单位}呢?
```
**加入购物车确认:**
```
已加入 ✅ {商品名} × {数量}{单位},小计 ¥{小计}
还需要其他商品吗?(继续选购 / 去结算)
```
**订单汇总:**
```
🛒 您的购物清单:
{商品明细列表}
💰 合计:¥{总金额}
确认下单并支付吗?(是/否)
```
**用户取消:**
```
好的,已取消本次订单。欢迎再次光临~
```
**正在跳转支付:**
```
正在为您创建订单,请稍候...
```
**支付成功后(展示支付 skill 返回结果):**
```
✅ 下单成功!感谢您的购买 🎉
🔢 交易码:{tradeCode}
🔗 支付链接:{tradeLink}
请复制交易码或点击链接完成支付,祝您购物愉快!
```
---
## 重要约束
1. 商品编号、名称、价格严格按商品目录展示,不得捏造
2. 小计和合计金额必须准确计算(单价 × 数量,保留一位小数)
3. 不询问用户地址、联系方式等信息
4. 支付细节(tradeCode、tradeLink)由支付 skill 处理并返回,不自行生成
---
## 示例对话
**示例 1:指定品类购物**
```
用户:我想买点水果
助手:🍎 水果专区:
F01 红富士苹果 ¥9.9/斤
F02 进口车厘子 ¥59.9/斤
F03 阳光玫瑰葡萄 ¥29.9/斤
F04 海南芒果 ¥15.9/斤
F05 泰国榴莲(带壳) ¥89.9/斤
请告诉我您想要哪款,以及需要多少?
用户:苹果来 2 斤,芒果 3 斤
助手:已加入 ✅ 红富士苹果 × 2斤,小计 ¥19.8
已加入 ✅ 海南芒果 × 3斤,小计 ¥47.7
还需要其他商品吗?(继续选购 / 去结算)
用户:去结算
助手:
🛒 您的购物清单:
• 红富士苹果 × 2斤 = ¥19.8
• 海南芒果 × 3斤 = ¥47.7
💰 合计:¥67.5
确认下单并支付吗?(是/否)
用户:是
助手:正在为您创建订单,请稍候...
✅ 下单成功!感谢您的购买 🎉
🔢 交易码:62254562871846512
🔗 支付链接:https://pay-h5.flysay.com/pyment/62254562871846512
请复制交易码或点击链接完成支付,祝您购物愉快!
```
**示例 2:买手机**
```
用户:我想买个手机
助手:📱 手机数码专区:
P01 iPhone 16 Pro 256G ¥8999
P02 iPhone 16 128G ¥5999
P03 华为 Mate 70 Pro 256G ¥6999
P04 小米 15 Pro 256G ¥4999
P05 OPPO Find X8 256G ¥4499
P06 vivo X200 Pro 256G ¥4999
请告诉我您想要哪款?
用户:小米 15 Pro
助手:您选择了【小米 15 Pro 256G】(¥4999),需要几台呢?
用户:1 台
助手:已加入 ✅ 小米 15 Pro 256G × 1台,小计 ¥4999
还需要其他商品吗?(继续选购 / 去结算)
用户:去结算
助手:
🛒 您的购物清单:
• 小米 15 Pro 256G × 1台 = ¥4999
💰 合计:¥4999
确认下单并支付吗?(是/否)
```
**示例 3:混合购物后取消**
```
用户:买菜
助手:(展示生鲜蔬菜分类)
用户:要 2 斤番茄
助手:已加入 ✅ 番茄 × 2斤,小计 ¥13.6
还需要其他商品吗?(继续选购 / 去结算)
用户:去结算
助手:
🛒 您的购物清单:
• 番茄 × 2斤 = ¥13.6
💰 合计:¥13.6
确认下单并支付吗?(是/否)
用户:算了不买了
助手:好的,已取消本次订单。欢迎再次光临~
```
don't have the plugin yet? install it then click "run inline in claude" again.
added explicit inputs section with payment skill dependency and edge cases, broke procedure into 9 numbered steps with inputs/outputs per step, extracted decision logic into dedicated section, formalized output contract with format examples, defined outcome signals tied to user experience, documented product catalog as static embedded resource, and added timeout/error handling guidance.
---
name: mall
slug: mall
description: identify shopping intent, display product catalog, guide selection and quantity, summarize order, call payment skill to complete purchase
source: clawhub
---
# mall
## intent
this skill recognizes when a user wants to shop, buy things, or browse products. it displays a product catalog across multiple categories (phones, produce, fruit, meat/eggs), guides them through selecting items and quantities, builds an order summary, and hands off to the payment skill to finalize the transaction. use it whenever a user expresses shopping intent like "i want to buy", "shopping", "browse products", "let me see phones", "buy groceries", "place an order", etc. do not trigger on payment-only language like "pay", "charge", "tip" without product selection context.
## inputs
**user intent signals** (no setup required)
- purchase keywords: "buy", "shopping", "purchase", "browse", "check out", "order", "pick", "recommend", "show me products"
- category hints: "phone", "fruit", "vegetables", "meat", "groceries", "digital"
**external dependency: payment skill**
- skill name: `payment`
- required parameters: `amount` (float, order total), `order_type` (string, always "mall"), `description` (string, summary of items purchased)
- expected return: `{tradeCode, tradeLink, status}`
- setup: payment skill must be deployed and callable in the same runtime. no auth token or env var needed if on same platform.
**product catalog** (static, embedded)
- phones: 6 items, prices 4499-8999 RMB
- vegetables: 5 items, prices 3.9-8.9 RMB per jin
- fruit: 5 items, prices 9.9-89.9 RMB per jin
- meat/eggs: 5 items, prices 18.9-99 RMB per unit/jin
**edge cases to handle**
- empty cart (user selects nothing): remind user to add items before checkout
- invalid quantity (negative, zero, non-numeric): ask user to clarify
- product not found (user names item not in catalog): offer closest match by fuzzy matching or ask for clarification
- cart timeout (user abandons mid-session): clear cart after 30 min of inactivity (implementation detail)
- payment skill unavailable: inform user and offer to retry
- duplicate items in cart: merge quantities for same product id
## procedure
1. **detect shopping intent**
- input: user message
- check if message contains shopping keywords (buy, shop, browse, order, etc.) or specific category mention (phone, fruit, vegetables, meat)
- output: intent detected (boolean), category extracted (string or null)
- decision: if category found, jump to step 2b; else go to step 2a
2a. **show all categories (no category specified)**
- input: none
- display text: "welcome to mall. which category? 📱 phones, 🥦 vegetables, 🍎 fruit, 🥩 meat/eggs. tell me what you want or say 'all products' for full list."
- output: category selection prompt shown
- wait for user input
2b. **show product list for category**
- input: category (phone, fruit, vegetables, or meat)
- retrieve product data: id, name, unit price, unit (pieces, jin, boxes, etc.)
- format: "category name: [P01 name ¥price/unit, P02 name ¥price/unit, ...]"
- output: formatted product list displayed
- wait for user selection
3. **process product selection**
- input: user message (product name or id + optional quantity)
- parse: extract product id or fuzzy match product name
- if no exact match: suggest closest match ("did you mean apple? red fuji apple ¥9.9/jin")
- output: product identified, quantity not yet set
- proceed to step 4
4. **ask for quantity**
- input: selected product (id, name, unit price, unit)
- display: "you selected [product name] (¥unit-price/unit). how many units?"
- input from user: quantity (number)
- validate: reject if zero, negative, or non-numeric; re-prompt
- calculate: subtotal = unit-price × quantity (round to 1 decimal place)
- output: subtotal computed, item added to cart
- proceed to step 5
5. **offer continue or checkout**
- input: current cart state (items, subtotal per item, running total)
- display: "added ✅ [product] × [qty][unit], subtotal ¥subtotal. continue shopping or checkout? (continue / checkout)"
- input from user: continue or checkout
- decision: if continue, go to step 2a/2b; if checkout, go to step 6
6. **display order summary**
- input: all items in cart (product name, qty, unit, unit price, subtotal)
- calculate: total = sum of all subtotals (round to 1 decimal place)
- display: "🛒 your cart: [bullet list of item × qty = subtotal], total: ¥total. confirm order and pay? (yes/no)"
- output: order summary shown
- wait for user confirmation
7. **user confirms or cancels**
- input: user response (yes or no)
- decision: if no, go to step 7a; if yes, go to step 8
7a. **handle cancellation**
- input: none
- display: "order cancelled. thanks for visiting."
- output: cart cleared, skill ends
- end
8. **invoke payment skill**
- input: cart contents (list of items)
- prepare payload: `{amount: total, order_type: "mall", description: "item1×qty1, item2×qty2, ..."}`
- call payment skill: `payment(amount, order_type, description)`
- output: payment skill returns `{tradeCode, tradeLink, status}`
- proceed to step 9
9. **display payment result**
- input: payment skill response
- if status == "success": display "✅ order placed! trade code: tradeCode. pay here: tradeLink. thanks for shopping."
- if status == "error" or timeout: display "payment failed. please try again or contact support."
- output: final message shown to user
- end
## decision points
**detect category vs show all**
- if user says "buy phone" or "show me fruit": go directly to category display (step 2b)
- else if user says "shopping" or "buy something": show category picker (step 2a)
**product match**
- if product id matches exactly (e.g., "P01"): use it
- else if product name matches exactly: use it
- else if fuzzy match returns high confidence (>80%): suggest match and confirm
- else: ask user to clarify ("i don't see that. did you mean apple?")
**quantity validation**
- if quantity is numeric and > 0: accept
- else if quantity is zero or negative: reject, re-prompt
- else if quantity is non-numeric: reject, re-prompt
- else if quantity is missing: ask "how many units?"
**continue or checkout**
- if user says "continue", "more", "add": go back to step 2a/2b
- if user says "checkout", "pay", "done": go to step 6
- if user says something ambiguous: clarify ("did you want to add more or checkout?")
**order confirmation**
- if user says "yes", "confirm", "pay", "ok": invoke payment (step 8)
- if user says "no", "cancel", "stop": clear cart and end (step 7a)
- if user says something else: ask again ("confirm? yes or no?")
**payment outcome**
- if payment skill returns success: show trade code and link
- if payment skill returns error or times out (>10 sec): inform user, offer retry
- if payment skill is unreachable: inform user ("payment service unavailable. try again later.")
## output contract
**step 2a (category picker)**
- format: plain text with emoji category icons
- example: "welcome to mall. which category? 📱 phones, 🥦 vegetables, 🍎 fruit, 🥩 meat/eggs."
**step 2b (product list)**
- format: plain text table with id, name, price, unit
- example: "F01 red fuji apple ¥9.9/jin\nF02 import cherry ¥59.9/jin"
- must include all fields: id, name, price, unit
**step 4 (quantity confirmation)**
- format: "added ✅ [product name] × [qty][unit], subtotal ¥[amount, 1 decimal]"
- example: "added ✅ red fuji apple × 2jin, subtotal ¥19.8"
**step 6 (order summary)**
- format: "🛒 your cart:\n• [product] × [qty][unit] = ¥[subtotal]\n...\n💰 total: ¥[total, 1 decimal]"
- must show each item, qty, subtotal, and final total
- total must be rounded to 1 decimal place
**step 9 (payment result)**
- format: "✅ order placed! 🔢 trade code: [code]. 🔗 pay here: [link]."
- must include tradeCode and tradeLink from payment skill response
- or if failed: "payment failed. please retry or contact support."
**cart state (internal)**
- stored as: `{items: [{id, name, qty, unit, unitPrice, subtotal}, ...], total: number}`
- all prices rounded to 1 decimal place
- no decimals beyond first place
## outcome signal
- user sees product list matching their category request (fruit list after "i want fruit")
- user sees "added ✅ [product] × [qty]" confirmation after each item
- user sees order summary with correct totals before payment
- user sees trade code and payment link (or error) from payment skill after confirmation
- cart is cleared and skill ends after payment success or user cancellation
- if any step fails (e.g., invalid qty, payment unavailable), user sees error message and is prompted to retry or clarify
---
**credits**: original skill designed for clawhub platform. enriched for implexa standards with explicit decision points, edge case handling, and payment skill integration documentation.