← Back to Skills Marketplace
tujinsama

Historical Data Compare Claw

by Ricky · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
152
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install historical-data-compare-claw
Description
历史数据比对虾 — 专注于环比、同比、趋势等数据差异分析。激活场景:当用户提供两期或多期历史数据(Excel/CSV/数据库导出等),要求进行同比分析、环比分析、趋势对比、差异排查、变动归因、KPI变动说明、或"和上个月比怎么样"、"今年比去年如何"等数据对比类问题时触发。也适用于多维度数据切片对比(按区域、品类...
README (SKILL.md)

历史数据比对虾 🦐

核心职责:进行环比、同比、趋势等数据差异分析。 业务价值:趋势洞察——翻阅历史记录,清晰告诉决策者当下的变量。

分析流程

1. 数据接入与校验

  • 接收用户提供的数据文件(Excel、CSV、数据库导出等),读取并理解数据结构
  • 识别时间维度列(日期、月份、季度、年份等)和指标列(金额、数量、占比等)
  • 检查数据质量:缺失值、异常值、重复行
  • 确认对比基准期:环比 → 上期(日→昨日、月→上月、季→上季、年→上年);同比 → 去年同期

2. 选择分析方法

根据用户需求自动匹配分析类型:

分析类型 适用场景 计算方式
环比 (MoM/QoQ/DoD) 连续两期对比,观察短期变化 (本期-上期)/上期 × 100%
同比 (YoY) 剔除季节性,观察真实增长 (本期-去年同期)/去年同期 × 100%
累计对比 年度/季度累计完成进度 本期累计 vs 去年同期累计
滚动趋势 消除短期波动,观察中长期走势 移动平均、滚动N期对比
多维拆解 定位变动来源 按区域/品类/渠道等维度拆解贡献度

3. 执行计算

优先使用 scripts/compare.py 脚本处理结构化数据文件,适合重复性高的标准分析。脚本用法:

python3 scripts/compare.py \x3Cfile_path> --date-col \x3C列名> --metric-cols \x3C列1,列2> --compare \x3Cyoy|mom|both> --period \x3Cmonthly|quarterly|daily> [--output \x3C输出路径>]

参数说明:

  • file_path: 数据文件路径(支持 .xlsx / .csv)
  • date-col: 日期/时间维度列名
  • metric-cols: 需要对比的指标列(逗号分隔)
  • compare: yoy(同比)、mom(环比)、both(同时)
  • period: 数据粒度 daily/monthly/quarterly
  • --output: 输出文件路径(默认打印到 stdout)

脚本输出格式:带变动率和变动绝对值的对比表 + 汇总摘要。

4. 差异归因

当发现显著变动(涨跌超过 ±10% 或用户关注的阈值)时:

  1. 量化变动幅度:绝对值变动 + 百分比变动
  2. 定位变动来源:按维度拆解(品类/区域/渠道等),找出贡献最大的子维度
  3. 判断变动性质
    • 🔴 警示:核心指标大幅下滑或异常波动
    • 🟡 关注:中等幅度变动,需持续观察
    • 🟢 正常:合理范围内的季节性或预期内波动
  4. 提炼变量:用一句话说清楚"为什么变了"

5. 输出报告

报告结构

## 📊 [分析主题] — [对比类型]分析报告

### 一、核心结论(先说结论)
> 用 2-3 句话总结关键发现和决策含义。

### 二、整体对比概览
| 指标 | 基准期 | 对比期 | 变动额 | 变动率 | 趋势 |
|------|--------|--------|--------|--------|------|

### 三、明细差异拆解
按维度展开,展示各子维度的贡献度。

### 四、趋势洞察
- 连续N期的趋势走向
- 是否存在拐点/异常点
- 与行业/预算参考线的关系

### 五、行动建议
针对发现的问题/机会,给出 2-3 条可落地的建议。

输出格式选择

  • 飞书/即时通讯场景 → 用 emoji + 粗体 + 列表,不用 markdown 表格
  • 正式报告场景 → 完整 markdown 表格 + 图表建议
  • 文件导出 → Excel(带格式)或 PDF

分析原则

  1. 结论先行:先说"变了什么、变了多少、意味着什么",再展开细节
  2. 用数据说话:每个结论都要有数字支撑,避免"有所增长"这种模糊表述
  3. 区分信号和噪音:不要把正常波动渲染成危机,也不要忽略真正的趋势拐点
  4. 对标意识:有预算/目标/行业数据时,主动做对比参照
  5. 可操作性:分析结果的终点是"所以呢",必须给出行动建议

常见场景速查

场景 推荐方法
"这个月和上个月比怎么样" 环比 + 维度拆解
"今年比去年同期如何" 同比 + 累计对比
"最近几个月趋势怎么样" 滚动趋势(3/6/12期移动平均)
"为什么收入掉了" 差异归因 → 按维度拆解贡献度
"哪个品类贡献了增长" 多维拆解 → 贡献度排序
"给老板出个月度分析" 环比+同比 + 报告格式输出
Usage Guidance
This skill appears coherent and local-only, but a few practical checks are recommended before installing/using it: 1) Run the script in a controlled environment (e.g., a project virtualenv or container) and install dependencies (pandas, and openpyxl/xlrd if you need .xlsx support). 2) Verify that input files you pass are the files you intend to analyze (the script will read whatever file path you provide). 3) If you need to run this in a production/automated agent, review the script to ensure its output formatting and period-parsing logic match your data conventions (shift_period uses simple string parsing and may not cover all date/period formats). 4) If you require network isolation or stricter auditing, run it in an environment without network access — the code makes no network calls by itself. If you want extra assurance, run a code review or static analysis locally.
Capability Analysis
Type: OpenClaw Skill Name: historical-data-compare-claw Version: 1.0.0 The skill bundle is a legitimate tool for historical data comparison (YoY, MoM, and trend analysis). The core logic resides in `scripts/compare.py`, which uses the Pandas library to process Excel and CSV files, and the instructions in `SKILL.md` are strictly aligned with data analysis tasks without any signs of prompt injection or malicious intent.
Capability Assessment
Purpose & Capability
Name/description (historical data compare) matches the included SKILL.md and the included script (scripts/compare.py). The script implements parsing, aggregation, MoM/YoY calculations and report formatting that are exactly what the skill advertises; no unrelated binaries, env vars, or services are requested.
Instruction Scope
Runtime instructions are narrowly scoped to accepting user-supplied data files, validating columns, running the included Python script, performing comparisons, and producing reports. The SKILL.md does not instruct reading unrelated system files, environment secrets, or sending data to external endpoints.
Install Mechanism
No install spec (instruction-only) — lowest risk. There is a bundled Python script that depends on pandas (and for .xlsx may need openpyxl/xlrd), but the skill does not declare or install these dependencies. Users should ensure required Python packages are available in the execution environment.
Credentials
The skill requests no environment variables, credentials, or config paths. Its behavior is limited to processing files supplied by the user and writing output to the chosen path, which is proportionate to its stated purpose.
Persistence & Privilege
always is false and the skill does not request persistent or elevated privileges. It does not modify other skills or system-wide settings. The script may write an output file if --output is provided, which is normal for a report generator.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install historical-data-compare-claw
  3. After installation, invoke the skill by name or use /historical-data-compare-claw
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
初始发布:历史数据环比同比分析
Metadata
Slug historical-data-compare-claw
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Historical Data Compare Claw?

历史数据比对虾 — 专注于环比、同比、趋势等数据差异分析。激活场景:当用户提供两期或多期历史数据(Excel/CSV/数据库导出等),要求进行同比分析、环比分析、趋势对比、差异排查、变动归因、KPI变动说明、或"和上个月比怎么样"、"今年比去年如何"等数据对比类问题时触发。也适用于多维度数据切片对比(按区域、品类... It is an AI Agent Skill for Claude Code / OpenClaw, with 152 downloads so far.

How do I install Historical Data Compare Claw?

Run "/install historical-data-compare-claw" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Historical Data Compare Claw free?

Yes, Historical Data Compare Claw is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Historical Data Compare Claw support?

Historical Data Compare Claw is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Historical Data Compare Claw?

It is built and maintained by Ricky (@tujinsama); the current version is v1.0.0.

💬 Comments