BS Deep Analysis
What This Skill Does
Controller-level Balance Sheet deep analysis from QuickBooks Online. Mirrors the P&L Deep Analysis pattern but for the balance sheet — pulls current + prior period BS, runs 3-month rolling averages, GL drill-down for material changes, and generates a 7-tab Excel workbook with actionable findings.
Use when:
- - Monthly close deliverable needs a BS review (not just a P&L comparison)
- Client needs working capital health check or current ratio flag
- Equity rollforward reconciliation is needed for a close
- Material balance changes on cash, AR, inventory, or debt need narrative explanation
- Common-size (vertical) analysis is required for a lender or board report
NOT for:
- - Cash flow statement analysis — use a dedicated CF pipeline
- P&L variance analysis — use INLINECODE0
- Multi-entity consolidations — this is a single-entity BS pipeline
- Real-time balance changes (it's snapshot-based, not bank-feed)
Pipeline Location
CODEBLOCK0
Cache directory: .cache/bs-deep-analysis/{slug}.json
Usage
CODEBLOCK1
Arguments
| Argument | Required | Description |
|---|
| INLINECODE2 | ✅ | QBO company slug (must be connected in qbo-client) |
| INLINECODE3 |
✅ | As-of date for current BS (YYYY-MM-DD) |
|
--prior-end | ❌ | Prior period as-of date (auto = prior month-end) |
|
--skip-gl | ❌ | Skip GL drill-down (faster) |
|
--out | ❌ | Output directory (default: ~/Desktop) |
|
--sandbox | ❌ | Use QBO sandbox environment |
What It Pulls from QBO
- 1. Balance Sheet (as-of) — current period
- Balance Sheet (as-of) — prior period
- Balance Sheet (as-of) — 3 prior month-ends for rolling averages
- General Ledger — current period GL for flagged accounts (unless
--skip-gl) - P&L — current period net income for equity rollforward
Analysis Modules
1. Horizontal Analysis (Period-over-Period)
- - Every BS line: prior → current → $ change → % change
- Material threshold: ≥$2,500 absolute OR ≥10% change rate
- Flagged accounts sorted by absolute dollar change
2. Vertical Analysis (Common-Size)
- - Every BS line as % of total assets
- Prior period % vs. current period %
- % point change highlights structural shifts
3. 3-Month Rolling Averages
- - Pulls 3 prior month-end BS snapshots
- Per-account rolling average as trend baseline
- Rolling delta and rolling % vs. current balance
4. GL Drill-Down
- - Transaction-level detail for all flagged accounts
- Vendor/payee aggregation: top contributors by dollar
- Max 50 transactions per account (configurable via
GL_MAX_ROWS_PER_ACCOUNT)
5. Working Capital Deep Dive
- - Current assets vs. current liabilities decomposition
- Current ratio, quick ratio, cash ratio
- WC delta decomposed: cash change, AR change, inventory change, AP change
- Health classification: HEALTHY / WATCH / CRITICAL
6. Debt Schedule Analysis
- - Short-term vs. long-term debt split
- D/E ratio and D/A ratio
- ST concentration warning: flags if ST > 60% of total debt
- Leverage risk classification: LOW / LOW-MEDIUM / MEDIUM / HIGH
7. Equity Rollforward
Beginning Equity
+ Net Income
− Distributions / Owner Draws
+ New Contributions / Paid-in Capital
= Computed Ending Equity
vs. Ending Equity per BS (reconciling difference flagged if ≥ $500)
- - Retained earnings bridge separately
- Reconciling difference investigation prompt
8. Controller Findings
- - Narrative: "Cash decreased $45K because AP payments of $60K exceeded collections of $15K"
- Urgency-tagged: HIGH / MEDIUM / LOW
- GL vendor attribution embedded in findings
9. Action Proposals
- - Specific recommended actions per finding
- Urgency-ranked: HIGH → MEDIUM → LOW
- Categories: LIQUIDITY, CASH MANAGEMENT, COLLECTIONS, INVENTORY, DEBT MANAGEMENT, LEVERAGE, EQUITY INTEGRITY, BALANCE SHEET
10. CDC (Change Data Capture)
- - Compares current BS flat map vs. prior run cache
- Tracks: new accounts, removed accounts, balance changes
- Cache saved to INLINECODE10
Excel Output — 7 Tabs
| Tab | Contents |
|---|
| Summary | KPI table, key ratios, controller findings, action proposals |
| Detail |
Full BS with prior/current/delta/rolling avg per account |
|
⚠ Flags | Material change accounts + findings summary |
|
GL Drill-Down | Transaction-level detail for flagged accounts |
|
Common-Size Analysis | Vertical analysis: each line as % of total assets |
|
Equity Rollforward | Period reconciliation + retained earnings bridge |
|
CDC Log | Balance changes vs. last pipeline run |
Materiality Thresholds
| Metric | Threshold |
|---|
| Absolute change | ≥ $2,500 |
| Percentage change |
≥ 10% |
| Equity change (tighter) | ≥ 5% |
| Working capital watch | Current ratio < 1.5x |
| Working capital critical | Current ratio < 1.0x |
| ST debt concentration warning | ST debt > 60% of total |
| Equity rollforward diff flag | ≥ $500 |
Dependencies
CODEBLOCK3
QBO auth token must be set (same as all other pipelines).
Related Pipelines
| Pipeline | File | When to Use |
|---|
| P&L Deep Analysis | INLINECODE11 | Income statement controller review |
| Financial Ratios |
financial-ratios.py | Full ratio suite (uses BS data) |
| BS Deep Analysis |
bs-deep-analysis.py |
This pipeline — balance sheet focus |
Notes
- - All math uses Python
Decimal — no float rounding errors - GL account names must match BS account names for drill-down attribution (QBO may use slightly different names between reports)
- Prior month-end is auto-calculated if
--prior-end is omitted (always safe for monthly close) - INLINECODE16 reduces runtime significantly; use for quick runs when vendor detail is not needed
- CDC cache is per-slug; running for a new slug always starts fresh (first run snapshot only)
技能名称:BS深度分析
BS深度分析
该技能的功能
从QuickBooks Online获取控制器级别的资产负债表深度分析。模仿P&L深度分析模式,但针对资产负债表——提取当前及上一期的BS数据,运行3个月滚动平均值,对重大变化进行总账钻取,并生成包含7个工作表且附有可执行建议的Excel工作簿。
适用场景:
- - 月度结账交付物需要BS审查(不仅仅是P&L对比)
- 客户需要营运资本健康检查或流动比率预警
- 结账时需要进行权益变动调节
- 现金、应收账款、存货或债务的重大余额变化需要文字说明
- 需要为贷款方或董事会报告提供共同比(垂直)分析
不适用于:
- - 现金流量表分析——请使用专门的CF流程
- P&L差异分析——请使用pl-deep-analysis.py
- 多实体合并——此为单一实体BS流程
- 实时余额变化(基于快照,非银行数据流)
流程位置
scripts/pipelines/bs-deep-analysis.py
缓存目录:.cache/bs-deep-analysis/{slug}.json
使用方法
bash
当前月末 vs. 自动上一期月末
python3 scripts/pipelines/bs-deep-analysis.py \
--slug sb-paulson --current-end 2026-03-31
明确指定上一期
python3 scripts/pipelines/bs-deep-analysis.py \
--slug sb-paulson \
--current-end 2026-03-31 --prior-end 2026-02-28
跳过总账钻取(更快,无供应商级别明细)
python3 scripts/pipelines/bs-deep-analysis.py \
--slug sb-paulson --current-end 2026-03-31 --skip-gl
自定义输出目录
python3 scripts/pipelines/bs-deep-analysis.py \
--slug glowlabs --current-end 2026-03-31 --out ~/Desktop/reports
QBO沙箱
python3 scripts/pipelines/bs-deep-analysis.py \
--slug sb-paulson --current-end 2026-03-31 --sandbox
参数
| 参数 | 必填 | 描述 |
|---|
| --slug | ✅ | QBO公司标识(必须在qbo-client中已连接) |
| --current-end |
✅ | 当前BS的截止日期(YYYY-MM-DD) |
| --prior-end | ❌ | 上一期的截止日期(自动 = 上一期月末) |
| --skip-gl | ❌ | 跳过总账钻取(更快) |
| --out | ❌ | 输出目录(默认:~/Desktop) |
| --sandbox | ❌ | 使用QBO沙箱环境 |
从QBO提取的数据
- 1. 资产负债表(截止日)——当前期
- 资产负债表(截止日)——上一期
- 资产负债表(截止日)——前3个月末用于滚动平均值
- 总账——当前期被标记账户的总账(除非使用--skip-gl)
- 损益表——当前期净利润用于权益变动调节
分析模块
1. 水平分析(期与期对比)
- - 每个BS行项目:上一期 → 当前期 → 金额变动 → 百分比变动
- 重要性阈值:绝对值≥2,500美元 或 变动率≥10%
- 按绝对金额变动排序的标记账户
2. 垂直分析(共同比)
- - 每个BS行项目占总资产的百分比
- 上一期百分比 vs. 当前期百分比
- 百分点变动突出显示结构性变化
3. 3个月滚动平均值
- - 提取前3个月末的BS快照
- 每个账户的滚动平均值作为趋势基准
- 滚动差异和滚动百分比 vs. 当前余额
4. 总账钻取
- - 所有标记账户的交易级明细
- 供应商/收款方汇总:按金额排序的主要贡献者
- 每个账户最多50笔交易(可通过GLMAXROWSPERACCOUNT配置)
5. 营运资本深度分析
- - 流动资产 vs. 流动负债分解
- 流动比率、速动比率、现金比率
- 营运资本变动分解:现金变动、应收账款变动、存货变动、应付账款变动
- 健康分类:健康 / 关注 / 危急
6. 债务表分析
- - 短期 vs. 长期债务拆分
- 债务权益比和债务资产比
- 短期集中度警告:如果短期债务占总债务超过60%则标记
- 杠杆风险分类:低 / 中低 / 中 / 高
7. 权益变动调节
期初权益
+ 净利润
− 分配 / 业主提款
+ 新增出资 / 实缴资本
= 计算期末权益
vs. 资产负债表期末权益(差异≥500美元时标记)
8. 控制者发现
- - 文字说明:现金减少45,000美元,因为应付账款支付60,000美元超过了收款15,000美元
- 紧急程度标记:高 / 中 / 低
- 发现中嵌入总账供应商归属
9. 行动建议
- - 每个发现的具体建议行动
- 按紧急程度排序:高 → 中 → 低
- 类别:流动性、现金管理、收款、存货、债务管理、杠杆、权益完整性、资产负债表
10. CDC(变更数据捕获)
- - 比较当前BS扁平映射与上次运行缓存
- 跟踪:新增账户、移除账户、余额变化
- 缓存保存至.cache/bs-deep-analysis/{slug}.json
Excel输出 — 7个工作表
| 工作表 | 内容 |
|---|
| 摘要 | KPI表、关键比率、控制者发现、行动建议 |
| 明细 |
完整BS,包含每个账户的上一期/当前期/差异/滚动平均值 |
|
⚠ 标记 | 重大变动账户 + 发现摘要 |
|
总账钻取 | 标记账户的交易级明细 |
|
共同比分析 | 垂直分析:每个行项目占总资产的百分比 |
|
权益变动调节 | 期调节 + 留存收益桥接 |
|
CDC日志 | 与上次流程运行相比的余额变化 |
重要性阈值
≥ 10% |
| 权益变动(更严格) | ≥ 5% |
| 营运资本关注 | 流动比率 < 1.5倍 |
| 营运资本危急 | 流动比率 < 1.0倍 |
| 短期债务集中度警告 | 短期债务 > 总债务的60% |
| 权益变动调节差异标记 | ≥ 500美元 |
依赖项
pip install openpyxl
具有有效认证令牌的Node.js QBO客户端
必须设置QBO认证令牌(与所有其他流程相同)。
相关流程
| 流程 | 文件 | 使用场景 |
|---|
| P&L深度分析 | pl-deep-analysis.py | 损益表控制者审查 |
| 财务比率 |
financial-ratios.py | 完整比率套件(使用BS数据) |
| BS深度分析 | bs-deep-analysis.py |
本流程 — 资产负债表重点 |
备注
- - 所有计算使用Python Decimal — 无浮点舍入误差
- 总账账户名称必须与BS账户名称匹配,以便进行钻取归属(QBO在不同报表间可能使用略有不同的名称)
- 如果省略--prior-end,上一期月末自动计算(月度结账时始终安全)
- --skip-gl显著减少运行时间;在不需要供应商明细时用于快速运行
- CDC缓存按标识存储;为新标识运行时始终从头开始(首次运行仅保存快照)