Xpersona
S

store-order-query

CLAWHUB · Unverified

query store order information from database Skill: store-order-query Owner: bondli Summary: query store order information from database Tags: latest:1.0.0 Version history: v1.0.0 | 2026-03-24T10:19:31.182Z | user Initial release of store-order-query skill. - Allows querying store order information from a MySQL database. - Supports flexible queries by time range and analysis dimension (order count, revenue, items, payment methods). - Includes setup workflow for

62
Rank
84
Safety
1.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s177p2wmp8es5mem55h55wyq7183h7bj:store-order-query
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-bondli-store-order-query/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

11,153 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: store-order-query
description: query store order information from database
---

# Store Order Query Skill

## 技能描述

这是一个通过连接MySQL数据库查询店铺订单的 Skill。当用户询问店铺订单情况时(如"查询今天店铺订单"、"今天的订单怎么样"、"店铺经营情况"),使用此 Skill 连接数据库查询订单数据,并生成分析报告。

## 使用场景

- 用户想查询特定时间段的订单数据
- 用户想了解店铺经营状况
- 用户想分析订单中的商品销售情况
- 用户想查看支付方式分布

## 工作流程

### step1. 检查配置文件

首先检查是否存在数据库配置文件 `~/openclaw-skill-data/store-order-query/config.json`。

**如果配置文件不存在**,需要询问用户以下信息:
- MySQL数据库主机地址
- 数据库端口(默认3306)
- 数据库名称
- 数据库用户名
- 数据库密码

然后基于 `config.example.json` 创建 `config.json` 文件。

### step2. 解析用户查询意图

从用户的查询中提取:
- **时间范围**: 今天、昨天、最近7天、最近30天等
- **查询维度**: 订单量、金额、商品、支付方式等

如果用户说"今天",则查询当天的订单数据。

### step3. 执行查询脚本

调用以下命令查询订单数据,传递参数:
- `--date-range`: 时间范围 (today/yesterday/last7days/last30days 或 custom)
- `--start-date`: 开始日期 (YYYY-MM-DD 格式,可选)
- `--end-date`: 结束日期 (YYYY-MM-DD 格式,可选)

```
node dist/index.js --date-range today
```

脚本会:
1. 读取配置文件连接MySQL数据库
2. 查询Order表获取订单数据
3. 根据订单号查询OrderItems表获取商品信息
4. 将数据保存到 `~/openclaw-skill-data/store-order-query/orders_data.json`

### step4. 分析数据并生成报告

调用以下命令分析订单数据并生成报告:

```
node dist/analyze-orders.js
```

脚本会:
1. 读取 `~/openclaw-skill-data/store-order-query/orders_data.json`
2. 进行数据分析(订单量、总金额、支付方式分布、商品分析等)
3. 生成 Markdown 格式的报告保存到 `~/openclaw-skill-data/store-order-query/order_report.md`

### 5. 呈现报告

读取生成的报告文件,向用户展示分析结果。

## 配置文件格式

`~/openclaw-skill-data/store-order-query/config.json` 示例:

```json
{
  "database": {
    "type": "mysql",
    "host": "localhost",
    "port": 3306,
    "database": "shop_db",
    "user": "root",
    "password": "your_password"
  },
  "tables": {
    "orders": "Order",
    "order_items": "OrderItems"
  },
  "fields": {
    "orders": {
      "id": "orderSn",
      "created_at": "createdAt",
      "total_amount": "orderActualAmount",
      "payment_method": "payType",
      "status": "orderStatus"
    },
    "order_items": {
      "order_id": "orderSn",
      "product_name": "name",
      "sku": "sku",
      "quantity": "counts",
      "price": "actualPrice"
    }
  }
}
```

## 数据库表结构

### Order 表(订单表)

| 字段 | 类型 | 说明 |
|------|------|------|
| orderSn | VARCHAR(50) | 订单号(主键) |
| createdAt | DATETIME | 创建时间 |
| orderActualAmount | DECIMAL(10,2) | 订单实际金额 |
| payType | VARCHAR(50) | 支付方式 |
| orderStatus | VARCHAR(20) | 订单状态 |

### OrderItems 表(订单商品表)

| 字段 | 类型 | 说明 |
|------|------|------|
| id | INT | 主键ID |
| orderSn | VARCHAR(50) | 订单号(外键) |
| name | VARCHAR(200) | 商品名称 |
| sku | VARCHAR(100) | SKU |
| counts | INT | 数量 |
| actualPrice | DECIMAL(10,2) | 实际价格 |

## 注意事项

1. 确保已在根目录安装依赖:`pnpm install`
2. 配置文件包含敏感信息,不要将其提交到公共仓库
3. 首次使用时需要配置数据库信息
4. 确保MySQL数据库用户有读取Order和OrderItems表的权限
5. 生成的报告会保存在 output 目录中,可以重复查看

## 错误处理

- 如果数据库连接失败,提示用户检查配置信息
- 如果查询结果为空,提示用户该时间段没有订单数据
- 如果表或字段不存在,提示用户检查配置文件中的字段映射

README.md

# Store Order Query Skill

通过连接MySQL数据库实现 **查询店铺订单** 的 OpenClaw Skill。

该 Skill 会读取数据库配置信息,连接MySQL数据库进行订单数据查询,最后对数据进行呈现和分析。

## 功能特性

- 专为MySQL数据库设计
- 支持实际业务表结构(Order、OrderItems)
- 多种查询时间范围:今天、昨天、最近7天、最近30天、自定义日期
- 自动生成详细的 Markdown 分析报告
- 订单数据、商品销售、SKU分析全面覆盖

## 交互形态

1. 用户输入查询诉求(如:"查询今天店铺订单"、"今天的订单怎么样")
2. Agent 检查是否有配置文件,如无则引导用户配置数据库信息
3. Agent 执行查询脚本获取订单数据
4. Agent 执行分析脚本生成报告并展示给用户

## 快速开始

### 1. 配置数据库

复制 `config.example.json` 为 `config.json`,并修改数据库配置:

```bash
cp config.example.json config.json
```

编辑 `config.json`,填入你的MySQL数据库信息:

```json
{
  "database": {
    "type": "mysql",
    "host": "localhost",
    "port": 3306,
    "database": "shop_db",
    "user": "root",
    "password": "your_password"
  },
  "tables": {
    "orders": "Order",
    "order_items": "OrderItems"
  },
  "fields": {
    "orders": {
      "id": "orderSn",
      "created_at": "createdAt",
      "total_amount": "orderActualAmount",
      "payment_method": "payType",
      "status": "orderStatus"
    },
    "order_items": {
      "order_id": "orderSn",
      "product_name": "name",
      "sku": "sku",
      "quantity": "counts",
      "price": "actualPrice"
    }
  }
}
```

### 2. 测试数据库(可选)

如果你想快速测试,可以使用提供的示例数据库脚本:

```bash
mysql -u root -p < scripts/example_database.sql
```

这会创建 `Order` 和 `OrderItems` 表,并插入一些测试数据。

### 3. 查询订单

```bash
# 查询今天的订单
pnpm run query -- --date-range today

# 查询昨天的订单
pnpm run query -- --date-range yesterday

# 查询最近7天的订单
pnpm run query -- --date-range last7days

# 查询自定义日期范围
pnpm run query -- --date-range custom --start-date 2024-01-01 --end-date 2024-01-31
```

### 4. 生成分析报告

```bash
pnpm run analyze
```

**一键查询并分析:**

```bash
pnpm run query-today
```

报告将保存到 `output/order_report.md`。

## 生成的数据

1. **订单原始数据** (`output/orders_data.json`)
   - 符合查询条件的订单数据
   - 关联的商品信息

2. **分析报告** (`output/order_report.md`)
   - 总体概况:订单量、总金额、平均订单金额、商品总数
   - 支付方式分布
   - 订单状态分布
   - 热销商品 TOP 10
   - SKU 销售分析(尺码、颜色等)

## 目录结构

```
store-order-query/
├── SKILL.md                    # Skill 定义文件
├── README.md                   # 使用说明
├── package.json                # 依赖配置
├── tsconfig.json               # TypeScript 配置
├── config.example.json         # 配置文件示例
├── config.json                 # 实际配置文件(需自行创建)
├── src/
│   ├── index.ts                # 订单查询入口
│   └── analyze-orders.ts       # 数据分析入口
├── scripts/
│   └── example_database.sql   # 示例数据库脚本
└── output/                     # 输出目录(自动创建)
    ├── orders_data.json        # 订单原始数据
    └── order_report.md         # 分析报告
```

## 数据库表结构

### Order 表(订单表)

```sql
CREATE TABLE `Order` (
    `orderSn` VARCHAR(50) PRIMARY KEY COMMENT '订单号',
    `createdAt` DATETIME NOT NULL COMMENT '创建时间',
    `orderActualAmount` DECIMAL(10, 2) NOT NULL COMMENT '订单实际金额',
    `payType` VARCHAR(50) COMMENT '支付方式',
    `orderStatus` VARCHAR(20) COMMENT '订单状态',
    INDEX `idx_createdAt` (`createdAt`)
);
```

### OrderItems 表(订单商品表)

```sql
CREATE TABLE `OrderItems` (
    `id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID',
    `orderSn` VARC

_meta.json

{
  "ownerId": "kn7dn89w0a1y0hd6q3ycxy74ss8294g3",
  "slug": "store-order-query",
  "version": "1.0.0",
  "publishedAt": 1774347571182
}

skill-card.md

## Description:

Queries store order information from a MySQL database and generates an order analysis report.

This skill is ready for commercial/non-commercial use.

## Publisher:

[bondli](https://clawhub.ai/user/bondli)

### License/Terms of Use:

MIT-0

## Use Case:

Store operators, analysts, and developers use this skill to query MySQL order and order-item tables by date range, then produce sales, payment, status, product, and SKU analysis.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill needs read access to a store database and stores database credentials in a local plaintext configuration file.

Mitigation: Use a read-only database account limited to the required order tables, restrict local access to the skill data directory, and keep the config file out of repositories and shared backups.

Risk: The skill stores raw order exports and generated reports on the local machine.

Mitigation: Treat generated files as sensitive business data, keep the data directory private, and delete exports and reports when they are no longer needed.

Risk: The security guidance calls out verifying the mysql2 dependency version before deployment.

Mitigation: Review and update the mysql2 dependency as part of deployment approval.

## Reference(s):

- [ClawHub skill page](https://clawhub.ai/bondli/skills/store-order-query)

## Skill Output:

**Output Type(s):** [text, markdown, shell commands, configuration, guidance]

**Output Format:** [Markdown report, JSON order export, and terminal status text]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Requires local database configuration and writes order data plus reports to the local skill data directory.]

## Skill Version(s):

1.0.0 (source: ClawHub release metadata; artifact package.json reports 1.0.2)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

config.example.json

{
  "database": {
    "type": "mysql",
    "host": "localhost",
    "port": 3306,
    "database": "shop_db",
    "user": "root",
    "password": "your_password"
  },
  "tables": {
    "orders": "Order",
    "order_items": "OrderItems"
  },
  "fields": {
    "orders": {
      "id": "orderSn",
      "created_at": "createdAt",
      "total_amount": "orderActualAmount",
      "payment_method": "payType",
      "status": "orderStatus"
    },
    "order_items": {
      "order_id": "orderSn",
      "product_name": "name",
      "sku": "sku",
      "quantity": "counts",
      "price": "actualPrice"
    }
  }
}

Sponsored

Ads related to store-order-query and adjacent AI workflows.