amazon-shopping
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAmazon Shopping
亚马逊购物
Search Amazon and recommend products based on user preferences.
搜索亚马逊并根据用户偏好推荐产品。
⚠️ MANDATORY FIRST STEP - REQUIREMENTS GATHERING
⚠️ 强制第一步 - 需求收集
YOU MUST ASK CLARIFYING QUESTIONS BEFORE ANY BROWSER AUTOMATION.
DO NOT proceed to search until you understand:
- Budget: Price range they're comfortable with
- Usage: Who/what it's for (personal, gift, professional)
- Deal-breakers: Features they must have or avoid
Use to gather this information. Only after receiving answers should you proceed to Step 2.
AskUserQuestionExample questions for any product:
- Budget range (under $25, $25-50, $50-100, $100+)
- Primary use case (personal, gift, professional)
- Key preferences (brand, features, quality vs value)
在进行任何浏览器自动化操作之前,你必须先询问澄清问题。
在明确以下信息之前,请勿进行搜索:
- 预算:用户可接受的价格范围
- 用途:用于谁/什么场景(个人使用、礼物、专业用途)
- 排除项:必须具备或绝对避免的功能
使用来收集这些信息。只有在收到回复后,才能进入第二步。
AskUserQuestion适用于所有产品的示例问题:
- 预算范围(25美元以下、25-50美元、50-100美元、100美元以上)
- 主要使用场景(个人、礼物、专业)
- 核心偏好(品牌、功能、品质vs性价比)
Quick Start (After Requirements Gathered)
快速开始(收集完需求后)
Gather requirements: Ask about budget, usage, deal-breakers→ DONE in mandatory step above- Search Amazon: Use agent-browser to search and capture snapshot
- Extract data: Pull ASINs, prices, ratings, review counts
- Present recommendations: Ranked by user's criteria
收集需求:询问预算、用途、排除项→ 已在上述强制步骤完成- 搜索亚马逊:使用agent-browser进行搜索并捕获快照
- 提取数据:获取ASIN、价格、评分、评论数量
- 呈现推荐:根据用户的标准进行排名
Prerequisites
前提条件
- CLI at
agent-browser/opt/homebrew/bin/agent-browser - Internet access to Amazon.com
- Run command examples from this skill's root directory (the folder containing ) so relative paths like
SKILL.mdandscripts/...resolve correctly.reference/...
- CLI位于
agent-browser/opt/homebrew/bin/agent-browser - 可访问Amazon.com的网络权限
- 从本skill的根目录(包含的文件夹)运行命令示例,以便
SKILL.md和scripts/...这类相对路径能正确解析。reference/...
Search Workflow
搜索工作流
Step 1: Open Amazon
步骤1:打开亚马逊
bash
agent-browser open https://www.amazon.combash
agent-browser open https://www.amazon.comStep 2: Fill Search
步骤2:填写搜索内容
bash
agent-browser fill "[role='searchbox']" "<search query>"
agent-browser press Enter
sleep 5 # Wait for page loadbash
agent-browser fill "[role='searchbox']" "<搜索关键词>"
agent-browser press Enter
sleep 5 # 等待页面加载Step 3: Capture Results
步骤3:捕获结果
bash
agent-browser snapshot > results.txtbash
agent-browser snapshot > results.txtStep 4: Extract Products WITH Their ASINs (NEW METHOD)
步骤4:提取产品及其ASIN(新方法)
⚠️ CRITICAL: NEVER extract ASINs separately from product names. This causes mismatches.
Use the container-based extraction script instead of grep:
bash
undefined⚠️ 重要提示:切勿将ASIN与产品名称分开提取,这会导致匹配错误。
请使用基于容器的提取脚本而非grep:
bash
undefinedExtract product name AND its ASIN from THE SAME container
从同一个容器中提取产品名称及其ASIN
python3 scripts/extract_products.py results.txt
The script parses the YAML/indented structure of the accessibility tree and identifies product containers (list items containing both heading and link), then extracts product name AND its ASIN from THE SAME container.
**Output format:**
```json
[
{"name": "Product Name", "asin": "B0XXXXXXXXX", "ref": "e123", "line_index": 42},
...
]❌ WRONG METHOD - Causes ASIN/Product Mismatches:
bash
undefinedpython3 scripts/extract_products.py results.txt
该脚本会解析可访问性树的YAML/缩进结构,识别产品容器(同时包含标题和链接的列表项),然后从同一个容器中提取产品名称及其ASIN。
**输出格式:**
```json
[
{"name": "产品名称", "asin": "B0XXXXXXXXX", "ref": "e123", "line_index": 42},
...
]❌ 错误方法 - 会导致ASIN/产品匹配错误:
bash
undefinedNEVER DO THIS - Extracts ASINs separately, loses product association
切勿这样做 - 单独提取ASIN会丢失产品关联
grep -oE "dp/[A-Z0-9]{10}" results.txt | sed 's|dp/||'
grep -oE "dp/[A-Z0-9]{10}" results.txt | sed 's|dp/||'
Or using context windows that can pick up wrong ASINs:
或者使用可能抓取到错误ASIN的上下文窗口:
grep -B2 -A2 "Product Name" results.txt | grep -oE "dp/[A-Z0-9]{10}"
undefinedgrep -B2 -A2 "产品名称" results.txt | grep -oE "dp/[A-Z0-9]{10}"
undefinedStep 5: MANDATORY Product Page Verification (ENFORCED)
步骤5:强制的产品页面验证(强制执行)
For EVERY product before presenting it to the user, you MUST verify:
bash
undefined在向用户呈现任何产品之前,你必须对每个产品进行验证:
bash
undefinedUse the verification script
使用验证脚本
bash scripts/verify_products.sh results.txt
The verification script:
1. Opens each product page individually
2. Verifies the page title matches expected product
3. Extracts the ACTUAL price from the product page
4. Extracts rating and review count
5. Only outputs VERIFIED products
**Manual verification (if script unavailable):**
```bashbash scripts/verify_products.sh results.txt
验证脚本会:
1. 单独打开每个产品页面
2. 验证页面标题是否与预期产品匹配
3. 从产品页面提取实际价格
4. 提取评分和评论数量
5. 仅输出经过验证的产品
**手动验证(如果脚本不可用):**
```bashOpen product page
打开产品页面
agent-browser open https://www.amazon.com/dp/[ASIN]
sleep 3
agent-browser snapshot | grep -iE "price|One-time purchase"
agent-browser open https://www.amazon.com/dp/[ASIN]
sleep 3
agent-browser snapshot | grep -iE "price|One-time purchase"
Verify:
验证:
1. Title matches the product you're recommending
1. 标题与你要推荐的产品匹配
2. Price is current and accurate (look for "One-time purchase: $XX.XX")
2. 价格是当前准确的(查找"One-time purchase: $XX.XX")
**⚠️ MANDATORY VERIFICATION RULES:**
- If ASIN redirects to different product → DISCARD
- If page title doesn't match expected product → DISCARD
- If price cannot be found → DISCARD
- Only present VERIFIED products with ✓ marker
**⚠️ NEVER extract prices from search results pages** - prices shown in search results often don't match actual product page prices due to variants, promotions, or different sellers.
See reference/asin-extraction.md for detailed patterns.
**⚠️ 强制验证规则:**
- 如果ASIN跳转到其他产品 → 舍弃
- 如果页面标题与预期产品不匹配 → 舍弃
- 如果无法找到价格 → 舍弃
- 仅呈现带有✓标记的已验证产品
**⚠️ 切勿从搜索结果页面提取价格** - 搜索结果中显示的价格常因产品变体、促销活动或不同卖家而与产品页面的实际价格不符。
详细模式请参考reference/asin-extraction.md。Common Issues
常见问题
| Issue | Solution |
|---|---|
| CAPTCHA | Wait 60s, retry |
| Rate limited | Wait 2-3 min |
| No results | Broaden search |
See reference/common-errors.md for complete troubleshooting.
| 问题 | 解决方案 |
|---|---|
| CAPTCHA | 等待60秒后重试 |
| 速率限制 | 等待2-3分钟 |
| 无结果 | 扩大搜索范围 |
完整故障排除请参考reference/common-errors.md。
Output Format
输出格式
ALL presented products MUST be verified on their actual product pages.
markdown
undefined所有呈现的产品必须在其实际产品页面上经过验证。
markdown
undefinedAmazon Shortlist - [Category]
亚马逊候选清单 - [品类]
1. [Product] - $XX.XX ✓ VERIFIED
1. [产品名称] - $XX.XX ✓ 已验证
ASIN: [ASIN] (verified on product page)
Rating: X.X/5 (X,XXX reviews)
Amazon: https://www.amazon.com/dp/[ASIN]
Why this: [Reason]
Key specs: [Specs]
**⚠️ Do NOT present unverified products.** The ✓ VERIFIED marker confirms that:
1. The ASIN link goes to the actual product (not a redirect)
2. The price is current from the product page
3. The title matches what was recommended
See [reference/output-formats.md](reference/output-formats.md) for templates.ASIN:[ASIN](已在产品页面验证)
评分:X.X/5(X,XXX条评论)
亚马逊链接:https://www.amazon.com/dp/[ASIN]
推荐理由:[原因]
核心规格:[规格]
**⚠️ 切勿呈现未验证的产品。** ✓ 已验证标记确认:
1. ASIN链接指向实际产品(而非跳转至其他页面)
2. 价格是产品页面的当前准确价格
3. 标题与推荐的产品匹配
模板请参考[reference/output-formats.md](reference/output-formats.md)。Ranking Priority
排名优先级
When ratings are similar (within 0.5), prioritize review count.
Example: 4.0 with 10,000 reviews > 5.0 with 100 reviews
当评分相近(差值在0.5以内)时,优先考虑评论数量。
示例:4.0分且有10,000条评论 > 5.0分且有100条评论
Optional: Ranking Script
可选:排名脚本
For 10+ products, use the ranking script:
bash
python3 scripts/rank_products.py products.jsonl --budget 100 --priority rating对于10个以上的产品,可使用排名脚本:
bash
python3 scripts/rank_products.py products.jsonl --budget 100 --priority rating