Agent skill

SQL Root Cause Analysis

by zj-unicom-ai in zj-unicom-ai/UniEmployee

SQL 版归因分析技能。当用户问为什么、指标异常、趋势下滑/增长、KPI 未达标、营收/订单/转化/成本波动时使用. An agent skill from zj-unicom-ai/UniEmployee.

MITAuto-check passedDevelopment

Install SQL Root Cause Analysis

skills CLI
$ npx skills add zj-unicom-ai/UniEmployee --skill sql-root-cause-analysis -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install zj-unicom-ai/UniEmployee sql-root-cause-analysis --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/zj-unicom-ai/UniEmployee.git skills-src && mkdir -p .claude/skills && cp -r skills-src/backend/skills/sql-root-cause-analysis .claude/skills/sql-root-cause-analysis && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sql-root-cause-analysis
GitHub stars
358
Token cost
~433 tokens
SKILL.md length
115 words
Files
1
Skills in repo
22
Repo updated
First seen
Licence
MIT

At a glance

SQL 版归因分析技能。当用户问为什么、指标异常、趋势下滑/增长、KPI 未达标、营收/订单/转化/成本波动时使用. An agent skill from zj-unicom-ai/UniEmployee.

  • Works in 4 steps: 调用… → 涉及多表时调用… → 对核心表调用… → …
  • Tasks that involve SQL
  • SKILL.md covers 适用范围, 执行步骤 and 输出原则
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

SQL Root Cause Analysis is an agent skill from zj-unicom-ai/UniEmployee. SQL 版归因分析技能。当用户问为什么、指标异常、趋势下滑/增长、KPI 未达标、营收/订单/转化/成本波动时使用。

Its SKILL.md is about 430 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering SQL, Root cause analysis and OKRs and executive reporting. It works with SQL. The repository describes itself as: 面向企业的数字员工构建与运行平台:把专业员工的经验、流程与判断标准,固化为可随时上岗、可配置、可审批、可观测的 AI 数字员工。 The licence is MIT.

When your agent uses it

  • Tasks that involve SQL
  • Tasks that involve Root cause analysis
  • Tasks that involve OKRs and executive reporting

Example prompts

  • “/sql-root-cause-analysis”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 调用 sql_db_smart_search(user_query="用户原始问题") 获取相关表结构。
  2. 涉及多表时调用 sql_db_table_relationship(table_names="...")。
  3. 对核心表调用 sql_db_profile(table_names="..."),确认行数、字段非空率、时间范围和数值范围。
  4. 核心分析 SQL 执行后调用 sql_db_quality_check(query="核心 SQL")。如果样本量小、缺失多或结果为空,后续结论必须降级。

What it can do on your machine

Read from SKILL.md and the folder at commit abd8ed0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

SQL Root Cause Analysis loads about 433 tokens when it runs. Until then it costs about 21 tokens; SKILL.md has 115 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~21
When it runs · the whole SKILL.md, loaded when a task matches
~433

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from zj-unicom-ai/UniEmployee at commit abd8ed0, republished under its MIT licence (© zj-unicom-ai). 115 words, ~433 tokens.

Download SKILL.mdSave it as .claude/skills/sql-root-cause-analysis/SKILL.md (or your agent's skills folder).
name
sql-root-cause-analysis
description
SQL 版归因分析技能。当用户问为什么、指标异常、趋势下滑/增长、KPI 未达标、营收/订单/转化/成本波动时使用。

SQL 版归因分析

你是数据分析师。遇到“为什么”“下降原因”“增长来自哪里”“异常波动”“KPI 未达标”等问题时,必须按本规程做归因分析。只使用小数可用的 SQL / 表格 / 知识库 / 连接器工具,禁止使用 run_python、文件系统和本地脚本。

适用范围

  • 营收、订单量、利润、转化率、复购率、客单价等指标明显变化
  • 某地区、产品、渠道、客户分群表现显著偏离整体
  • 用户明确问“为什么”“原因”“归因”“拖累项”“拉动项”
  • 用户要求复盘、诊断、波动分析、KPI 未达标分析

执行步骤

步骤 1:确认问题口径

先从用户问题中识别:

  • 目标指标:例如销售额、订单数、客单价、转化率
  • 目标周期:例如本月、上月、最近 7 天、某季度
  • 对比基准:环比、同比、目标值、整体平均、其他分组
  • 可下钻维度:时间、地区、产品、渠道、客户、销售等

口径不清但可合理假设时,先说明假设后继续;缺少关键字段时,先检索 schema 再判断。

步骤 2:获取并验证数据
  1. 调用 sql_db_smart_search(user_query="用户原始问题") 获取相关表结构。
  2. 涉及多表时调用 sql_db_table_relationship(table_names="...")。
  3. 对核心表调用 sql_db_profile(table_names="..."),确认行数、字段非空率、时间范围和数值范围。
  4. 核心分析 SQL 执行后调用 sql_db_quality_check(query="核心 SQL")。如果样本量小、缺失多或结果为空,后续结论必须降级。
步骤 3:确认异常事实

先跑总览 SQL,确认异常是否真实存在:

  • 当前周期指标值
  • 对比周期指标值
  • 变化量 = 当前值 - 对比值
  • 变化率 = 变化量 / 对比值

如果异常不存在,直接说明“当前数据不支持异常判断”,不要继续编造原因。

步骤 4:维度贡献拆解

对每个可用维度分别计算:

  • 当前周期值
  • 对比周期值
  • 变化量
  • 变化率
  • 对总体变化的贡献度

优先下钻这些维度:

  1. 时间:找到变化发生在哪一天/周/月
  2. 地区:定位主要拖累或拉动区域
  3. 产品:定位主要拖累或拉动品类/SKU
  4. 渠道:定位渠道结构变化
  5. 客户:定位头部客户、客户分群或新老客变化

贡献度公式:

维度项变化量 / 总体变化量

总体变化量为 0 时,不计算贡献度,改用当前值占比和变化率解释。

步骤 5:量价/结构拆解

当指标是收入、销售额、GMV 等金额类指标时,尽量拆成:

  • 量:订单数、销量、客户数
  • 价:客单价、件均价、折扣率
  • 结构:高低价产品占比、渠道占比、客户结构变化

判断方向:

  • 订单数下降:优先看需求、流量、渠道、客户流失
  • 客单价下降:优先看折扣、产品结构、低价品占比
  • 转化率下降:优先看流量质量、渠道、人群和关键漏斗环节
  • 成本上升:优先看用量、单价、供应商/区域/产品结构
步骤 6:形成归因结论

输出必须包含四段:

  1. 异常定位:哪个指标、哪个周期、变化多少
  2. 主要归因:贡献最大的 2-4 个维度项,必须带数字
  3. 证据强度:说明是“数据直接支持”“高度相关”“需要补充数据验证”
  4. 建议动作:短期排查、业务动作、后续补数方向

输出原则

  • 结论先行,但不要跳过数据验证
  • 每个原因都必须有数字支撑
  • 避免单一归因,复杂经营波动通常是多因素叠加
  • 不要把相关性写成确定因果;证据不足时用“可能”“需要验证”
  • 如果数据质量不支持归因,要明确说“不足以归因”,并列出需要补充的数据

© zj-unicom-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in backend/skills/sql-root-cause-analysis of zj-unicom-ai/UniEmployee.

Open the folder on GitHubat commit abd8ed0

Compare with similar skills

SQL Root Cause Analysis next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

SQL Root Cause Analysis compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
SQL Root Cause Analysis this skillzj-unicom-ai/UniEmployee358—~433Automated safety check: PassMIT
Logfire Querypydantic/skills140—~2.2kAutomated safety check: PassMIT
Semantic Analystsidequery/sidemantic129—~982Automated safety check: PassAGPL-3.0
Advanced Analytics Dashboardsickn33/agentic-awesome-skills47k1 repos~3.3kAutomated safety check: PassMIT
Code Nest Project Specxiaou61/Code-Nest770—~1.3kAutomated safety check: PassMIT
Sassasjs/core132—~3.1kAutomated safety check: PassMIT

Similar skills

  • Logfire Query

    pydantic/skills

    Official

    Query and analyze Logfire telemetry data — traces, logs, spans, metrics, summaries, and SQL results.

    140 GitHub stars~2.2k tokensUpdated 7 days ago
    DatabasesAuto-check passed
  • Semantic Analyst

    sidequery/sidemantic

    Answer analytical, KPI, metric, trend, cohort, and business-performance questions through a Sidemantic semantic layer.

    129 GitHub stars~982 tokensUpdated yesterday
    DatabasesAuto-check passed
  • Advanced Analytics Dashboard

    sickn33/agentic-awesome-skills

    Dashboard metric register: metric, source module, formula, period, value, target, trend, owner and last-updated, as CSV, SQL, JSON Schema or Notion on request.

    47k GitHub starsUsed in 1 repo~3.3k tokens
    Business, Finance & HRAuto-check passed
  • Code Nest Project Spec

    xiaou61/Code-Nest

    Code-Nest 多模块全栈项目协作规范与落点导航。Use when modifying this repository for feature development, bug fixing, refactor, API change, SQL migration, or frontend-backend联调 so changes land in the correct module…

    770 GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Sas

    sasjs/core

    Expert guidance for the SAS programming language - DATA step, PROC SQL, macro language, formats, ODS, and common procedures.

    132 GitHub stars~3.1k tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • Protheus Data Dictionary Lookup

    totvs/engpro-advpl-tlpp-skills

    Queries the TOTVS Protheus ERP data dictionary for tables, fields, indexes, parameters, triggers and lookups, including impact checks during refactoring.

    143 GitHub stars~1.5k tokensUpdated 3 days ago
    DevelopmentAuto-check passed

More from zj-unicom-ai/UniEmployee

All 22 skills in this repo
  • Enterprise Customer Visit Playbook

    zj-unicom-ai/UniEmployee

    Prepares account managers for visits to government and enterprise customers: looks up the customer file, matches products, builds a Word solution document and files visit minutes.

    358 GitHub stars~458 tokensUpdated today
    Auto-check passed
  • Tencent ima Knowledge Base Reader

    zj-unicom-ai/UniEmployee

    Exports the article list and original article text from a Tencent ima knowledge base through a logged-in Chrome session, using browser automation.

    358 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Business Overview Analysis

    zj-unicom-ai/UniEmployee

    Produces a full business health analysis from sales, finance, inventory and customer CSV files: core KPIs, monthly trends, drill-downs and recommendations.

    358 GitHub stars~662 tokensUpdated today
    Auto-check passed
  • Competitor Deep-Dive Dashboard

    zj-unicom-ai/UniEmployee

    Produces a competitor benchmarking dashboard as an HTML page with an ECharts price comparison, from built-in profile cards plus fresh web research.

    358 GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Insurance Operations Analysis

    zj-unicom-ai/UniEmployee

    Analyzes insurance operating data such as premium, loss ratio, renewal rate and expense ratio by branch, product and channel, flags anomalies and builds an HTML dashboard.

    358 GitHub stars~646 tokensUpdated today
    Auto-check passed
  • Market Alert Triage

    zj-unicom-ai/UniEmployee

    Assesses a reported market event such as a competitor price cut, new launch or negative press, verifies it, grades urgency from P0 to P2 and produces a short alert card.

    358 GitHub stars~778 tokensUpdated today
    Auto-check passed

Works with

Questions about SQL Root Cause Analysis

What does SQL Root Cause Analysis do?

SQL 版归因分析技能。当用户问为什么、指标异常、趋势下滑/增长、KPI 未达标、营收/订单/转化/成本波动时使用. An agent skill from zj-unicom-ai/UniEmployee. SQL Root Cause Analysis is an agent skill from zj-unicom-ai/UniEmployee.

When should I use SQL Root Cause Analysis?

SQL Root Cause Analysis fits situations like: tasks that involve SQL; tasks that involve Root cause analysis; tasks that involve OKRs and executive reporting.

How do I install SQL Root Cause Analysis in Claude Code?

Run `npx skills add zj-unicom-ai/UniEmployee --skill sql-root-cause-analysis -a claude-code`. Or copy the skill folder (backend/skills/sql-root-cause-analysis in zj-unicom-ai/UniEmployee) into .claude/skills/sql-root-cause-analysis in your project. Claude Code loads it when a task matches its description.

How do I install SQL Root Cause Analysis in Codex?

Run `npx skills add zj-unicom-ai/UniEmployee --skill sql-root-cause-analysis -a codex`. Or copy the skill folder (backend/skills/sql-root-cause-analysis in zj-unicom-ai/UniEmployee) into .agents/skills/sql-root-cause-analysis in your project. Codex loads it when a task matches its description.

Can I use SQL Root Cause Analysis in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zj-unicom-ai/UniEmployee --skill sql-root-cause-analysis -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sql-root-cause-analysis, .gemini/skills/sql-root-cause-analysis, .github/skills/sql-root-cause-analysis and .opencode/skills/sql-root-cause-analysis in your project.

What does SQL Root Cause Analysis need to run?

SKILL.md names no scripts, command-line tools or credentials: SQL Root Cause Analysis is instructions for the agent only.

Does SQL Root Cause Analysis access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is SQL Root Cause Analysis safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does SQL Root Cause Analysis use?

SQL Root Cause Analysis is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does SQL Root Cause Analysis use?

About 433 tokens (SKILL.md is roughly 1.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to SQL Root Cause Analysis?

Skills that share tags, products or a category with SQL Root Cause Analysis: Logfire Query (pydantic/skills, 140 stars), Semantic Analyst (sidequery/sidemantic, 129 stars), Advanced Analytics Dashboard (sickn33/agentic-awesome-skills, 47k stars) and Code Nest Project Spec (xiaou61/Code-Nest, 770 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains SQL Root Cause Analysis?

zj-unicom-ai (a GitHub organization) maintains it in zj-unicom-ai/UniEmployee, which has 358 GitHub stars. The repository holds 22 skills in this directory. The repository was last updated on October 8, 2026.

Source: zj-unicom-ai/UniEmployee on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.