SuperAPI AI 工具集

stripe-refund-auditor

数据与分析

查看项目

更新于 10-15 19:57

技能介绍

用途:审计 Stripe 退款,在给定日期范围内发现异常,包括退款率飙升、缺少退款原因、可疑重复退款,并输出 Markdown 报告。触发场景:用户要求“审计最近 30 天的 Stripe 退款”“检查 Stripe 退款异常”“审查自某日期起的退款活动”等。

主要能力:从环境变量或同目录 .env.local 读取 STRIPE_API_KEY;运行 scripts/audit.py 分页拉取 /v1/refunds 并逐条输出 JSON;运行 scripts/grader.py 计算 0 到 1 的确定性异常分数;渲染 Markdown 报告,列出得分最高的异常及其 id、金额、币种、状态和原因。

使用方式:先运行 vskill check stripe-refund-auditor 做预检,确认 Stripe MCP 服务器已配置、密钥可解析、Python >=3.10 可用、pytest --collect-only tests/ 通过。随后依次执行:python3 scripts/audit.py --since "$(date -u -v-30d +%Y-%m-%d)" --until "$(date -u +%Y-%m-%d)" > /tmp/refunds.jsonl;python3 scripts/grader.py /tmp/refunds.jsonl > /tmp/refund-scores.json;再用 python3 -c 命令输出前 10 条异常与总分,由调用方转成文字。

文件:scripts/audit.py、scripts/grader.py、tests/integration_test.py、references/refund-schema.md、evals/evals.json、.env.example。

限制:缺少 STRIPE_API_KEY 时 audit.py 以退出码 2 结束并打印诊断;结果为空时 grader.py 返回 {"overall_score": 0.0, "anomalies": []};网络失败时 audit.py 非零退出并包含 HTTP 状态,需修复连接后重试。