Client Dashboard / KPI Report — SKILL.md
What This Skill Does
Generates a client-facing executive KPI dashboard from QuickBooks Online data. Produces an Excel workbook with traffic-light scoring, 6-month trend sparklines, client-specific watch items, and a CDC log tracking KPI changes month-over-month.
When To Use
- - Monthly close is complete and it's time to generate the client dashboard
- User asks for KPI report, dashboard, or executive summary for any client
- After running P&L Quick Compare and bank rec — this is the final deliverable step
When NOT To Use
- - NOT a substitute for P&L Quick Compare (different purpose — this is executive summary, not variance analysis)
- NOT for mid-month snapshots — designed for complete monthly periods
- NOT for YTD / annual reports — use P&L Deep Analysis for those
- NOT for clients without QBO integration (no data source)
Pipeline: scripts/pipelines/client-dashboard.py
Prerequisites
CODEBLOCK0
Usage
CODEBLOCK1
Arguments
| Argument | Required | Description |
|---|
| INLINECODE1 | ✅ | Company slug (must match qbo-client connection) |
| INLINECODE2 |
✅ | Report month:
YYYY-MM format |
|
--out | ❌ | Output directory (default:
~/Desktop) |
|
--sandbox | ❌ | Use QBO sandbox environment |
Output: Excel Workbook
Filename: KPI_Dashboard_{slug}_{YYYY_MM}.xlsx
| Tab | Contents |
|---|
| Executive Summary | Headline numbers + traffic-light KPI table with benchmarks |
| KPI Scorecard |
Full KPI detail with definitions, thresholds, and score |
|
Trends | 6-month KPI trend with sparklines (↑↗→↘↓ + block chars) |
|
Cash Position | Balance sheet cash, CF summary, liquidity ratios, runway |
|
Watch Items | SOP-driven priority items surfaced prominently |
|
CDC Log | Month-over-month KPI delta (what changed since last run) |
KPIs Computed
| KPI | Formula | Unit |
|---|
| Revenue MoM Growth | INLINECODE8 | % |
| Revenue YoY Growth |
(curr_rev - yoy_rev) / yoy_rev × 100 | % |
| Gross Margin % |
gross_profit / revenue × 100 | % |
| Gross Margin (3-Mo Avg) | Rolling 3-month GP/Revenue | % |
| Net Margin % |
net_income / revenue × 100 | % |
| OpEx Ratio |
total_opex / revenue × 100 | % |
| Interest Expense Ratio |
interest_expense / revenue × 100 | % |
| Current Ratio |
current_assets / current_liabilities | x |
| Quick Ratio |
(current_assets - inventory) / current_liabilities | x |
| Debt-to-Equity |
total_liabilities / total_equity | x |
| DSO |
ar / (revenue / days) | days |
| DPO |
ap / (cogs / days) | days |
| Cash Runway |
cash / monthly_burn | months |
| Retail % of Revenue |
retail_revenue / total_revenue × 100 | % |
All math uses Python Decimal for precision.
Traffic Light Scoring
Each KPI is scored GREEN / YELLOW / RED based on configurable thresholds per client SOP.
CODEBLOCK2
Thresholds are defined in CLIENT_CONFIGS in the script — one config block per client slug.
Client SOP Integration
Adding a New Client
Add a block to
CLIENT_CONFIGS in the script:
"new-slug": {
"company_name": "Company Name",
"industry": "Industry",
"has_ar": True,
"has_headcount": False,
"kpis_enabled": ["revenue_mom", "gross_margin", ...],
"thresholds": {
"gross_margin": {"green": (Decimal("45"), None), "yellow": (Decimal("35"), Decimal("45"))},
...
},
"watch_items": [...],
"benchmarks": {...},
"benchmark_source": "Source description",
}
CDC (Change Data Capture)
Cache stored at: INLINECODE24
- - First run: saves full KPI snapshot, CDC tab shows "First run" message
- Subsequent runs: diffs current KPIs vs. prior run
- CDC log shows: KPI label | Prior | Current | Delta | % Change | Improved/Declined
Trend Sparklines
6-month trend for each KPI uses two formats:
- 1. Direction arrows:
↑↑ ↑ ↗ → ↘ ↓ ↓↓ (based on % change over period) - Block bars:
█▇▅▃▁_ (relative to max value — in Trends tab mini-chart section)
Peer Benchmarks
Manual config only. Benchmark values live in CLIENT_CONFIGS[slug]["benchmarks"].
Source attribution displayed in every tab footer.
To update: edit benchmarks dict and benchmark_source string per client.
Integration with Pipeline Suite
This pipeline is designed to run after monthly close is complete:
CODEBLOCK4
File Locations
| File | Path |
|---|
| Pipeline script | INLINECODE30 |
| Skill file |
skills/client-dashboard/SKILL.md |
| CDC cache |
.cache/client-dashboard/{slug}.json |
| Output (default) |
~/Desktop/KPI_Dashboard_{slug}_{YYYY_MM}.xlsx |
Troubleshooting
QBO CLI error: Ensure your QBO integration is authenticated for the slug.
Missing KPIs: If Balance Sheet accounts don't match expected labels, values default to 0. Check extract_bs_metrics() candidates list for account name variants.
New client config: Add slug to CLIENT_CONFIGS before first run. Default config uses generic thresholds (not client-specific).
Decimal errors: All financial math uses Python Decimal. Do not mix float — use to_d() helper for any external values.
客户仪表板 / KPI报告 — SKILL.md
此技能的功能
根据QuickBooks Online数据生成面向客户的执行层KPI仪表板。生成包含交通灯评分、6个月趋势迷你图、客户特定关注项以及追踪KPI月度变化的CDC日志的Excel工作簿。
使用时机
- - 月度结账完成,需要生成客户仪表板时
- 用户要求为任何客户提供KPI报告、仪表板或执行摘要时
- 在运行损益快速对比和银行对账之后——这是最终交付步骤
不使用时机
- - 不可替代损益快速对比(用途不同——此为执行摘要,非差异分析)
- 不适用于月中快照——专为完整月度期间设计
- 不适用于年初至今/年度报告——请使用损益深度分析
- 不适用于未集成QBO的客户(无数据源)
管道:scripts/pipelines/client-dashboard.py
前提条件
bash
pip install openpyxl
Node.js qbo-client必须已为目标slug进行身份验证
使用方法
bash
示例——2026年3月
python3 scripts/pipelines/client-dashboard.py --slug <客户slug> --month 2026-03
自定义输出目录
python3 scripts/pipelines/client-dashboard.py --slug <客户slug> --month 2026-03 --out ~/Desktop/reports
QBO沙箱
python3 scripts/pipelines/client-dashboard.py --slug <客户slug> --month 2026-03 --sandbox
参数
| 参数 | 必需 | 描述 |
|---|
| --slug | ✅ | 公司slug(必须与qbo-client连接匹配) |
| --month |
✅ | 报告月份:YYYY-MM格式 |
| --out | ❌ | 输出目录(默认:~/Desktop) |
| --sandbox | ❌ | 使用QBO沙箱环境 |
输出:Excel工作簿
文件名: KPIDashboard{slug}{YYYYMM}.xlsx
| 标签页 | 内容 |
|---|
| 执行摘要 | 关键数据 + 带基准的交通灯KPI表格 |
| KPI计分卡 |
完整KPI详情,包含定义、阈值和评分 |
|
趋势 | 6个月KPI趋势,含迷你图(↑↗→↘↓ + 方块字符) |
|
现金状况 | 资产负债表现金、现金流摘要、流动性比率、资金跑道 |
|
关注项 | SOP驱动的优先事项,突出显示 |
|
CDC日志 | KPI月度变化(自上次运行以来的变化) |
计算的KPI
| KPI | 公式 | 单位 |
|---|
| 收入环比增长 | (当前收入 - 上期收入) / 上期收入 × 100 | % |
| 收入同比增长 |
(当前收入 - 同期收入) / 同期收入 × 100 | % |
| 毛利率% | 毛利润 / 收入 × 100 | % |
| 毛利率(3个月均值) | 滚动3个月毛利润/收入 | % |
| 净利率% | 净利润 / 收入 × 100 | % |
| 运营费用比率 | 总运营费用 / 收入 × 100 | % |
| 利息费用比率 | 利息费用 / 收入 × 100 | % |
| 流动比率 | 流动资产 / 流动负债 | 倍 |
| 速动比率 | (流动资产 - 存货) / 流动负债 | 倍 |
| 债务权益比 | 总负债 / 总权益 | 倍 |
| DSO | 应收账款 / (收入 / 天数) | 天 |
| DPO | 应付账款 / (销售成本 / 天数) | 天 |
| 现金跑道 | 现金 / 月度烧钱率 | 月 |
| 零售收入占比 | 零售收入 / 总收入 × 100 | % |
所有数学计算使用Python Decimal以确保精度。
交通灯评分
每个KPI根据每个客户SOP的可配置阈值,评分为绿色/黄色/红色。
🟢 绿色 = 达标(在绿色区间内)
🟡 关注 = 接近阈值(黄色区间)
🔴 行动 = 低于/高于可接受范围(超出黄色区间)
⬜ 不适用 = KPI不适用或未配置
阈值在脚本的CLIENT_CONFIGS中定义——每个客户slug一个配置块。
客户SOP集成
添加新客户
在脚本的CLIENT_CONFIGS中添加一个块:
python
新-slug: {
company_name: 公司名称,
industry: 行业,
has_ar: True,
has_headcount: False,
kpis
enabled: [revenuemom, gross_margin, ...],
thresholds: {
gross_margin: {green: (Decimal(45), None), yellow: (Decimal(35), Decimal(45))},
...
},
watch_items: [...],
benchmarks: {...},
benchmark_source: 来源描述,
}
CDC(变更数据捕获)
缓存存储于:.cache/client-dashboard/{slug}.json
- - 首次运行:保存完整KPI快照,CDC标签页显示首次运行消息
- 后续运行:对比当前KPI与上次运行
- CDC日志显示:KPI标签 | 上次值 | 当前值 | 差值 | 变化百分比 | 改善/下降
趋势迷你图
每个KPI的6个月趋势使用两种格式:
- 1. 方向箭头: ↑↑ ↑ ↗ → ↘ ↓ ↓↓(基于期间内的百分比变化)
- 方块条: █▇▅▃▁_(相对于最大值——在趋势标签页迷你图部分)
同行基准
仅手动配置。基准值位于CLIENT_CONFIGS[slug][benchmarks]中。
来源归属显示在每个标签页页脚。
更新方法:按客户编辑benchmarks字典和benchmark_source字符串。
与管道套件集成
此管道设计为在月度结账完成后运行:
- 1. 银行对账 (bank-reconciliation.py)
- 损益快速对比 (pl-quick-compare.py)
- 损益深度分析 (pl-deep-analysis.py) ← 可选,供控制层使用
- 客户仪表板 (client-dashboard.py) ← 此脚本
- 现金流预测 (cash-flow-forecast.py) ← 季度咨询
文件位置
| 文件 | 路径 |
|---|
| 管道脚本 | scripts/pipelines/client-dashboard.py |
| 技能文件 |
skills/client-dashboard/SKILL.md |
| CDC缓存 | .cache/client-dashboard/{slug}.json |
| 输出(默认) | ~/Desktop/KPI
Dashboard{slug}
{YYYYMM}.xlsx |
故障排除
QBO CLI错误: 确保您的QBO集成已为相应slug进行身份验证。
缺少KPI: 如果资产负债表账户与预期标签不匹配,值默认为0。检查extractbsmetrics()的候选列表以获取账户名称变体。
新客户配置: 首次运行前将slug添加到CLIENT_CONFIGS。默认配置使用通用阈值(非客户特定)。
Decimal错误: 所有财务数学计算使用Python Decimal。不要混用float——对外部值使用to_d()辅助函数。