Skill: 52yuanchangxing/receipt-expense-workbench (version 1.0.0)

--- name: receipt-expense-workbench description: Normalize receipts, reimbursement slips, and invoices into a clean expense ledger with category mapping and anomaly flags. version: 1.1.0 metadata: openclaw: requires: bins: - python3 emoji: 🧰 --- # Receipt Expense Workbench ## Purpose Normalize receipts, reimbursement slips, and invoices into a clean expense ledger with category mapping and anomaly flags. ## Trigger phrases - 整理发票 - 报销单汇总 - receipt to expense sheet - 做费用台账 - expense ledger ## Ask for these inputs - receipt text or OCR output - currency - reimbursement policy if available - project code - merchant names ## Workflow 1. Extract vendor, date, amount, tax, and payment method. 2. Map each line item to the bundled category list. 3. Flag duplicates, suspicious totals, missing tax IDs, and missing attachments. 4. Generate a ledger CSV and a reimbursement-ready summary. 5. Keep uncertain fields clearly marked instead of guessing. ## Output contract - expense ledger CSV - category summary - anomaly report - reimbursement packet checklist ## Files in this skill - Script: `{baseDir}/scripts/expense_ledger.py` - Resource: `{baseDir}/resources/expense_categories.csv` ## Operating rules - Be concrete and action-oriented. - Prefer preview / draft / simulation mode before destructive changes. - If information is missing, ask only for the minimum needed to proceed. - Never fabricate metrics, legal certainty, receipts, credentials, or evidence. - Keep assumptions explicit. ## Suggested prompts - 整理发票 - 报销单汇总 - receipt to expense sheet ## Use of script and resources Use the bundled script when it helps the user produce a structured file, manifest, CSV, or first-pass draft. Use the resource file as the default schema, checklist, or preset when the user does not provide one. ## Boundaries - This skill supports planning, structuring, and first-pass artifacts. - It should not claim that files were modified, messages were sent, or legal/financial decisions were finalized unless the user actually performed those actions. ## Compatibility notes - Directory-based AgentSkills/OpenClaw skill. - Runtime dependency declared through `metadata.openclaw.requires`. - Helper script is local and auditable: `scripts/expense_ledger.py`. - Bundled resource is local and referenced by the instructions: `resources/expense_categories.csv`.

path: CHANGELOG.md
content: # Changelog

## 1.0.0
- Initial release.


path: README.md
content: # Receipt Expense Workbench

Slug: `receipt-expense-workbench`

## 功能定位

Normalize receipts, reimbursement slips, and invoices into a clean expense ledger with category mapping and anomaly flags.

## 适用场景

- 当用户需要：整理发票
- 当用户手头已有原始材料，需要快速整理成可执行输出
- 当用户希望先预览方案、再决定是否落盘或批量处理

## 安装要求

- OpenClaw / AgentSkills 兼容目录结构
- `python3` 可执行文件在 PATH 中可用
- 无远程安装脚本、无隐藏联网依赖、无未声明凭据要求

## 目录结构

- `SKILL.md`：触发描述、工作流、输出契约
- `scripts/expense_ledger.py`：本地辅助脚本
- `resources/expense_categories.csv`：被 SKILL/README 引用的资源文件
- `examples/example-prompt.md`：触发与输入示例
- `tests/smoke-test.md`：最小冒烟测试
- `SELF_CHECK.md`：规范与安全自检
- `CHANGELOG.md`：变更记录

## 触发示例

- `整理发票`
- `报销单汇总`
- `receipt to expense sheet`
- `做费用台账`
- `expense ledger`

## 建议输入

- receipt text or OCR output
- currency
- reimbursement policy if available
- project code
- merchant names

## 预期输出

- expense ledger CSV
- category summary
- anomaly report
- reimbursement packet checklist

## 辅助脚本

脚本：`scripts/expense_ledger.py`

建议先运行帮助信息确认参数：

```bash
python3 scripts/expense_ledger.py --help
```

该脚本设计原则：

- 本地执行，便于审计与回滚
- 输入输出路径显式传入
- 不使用 `curl|bash`、远程直灌、base64 混淆执行
- 仅处理用户明确提供的文件或目录

## 输入输出示例

输入示例见：`examples/example-prompt.md`

输出示例建议至少包含：

- 结构化主结果
- 未决问题 / 风险项
- 可交付给他人的摘要或清单

## 常见问题

### 1. 这个 skill 会直接改我的文件吗？

默认不应直接进行破坏性批量操作；应优先生成预览、清单或草案，只有在用户明确要求时才建议执行进一步动作。

### 2. 这个 skill 需要联网吗？

当前目录内未声明联网依赖，也没有内置远程下载步骤。是否联网应由具体会话任务决定，而不是由 skill 包本身强制触发。

### 3. 资源文件的作用是什么？

`resources/expense_categories.csv` 为脚本或说明提供模板、规则、清单或模式参考，便于输出格式统一、可复用、可审计。

## 风险提示

- 对用户提供的数据、文本、截图或本地文件进行整理时，应先确认范围与目标。
- 涉及重命名、移动、合并、覆盖、生成正式对外内容时，应先给预览版本。
- 对不确定字段使用“待确认”标记，不应编造事实。

## 安全审计结论

- 依赖边界：仅声明 `python3`
- 凭据边界：未声明环境变量依赖
- 执行边界：本地脚本、本地资源、显式输入
- 高风险模式检查：未引入 `curl|bash`、远程管道执行、混淆载荷或私有 API 绑定


path: SELF_CHECK.md
content: # SELF_CHECK — receipt-expense-workbench

## 1. 规范检查

- [x] Skill 为独立文件夹
- [x] 包含 `SKILL.md`
- [x] `SKILL.md` 使用 YAML frontmatter
- [x] frontmatter 含 `name`、`description`、`version`
- [x] 运行依赖声明在 `metadata.openclaw.requires`
- [x] 包含 `README.md`
- [x] 包含 `scripts/` 且至少 1 个脚本
- [x] 包含 `resources/` 且至少 1 个资源文件
- [x] 包含 `examples/example-prompt.md`
- [x] 包含 `tests/smoke-test.md`

## 2. 路径与引用检查

- [x] `SKILL.md` 中引用了 `scripts/expense_ledger.py`
- [x] `SKILL.md` 中引用了 `resources/expense_categories.csv`
- [x] `README.md`、`SELF_CHECK.md`、`tests/smoke-test.md` 路径与当前目录一致
- [x] 打包后无需依赖绝对路径

## 3. 依赖与脚本检查

- [x] 仅声明 `python3` 作为运行依赖
- [x] 脚本为明文、可审计、本地执行
- [x] 脚本参数通过 CLI 显式传入
- [x] 无未声明环境变量依赖
- [x] 无未声明安装动作

## 4. 资源检查

- [x] 资源文件存在且为真实内容
- [x] 资源用途与 skill 目标一致
- [x] 资源已在说明中被引用

## 5. 安全检查

- [x] 未发现 `curl|bash`
- [x] 未发现远程下载后直接执行
- [x] 未发现 base64/混淆载荷执行
- [x] 未发现越权监控、盗号、破解、恶意抓取设计
- [x] 文件读写范围应由用户明确指定

## 6. 热门度与实用性复核

- 高频需求：是
- 低理解门槛：是
- 易传播：是
- 可二次定制：是
- 维护成本：低到中

## 7. 评分

- 规范完整度：9.5/10
- 可用性：9.0/10
- 安全性：9.5/10
- 可维护性：9.0/10
- 综合评分：9.3/10

## 8. 结论

该 skill 已补齐交付级目录结构，适合纳入统一 bundle 分发。后续若要继续增强，优先方向是增加更贴近真实场景的样例输入与回归测试数据。


path: scripts/expense_ledger.py
content: #!/usr/bin/env python3
import argparse, csv, json, re
from decimal import Decimal

CATEGORY_HINTS = {
    "uber":"Travel","flight":"Travel","hotel":"Travel","taxi":"Travel",
    "lunch":"Meals","dinner":"Meals","coffee":"Meals",
    "adobe":"Software","notion":"Software","figma":"Software",
    "office":"Office","paper":"Office","printer":"Office",
}

def categorize(text):
    low = text.lower()
    for key, cat in CATEGORY_HINTS.items():
        if key in low:
            return cat
    return "Other"

def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("items_json", help="JSON list with vendor/date/amount/description")
    ap.add_argument("--out", default="expense_ledger.csv")
    args = ap.parse_args()
    items = json.load(open(args.items_json, "r", encoding="utf-8"))
    fields = ["vendor","date","amount","currency","description","category","flag"]
    with open(args.out, "w", encoding="utf-8", newline="") as f:
        w = csv.DictWriter(f, fieldnames=fields)
        w.writeheader()
        for item in items:
            desc = item.get("description","")
            amt = str(item.get("amount",""))
            flag = "check" if not amt else ""
            w.writerow({
                "vendor": item.get("vendor",""),
                "date": item.get("date",""),
                "amount": amt,
                "currency": item.get("currency",""),
                "description": desc,
                "category": item.get("category") or categorize(desc + " " + item.get("vendor","")),
                "flag": flag
            })
    print(f"Wrote {args.out}")

if __name__ == "__main__":
    main()


path: examples/example-prompt.md
content: # Receipt Expense Workbench 示例

## 示例触发词

- 整理发票
- 报销单汇总
- receipt to expense sheet
- 做费用台账
- expense ledger

## 示例输入

- receipt text or OCR output
- currency
- reimbursement policy if available
- project code
- merchant names

## 示例请求

请使用 `receipt-expense-workbench`，基于我提供的材料，按照 skill 中的工作流给出：

1. expense ledger CSV
1. category summary
1. anomaly report
1. reimbursement packet checklist

## 说明

- 先给预览稿或结构化草案
- 信息不足时，只补问最关键缺口
- 不要编造未提供的事实


path: tests/smoke-test.md
content: # Smoke test — receipt-expense-workbench

## 目标

验证该 skill 具备最小可用交付结构，且本地辅助脚本可被解释器加载。

## 检查项

1. `SKILL.md` 存在，且 frontmatter 含 `name`、`description`、`version`
2. `README.md`、`SELF_CHECK.md`、`examples/example-prompt.md` 存在
3. `scripts/` 下至少有一个可执行脚本
4. `resources/` 下至少有一个真实资源文件
5. 运行 `python3 scripts/expense_ledger.py --help` 返回退出码 0

## 人工验证

- 用 `examples/example-prompt.md` 中的触发词在会话中调用 skill
- 检查输出是否覆盖以下内容：
  - expense ledger CSV
  - category summary
  - anomaly report
  - reimbursement packet checklist
- 检查是否优先给出预览、草案或确认步骤，而非直接做破坏性操作

## 通过标准

全部检查项通过，即视为 smoke test 通过。


path: resources/expense_categories.csv
content: category,description
Travel,Flights trains taxis hotels
Meals,Client or team meals
Software,SaaS subscriptions and licenses
Office,Office supplies and equipment
Marketing,Ads design printing events
Training,Courses books certifications
Other,Unmapped or exceptional items


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)