← 返回 Skills 市场
105
总下载
1
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install clawauto-shop
功能描述
Automates KFC and McDonald's order flows by converting backend order links into browser actions to confirm and retrieve pickup codes and order info.
使用说明 (SKILL.md)
KFC/McD clawauto-shop Skill(2.0.0)\r
\r
Automates KFC and McDonald's order-link flows after backend returns a cdkey URL.\r
\r
仅需查询:若只需 查询商品信息 与 查询个人信息,请使用 1.0.0 目录:../1.0.0/。\r
\r
Upload Readiness (ClawHub)\r
- Self-contained under this folder (
openclaw_skill.py,kfc_place_order_test_old.py,kfc_custom_product_flow.py,kfc_vip_choose_spec_flow.py,mcd_place_order_test.py,mcd_custom_product_flow.py,requirements.txt).\r - No hardcoded local paths.\r
- Outputs are written to
skill/outputs/(or current dir).\r - Can run with user-configured phone + api key.\r \r
Required Runtime Config\r
Use either CLI args or environment variables. For OpenClaw usage, .env is recommended:\r \r
Env-based config (dev / prod)\r
\r
Create .env manually in this folder, then paste and modify:\r
\r
KFC_PLATFORM_ENV=dev\r
KFC_PLATFORM_PHONE=13800138000\r
KFC_PLATFORM_API_KEY=your_api_key_here\r
KFC_PLATFORM_BASE_URL_DEV=http://localhost:8888/api/openclaw\r
KFC_PLATFORM_BASE_URL_PROD=https://www.clawauto.shop/api/openclaw\r
KFC_PLATFORM_BASE_URL=http://localhost:8888/api/openclaw\r
# Optional:\r
# KFC_PLATFORM_USERNAME=your_username\r
```\r
\r
Then configure:\r
\r
- Environment:\r
- `KFC_PLATFORM_ENV`: `dev` / `prod` (default `dev`)\r
- Backend base URL:\r
- `KFC_PLATFORM_BASE_URL_DEV`: dev backend, default `http://localhost:8888/api/openclaw`\r
- `KFC_PLATFORM_BASE_URL_PROD`: prod backend, default `https://www.clawauto.shop/api/openclaw`\r
- `KFC_PLATFORM_BASE_URL`: common base URL fallback\r
- Identity & API key:\r
- `KFC_PLATFORM_PHONE`: user phone\r
- `KFC_PLATFORM_API_KEY`: API key\r
- optional `KFC_PLATFORM_USERNAME`\r
\r
When running inside OpenClaw, `.env` will be loaded automatically, so you don't need to type these each time.\r
\r
### CLI vs env\r
\r
- Identity:\r
- `--phone` or `KFC_PLATFORM_PHONE`\r
- (fallback) `--username` or `KFC_PLATFORM_USERNAME`\r
- API key:\r
- `--api-key` or `KFC_PLATFORM_API_KEY`\r
- Backend URL:\r
- `--base-url` or `KFC_PLATFORM_BASE_URL`\r
- default: `http://localhost:8888/api/openclaw`\r
\r
## Runtime Chain\r
1. Optional: `GET /health` 探活(无鉴权,独立限流)。\r
2. Query platform products (`POST /products`).\r
3. Optional: `POST /orders` 拉取当前用户订单列表(与网页端「我的订单」同源)。\r
4. User selects `product_id` (or `supplier_goods_id` for supplier-only SKUs).\r
5. Skill calls platform order (`POST /order`),请求体可带 `idempotency_key`,或使用 HTTP 头 `Idempotency-Key`。\r
6. After order: use `POST /order/status` with `order_id` to poll supplier status / refreshed meal URL (`openclaw_skill.py --fetch-order-status \x3Cid>`).\r
7. Skill auto-runs browser order flow based on returned `flow` or URL host.\r
8. Stops before final submit by default unless explicitly allowed.\r
\r
OpenClaw JSON 错误体含 `message` + `code`(如 `OPENCLAW_UNAUTHORIZED`、`OPENCLAW_RATE_LIMITED`);成功响应带 `X-OpenClaw-RateLimit-Remaining` / `X-OpenClaw-RateLimit-Limit`,限流时另有 `Retry-After`。\r
\r
## Flow 识别规则(OpenClaw 调用时据此选择脚本)\r
\r
| 优先级 | URL 特征 | flow_code | 脚本 |\r
|--------|----------|-----------|------|\r
| 1 | 后端 order 返回 `flow.code` 且存在于注册表 | 后端指定 | 见 FLOW_REGISTRY |\r
| 2 | `vip.woaicoffee.com` 且含 `outId=` 且非 choose_specifications | `kfc_vip_choose_spec` | `kfc_vip_choose_spec_flow.py` |\r
| 3 | `kfc.woaicoffee.cn` 且含 `cdkey=` 且非 customProduct 路径 | `kfc_custom_product` | `kfc_custom_product_flow.py` |\r
| 4 | `kfc.woaicoffee.cn`(其他) | `kfc_city_store_booking` | `kfc_place_order_test_old.py` |\r
| 5 | `mdl.woaicoffee.cn` 且含 `cdkey=` 且非 customProduct 路径 | `mcd_custom_product` | `mcd_custom_product_flow.py` |\r
| 6 | `mdl.woaicoffee.cn`(其他) | `mcd_store_eattype` | `mcd_place_order_test.py` |\r
| 7 | 其他 | (空) | 仅打开浏览器 |\r
\r
主程序会输出一行 `flow_detected: \x3Cflow_code> -> \x3Cscript>` 便于日志与校验。\r
\r
## Required Per-Run Inputs (purchase flow)\r
- `--product-id`\r
- `--store-keyword`\r
- KFC flow only: `--city`\r
\r
Optional:\r
- `--store-name`\r
- `--pickup-type` (default `Dine-in` for McD / `外带` for KFC)\r
- `--pickup-time` (empty => immediate pickup)\r
- `--eat-type` (McD only, default `Dine-in`)\r
- `--kfc-store-code` (肯德基门店编号如 SHA391,VIP/customProduct 不填则用 city+store-keyword 调 API)\r
- `--booking-time` (肯德基 customProduct 预定时间编码,0=立即取餐)\r
- `--mcd-store-number` (麦当劳 customProduct 直接填门店编号,不填则用 store-keyword 调 API)\r
- `--wait-pickup-seconds` (麦当劳/肯德基 VIP 等待取餐码最大秒数,默认 60)\r
- `--list-products` (query only, no purchase)\r
- `--skip-flow` (return link only)\r
- `--allow-final-submit` (explicitly allow clicking final confirm)\r
- `--no-final-submit` (force stop; safety mode already stops)\r
\r
## Install\r
```bash\r
pip install -r requirements.txt\r
python -m playwright install chromium\r
```\r
\r
## Backend Requirement\r
Backend endpoint must be reachable:\r
- `KFC_PLATFORM_BASE_URL` or default `http://localhost:8888/api/openclaw`\r
- `POST /api/openclaw/products`: accepts username/phone + api_key\r
- `POST /api/openclaw/order`: validates balance (yuan), deducts cost, returns order link + `cost_yuan` / `balance_yuan` \r
- 肯德基 VIP 链接:`GET /api/openclaw/kfc/store?city=xxx&keyword=xxx` 返回 `{"store_code": "SHA391"}`(或 `storeCode`/`store`)\r
- 麦当劳 customProduct:`GET /api/openclaw/mcd/store?keyword=xxx` 返回 `{"store": "1450468"}`\r
\r
## Quick Start (recommended with env)\r
```bash\r
set KFC_PLATFORM_PHONE=13800138000\r
set KFC_PLATFORM_API_KEY=your_api_key\r
\r
python openclaw_skill.py --list-products\r
```\r
\r
Then purchase and auto-order:\r
```bash\r
python openclaw_skill.py --product-id 1 --city 上海 --store-keyword 金地新华道\r
```\r
\r
## 肯德基 customProduct 链接(kfc.woaicoffee.cn/?cdkey=...)\r
\r
当订单链接为 **肯德基 customProduct** 格式(`https://kfc.woaicoffee.cn/?cdkey=...`,且不是已带 `customProduct` 的完整链接)时,Skill 会:\r
\r
1. **转换链接**:用 `--city` + `--store-keyword` 调用后端 `GET /kfc/store?city=xxx&keyword=xxx` 获取门店编号,或直接使用 `--kfc-store-code`;`--booking-time` 为预定时间编码(默认 `0`=立即取餐)。生成:\r
`https://kfc.woaicoffee.cn/index/index/customProduct?cdkey=...&store=...&booking_time=...`\r
2. **浏览器流程**:打开转换后的链接 → 点击页面最下方红色「确认提交」→ 弹窗点「确认」完成下单 → 等待订单成功页、识别取餐码并截图,输出简要信息。\r
3. **输出**:取餐码、订单号、截图路径等通过 `print_chat_report` 输出给用户。\r
\r
**必填**:`--city` 与 `--store-keyword`(用于查门店)或 `--kfc-store-code`。 \r
**可选**:`--booking-time`(默认 0,立即取餐)、`--wait-pickup-seconds`(默认 60)。\r
\r
## 肯德基 VIP 兑换链接(vip.woaicoffee.com)\r
\r
当订单链接为 **肯德基 VIP** 格式(`https://vip.woaicoffee.com/?outId=xxx`)时,Skill 会:\r
\r
1. **浏览器步骤**:打开链接 → 点击「下一步」→ 若有定位权限弹窗则点击「访问该网站时允许」→ 从当前访问链接解析 `productId`。\r
2. **转换链接**:用 `--city` + `--store-keyword` 调用后端 `GET /kfc/store?city=xxx&keyword=xxx` 获取门店编号 `storeCode`,或直接使用 `--kfc-store-code`;生成:\r
`https://vip.woaicoffee.com/kfc/choose_specifications?outId=xxx&productId=393&storeCode=SHA391&sendPhoneMsg=false`\r
3. **下单**:打开上述链接 → 点击「下单」→ 二次确认弹窗点击「确认」→ 等待页面刷新出现取餐码(最多 `--wait-pickup-seconds` 秒)→ 将取餐信息返回用户。\r
\r
**必填**:`--city` 与 `--store-keyword`(用于查门店)或 `--kfc-store-code`(直接填门店编号如 SHA391)。 \r
**可选**:`--wait-pickup-seconds`(默认 60)。\r
\r
## 麦当劳 customProduct 链接(门店自提)\r
\r
当订单链接为 **麦当劳 customProduct** 格式(`https://mdl.woaicoffee.cn/?cdkey=...`,且不是已带 `customProduct` 的完整链接)时,Skill 会:\r
\r
1. **转换链接**:用 `--store-keyword` 调用后端 `GET /mcd/store?keyword=xxx` 获取门店编号,或直接使用 `--mcd-store-number`;`eat_type` 固定为 **门店自提**,生成:\r
`https://mdl.woaicoffee.cn/index/index/customProduct?cdkey=...&store=...&eat_type=门店自提`\r
2. **浏览器流程**:打开转换后的链接 → 点击页面底部红色「下单」→ 弹窗「请再次确认门店信息是否正确」中点击蓝色「就是这个餐厅」(不点「返回重选」)→ 等待下单成功页,最多 **1 分钟** 内获取取餐码/订单号。\r
3. **输出**:取餐信息、订单号、截图路径等通过 `print_chat_report` 输出给用户。\r
\r
**必填**:`--store-keyword`(用于查门店)或 `--mcd-store-number`(直接填门店编号)。 \r
**可选**:`--wait-pickup-seconds`(默认 60,等待取餐码最大秒数)。\r
\r
## 断连与恢复(大模型异常时在聊天框展示结果)\r
\r
当 OpenClaw 大模型断连或订单执行停滞时:\r
\r
1. **订餐链接已返回时**:Skill 在获得订餐链接后会**立即**输出可解析行,便于客户端/大模型从**已有输出**中提取并展示给用户:\r
- 标准输出中会有一行以 `OPENCLAW_FINAL_LINK:` 开头的订餐链接。\r
- 另有一行 `OPENCLAW_ORDER_STATE:` 开头的 JSON,含 `url`、`order_id`、`stage` 等。\r
- **建议**:大模型或调用方在断连、超时、异常时扫描本次调用的 stdout,若匹配到 `OPENCLAW_FINAL_LINK:`,则**直接在用户聊天框展示该链接**,并提示「订单已生成订餐链接,请点击使用」。\r
\r
2. **订单状态保存在用户本地**:每次下单/流程推进都会把当前阶段写入**本地目录**(默认 `skill/2.0.0/openclaw_order_state/`,可通过环境变量 `OPENCLAW_ORDER_STATE_DIR` 覆盖)。保存内容包括:`order_id`、`url`、`stage`(order_received / flow_running / flow_done / flow_failed)、取餐码等。该目录含订餐链接等敏感信息,已加入 `.gitignore`,请勿提交到版本库。\r
\r
3. **恢复后查询进度**:大模型恢复或用户询问「订单到哪了」时,可再次调用 Skill 的**查询模式**,从本地读取并返回当前阶段与订餐链接:\r
- 按幂等键查询:`--query-order \x3Cidempotency_key>`(与下单时使用的 `--idempotency-key` 一致)。\r
- 按订单 ID 查询:`--query-order-by-id \x3Corder_id>`。\r
- **列出本机最近订单**:`--list-local-orders` 输出最近约 20 条本地订单的 order_id、阶段、更新时间与链接摘要,用户说「我最近的订单」时先调此接口,再按 order_id 用 `--query-order-by-id` 查详情。\r
- 查询会输出阶段说明、订餐链接(若有)以及取餐码/订单号(若流程已跑完),并再次输出 `OPENCLAW_FINAL_LINK:` 行便于展示。\r
\r
**解析订餐链接(供调用方/大模型实现)**:从 Skill 的 **stdout** 中取**第一行**包含 `OPENCLAW_FINAL_LINK:` 的整行,**冒号后到行尾**的字符串 trim 后即为订餐链接 URL;可直接展示给用户或写入聊天框。\r
\r
**建议**:调用方在下单时传入固定的 `--idempotency-key`(例如由会话 ID 或用户 ID 生成),断连后即可用 `--query-order \x3C该 key>` 查询同一笔订单,无需用户提供 order_id。\r
\r
**示例**(查询本地进度):\r
```bash\r
python openclaw_skill.py --list-local-orders\r
python openclaw_skill.py --query-order abc123def456\r
python openclaw_skill.py --query-order-by-id 10086\r
```\r
\r
## 报错与处理建议\r
\r
流程脚本会在结果 JSON 中写入 `error`(详情)和 `error_code`(标准码)。主程序失败时会根据 `error_code` 输出处理建议。\r
\r
| error_code | 含义 | 处理建议 |\r
|------------|------|----------|\r
| `ELEMENT_NOT_FOUND` | 未找到页面上的预期按钮/文案 | 检查页面是否完全加载、网络是否稳定、门店是否营业、链接是否过期 |\r
| `TIMEOUT` | 页面加载或操作超时 | 检查网络或稍后重试;可适当增加 `--wait-pickup-seconds` |\r
| `NETWORK` | 网络请求失败 | 检查本机网络与后端/目标站点是否可达 |\r
| `API_ERROR` | 门店或订单接口返回异常 | 确认后端 `/kfc/store` 或 `/mcd/store` 已实现且返回正确格式;或直接传 `--kfc-store-code` / `--mcd-store-number` |\r
| `INVALID_URL` | 链接缺少必要参数(cdkey/outId等) | 确认订单接口返回的 url 格式正确 |\r
| `SUBMIT_ABORTED` | 已按配置在最终确认前停止 | 若需真实下单请使用 `--allow-final-submit` |\r
| `SCRIPT_NOT_FOUND` | 流程脚本文件不存在 | 确认 skill 目录完整,包含对应 .py 脚本 |\r
| `RESULT_READ_ERROR` | 无法解析流程结果 | 查看 outputs 目录下最新 JSON 与截图排查 |\r
安全使用建议
Before installing or running this skill: 1) Treat the KFC_PLATFORM_API_KEY and phone as secrets — the skill will POST them to whatever backend base URL you configure. Do not provide real credentials unless you trust that backend. 2) The registry metadata omitted required env vars; verify and set KFC_PLATFORM_BASE_URL to a backend you control or trust (default points to https://www.clawauto.shop). 3) Run it in an isolated environment (container or VM) because it will install Playwright/Chromium, perform browser automation on external vendor sites, and write files/screenshots locally. 4) Use the safety flags (--no-final-submit is the default safety mode) to avoid accidental real purchases, and inspect the code (openclaw_skill.py and the flow scripts) yourself to confirm behaviour. 5) If you need higher assurance, host a private backend implementing the described endpoints and point KFC_PLATFORM_BASE_URL to it, or ask the publisher for provenance and privacy guarantees. The current mismatch between claimed 'no env vars required' and the code's actual needs is the main red flag.
功能分析
Type: OpenClaw Skill
Name: clawauto-shop
Version: 2.0.2
The skill bundle is a legitimate automation tool for ordering food from KFC and McDonald's via the 'clawauto.shop' platform. It uses Playwright for browser automation and the 'requests' library to interact with a backend API. The main script, 'openclaw_skill.py', orchestrates several sub-scripts (e.g., 'kfc_custom_product_flow.py', 'mcd_place_order_test.py') to handle different ordering flows. While it handles sensitive data like API keys and phone numbers, these are used exclusively for authentication with the user-configured backend (defaulting to 'www.clawauto.shop'). The instructions in 'SKILL.md' are functional and aimed at helping the AI agent manage order states and handle disconnections, with no evidence of malicious prompt injection or unauthorized data access.
能力评估
Purpose & Capability
The code and SKILL.md clearly require a platform identity (phone/username) and an API key plus a backend base URL, but the registry metadata lists no required environment variables or primary credential — a clear mismatch. Sending phone + API key to a backend is consistent with the stated purpose only if that backend is trusted; the skill's source/homepage are unknown and the default production base URL (https://www.clawauto.shop/api/openclaw) is bundled in the .env and code, which is not declared in registry metadata.
Instruction Scope
SKILL.md and the Python scripts instruct the agent to call the backend endpoints (/products, /order, /order/status) and then run Playwright-driven browser automation on KFC/McD vendor pages to click buttons and scrape pickup codes. That is in-scope for the described purpose. However the instructions explicitly recommend creating a .env with KFC_PLATFORM_API_KEY and KFC_PLATFORM_PHONE and default to the clawauto.shop backend, meaning user credentials are transmitted to that external service. The scripts also write order state and screenshots to local disk (outputs/ and order_state subdir).
Install Mechanism
No packaged install spec is provided; the README asks you to pip install requirements.txt and run 'python -m playwright install chromium', which is normal for Playwright-based automation. There are no exotic downloads from unknown hosts in the install instructions, though Playwright will fetch Chromium from its official distribution during install (network activity).
Credentials
The skill requires sensitive runtime config (phone/username and API key) and a backend base URL, but the registry metadata claims none. Environment variables used in code (KFC_PLATFORM_PHONE, KFC_PLATFORM_API_KEY, KFC_PLATFORM_BASE_URL[_PROD/_DEV]) are not declared in the provided registry 'Required env vars' block — this omission is a proportionality/information problem. The skill will POST that identity+API key to the configured backend (defaulting to clawauto.shop), which is necessary for its workflow but should have been declared and justified in metadata and documentation about who operates the backend.
Persistence & Privilege
The skill does not request 'always: true' and uses normal autonomous invocation defaults. It writes order state files and screenshots to local directories under its own folder (outputs/ and order_state/), which is expected for this functionality. It does not appear to modify other skills or global agent settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install clawauto-shop - 安装完成后,直接呼叫该 Skill 的名称或使用
/clawauto-shop触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.2
Version 2.0.2
- No file changes detected for this release.
- No updates or modifications to code or documentation compared to the previous version.
- All functionality remains as in the prior release.
This skill automates KFC/McD order-link flows via a user-configured backend.
It sends phone + API key + order parameters to the configured backend URL.
By default, browser flow stops before final confirmation. Final submit is opt-in.
For testing, use a controlled backend/account and keep --no-final-submit behavior.
- Renamed skill to clawauto-shop.
- Declared required env vars and primary credential in registry metadata.
- Clarified external backend usage and order-risk behavior.
- Added explicit safety guidance (default no-final-submit, production caution).
v2.0.1
clawauto-shop 2.0.1
- Added an `.env` file template for easier configuration of environment variables.
- Updated documentation: clarified instructions for creating and configuring the `.env` file.
- No core functionality changes; setup and onboarding details improved for smoother setup.
v2.0.0
**OpenClaw shop ordering flow overhaul with local persistence & enhanced CLI:**
- Automated full order flows for KFC and McDonald's based on backend-generated URLs, supporting both customProduct and VIP links.
- New env-based and CLI runtime configuration, including user phone, API key, and backend API URLs.
- Major upgrade: Per-order status persistence with local directory for recovering/continuing order progress after interruption, and CLI for querying/re-listing previous orders.
- Standardized purchase CLI arguments for product, store, pickup configuration, and safe controls (e.g., --allow-final-submit, --skip-flow).
- Flow auto-detection and scripting based on order link, with detailed mapping table and robust output for integration.
- Enhanced error reporting and recovery, including outputs to stdout for final order links and local status snapshots for user/client reference.
元数据
常见问题
clawauto-shop 是什么?
Automates KFC and McDonald's order flows by converting backend order links into browser actions to confirm and retrieve pickup codes and order info. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 105 次。
如何安装 clawauto-shop?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install clawauto-shop」即可一键安装,无需额外配置。
clawauto-shop 是免费的吗?
是的,clawauto-shop 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
clawauto-shop 支持哪些平台?
clawauto-shop 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 clawauto-shop?
由 wananbaby(@wananbaby)开发并维护,当前版本 v2.0.2。
推荐 Skills