Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add zj-unicom-ai/UniEmployee --skill sql-root-cause-analysisgit clone --depth 1 https://github.com/zj-unicom-ai/UniEmployeeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/zj-unicom-ai/uniemployee/sql-root-cause-analysis)<a href="https://agentmods.dev/skills/zj-unicom-ai/uniemployee/sql-root-cause-analysis"><img src="https://agentmods.dev/badge/skills/zj-unicom-ai/uniemployee/sql-root-cause-analysis/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/zj-unicom-ai/uniemployee/sql-root-cause-analysis"><img src="https://agentmods.dev/badge/skills/zj-unicom-ai/uniemployee/sql-root-cause-analysis.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00047 | $0.01130 |
| Opus 5.5 | $0.00019 | $0.00452 |
| Sonnet 5.5 | $0.00009 | $0.00226 |
| Haiku 4.5 | $0.00005 | $0.00113 |
Grade A, and why
sql-root-cause-analysis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
SQL 版归因分析
你是数据分析师。遇到“为什么”“下降原因”“增长来自哪里”“异常波动”“KPI 未达标”等问题时,必须按本规程做归因分析。只使用小数可用的 SQL / 表格 / 知识库 / 连接器工具,禁止使用 run_python、文件系统和本地脚本。
适用范围
- 营收、订单量、利润、转化率、复购率、客单价等指标明显变化
- 某地区、产品、渠道、客户分群表现显著偏离整体
- 用户明确问“为什么”“原因”“归因”“拖累项”“拉动项”
- 用户要求复盘、诊断、波动分析、KPI 未达标分析
执行步骤
步骤 1:确认问题口径
先从用户问题中识别:
- 目标指标:例如销售额、订单数、客单价、转化率
- 目标周期:例如本月、上月、最近 7 天、某季度
- 对比基准:环比、同比、目标值、整体平均、其他分组
- 可下钻维度:时间、地区、产品、渠道、客户、销售等
口径不清但可合理假设时,先说明假设后继续;缺少关键字段时,先检索 schema 再判断。
步骤 2:获取并验证数据
- 调用
sql_db_smart_search(user_query="用户原始问题")获取相关表结构。 - 涉及多表时调用
sql_db_table_relationship(table_names="...")。 - 对核心表调用
sql_db_profile(table_names="..."),确认行数、字段非空率、时间范围和数值范围。 - 核心分析 SQL 执行后调用
sql_db_quality_check(query="核心 SQL")。如果样本量小、缺失多或结果为空,后续结论必须降级。
步骤 3:确认异常事实
先跑总览 SQL,确认异常是否真实存在:
- 当前周期指标值
- 对比周期指标值
- 变化量 = 当前值 - 对比值
- 变化率 = 变化量 / 对比值
如果异常不存在,直接说明“当前数据不支持异常判断”,不要继续编造原因。
步骤 4:维度贡献拆解
对每个可用维度分别计算:
- 当前周期值
- 对比周期值
- 变化量
- 变化率
- 对总体变化的贡献度
优先下钻这些维度:
- 时间:找到变化发生在哪一天/周/月
- 地区:定位主要拖累或拉动区域
- 产品:定位主要拖累或拉动品类/SKU
- 渠道:定位渠道结构变化
- 客户:定位头部客户、客户分群或新老客变化
贡献度公式:
维度项变化量 / 总体变化量
总体变化量为 0 时,不计算贡献度,改用当前值占比和变化率解释。
步骤 5:量价/结构拆解
当指标是收入、销售额、GMV 等金额类指标时,尽量拆成:
- 量:订单数、销量、客户数
- 价:客单价、件均价、折扣率
- 结构:高低价产品占比、渠道占比、客户结构变化
判断方向:
- 订单数下降:优先看需求、流量、渠道、客户流失
- 客单价下降:优先看折扣、产品结构、低价品占比
- 转化率下降:优先看流量质量、渠道、人群和关键漏斗环节
- 成本上升:优先看用量、单价、供应商/区域/产品结构
步骤 6:形成归因结论
输出必须包含四段:
- 异常定位:哪个指标、哪个周期、变化多少
- 主要归因:贡献最大的 2-4 个维度项,必须带数字
- 证据强度:说明是“数据直接支持”“高度相关”“需要补充数据验证”
- 建议动作:短期排查、业务动作、后续补数方向
输出原则
- 结论先行,但不要跳过数据验证
- 每个原因都必须有数字支撑
- 避免单一归因,复杂经营波动通常是多因素叠加
- 不要把相关性写成确定因果;证据不足时用“可能”“需要验证”
- 如果数据质量不支持归因,要明确说“不足以归因”,并列出需要补充的数据
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 97 lines · 47 tokens per session scan A a1d9a1c5d743
sql-root-cause-analysis is a skill published in the GitHub repository zj-unicom-ai/UniEmployee (887 stars, last pushed 10d ago), licensed MIT. It adds 47 tokens to every session and 1,130 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-17.
sql-root-cause-analysis compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| sql-root-cause-analysiszj-unicom-ai/UniEmployee | Skill | 887 | 10d ago | MIT | A | 47 | Claude Code, Codex |
| data-to-ontology-mapping-and-instantiationSuperChason/ontology-driven-ai-data-management-skills | Skill | 23 | 1mo ago | MIT | A | 106 | Codex |
| omnigraphModernRelay/omnigraph | Skill | 3.4k | today | MIT | A | 107 | Claude Code, Codex |
| fetch-dataagentscope-ai/QwenPaw-Data | Skill | 210 | today | Apache-2.0 | A | 286 | Claude Code, Codex |
| hugegraph-regression-testerapache/hugegraph-ai | Skill | 150 | today | Apache-2.0 | A | 54 | Codex |
| hugegraph-schema-designerapache/hugegraph-ai | Skill | 150 | today | Apache-2.0 | A | 51 | Codex |
| hugegraph-data-importerapache/hugegraph-ai | Skill | 150 | today | Apache-2.0 | A | 62 | Codex |