name: financial-statement-analyzer
description: >-
Deep analysis of corporate balance sheets, income statements, and cash flow
statements. Quantifies fraud probability (Beneish M-Score, Piotroski F-Score),
identifies earnings manipulation and operational pathologies, and generates
illustrated expert diagnostic reports with prioritized management recommendations.
Supports .xlsx/.xls/.csv/.pdf/.png/.jpg/.docx inputs. This skill should be used
when the user uploads financial statement files, mentions keywords like
"分析報表"/"財務報表"/"分析財報"/"三張表"/"財務造假"/"勾稽"/"M-Score"/"杜邦分析",
or issues commands like /analyze or @財務報表分析專家.
agent_created: true
Analyze corporate financial statements through a three-tier funnel diagnostic engine, producing structured HTML reports with Chart.js visualizations, risk scoring, and actionable management recommendations.
Automatically activate when ANY of the following occurs:
.xlsx, .xls, .csv, .pdf, .png, .jpg, .jpeg, .tiff, .bmp, .webp, .docx@財務報表分析專家, /analyze, /quick-diagnosisParse surface data → data validation → account mapping → parallel computation → summary card. Output: health indicator + Z/M/F-Score + top-3 risks + one-sentence diagnosis.
| Tier | Name | Content | Typical Time |
|---|---|---|---|
| L1 | Emergency Triage | Health lights, Z/M/F-Score, 21 red flags, cash flow patterns, one-line diagnosis | ≤5s |
| L2 | Specialist Clinic | 6-dim radar chart, DuPont waterfall, industry percentile, risk heatmap, 3 scenarios | 30-90s |
| L3 | Expert Consultation | 8 cross-checks, accounting policy analysis, fraud risk, related-party penetration, compliance redlines, root-cause analysis + action plan | 60-180s |
| Format | Extensions | Parser | Notes |
|---|---|---|---|
| Excel | .xlsx, .xls, .csv |
openpyxl + pandas | Direct extraction |
.pdf |
pdfplumber | Auto-detect audit reports | |
| Image | .png, .jpg, .tiff, .bmp, .webp |
pytesseract OCR | Light preprocessing (contrast + sharpen) |
| Word | .docx |
python-docx | Table extraction + merged cells |
| Paste | tab/CSV | pandas | Auto-detect delimiter |
All file parsing routes through scripts/parse_router.py → parse_financial_document(filepath).
See references/account-mapping.yaml for the three-level account mapping dictionary.
When reading Chinese text from .xls files via bash/PowerShell, console output may display
garbled characters (��). NEVER guess content from garbled output.
Required verification procedure:
v = str(sh.cell_value(r, c)).strip()
print(f'hex: {v.encode("utf-8").hex()}')
# Then decode: bytes.fromhex(hex_str).decode('utf-8')
Company name confirmation checklist (complete before generating ANY report): - [ ] Extract and hex-decode company full names from every sheet containing them - [ ] Cross-reference with Sheet 0 (summary) abbreviations - [ ] Verify consistency across years (e.g., 2024="工程公司", 2025="水公司") - [ ] Use hex-decoded names in reports — never guessed names
| Level | Scope | Action on Failure |
|---|---|---|
| L1 Completeness | Three statements present, BS balanced (<1% tolerance), currency unit identified | Fatal — block analysis |
| L2 Consistency | Period consistency, currency consistency, sign conventions | Auto-correct |
| L3 Reasonability | Extreme values, jumps, negative/zero checks | Flag as warning |
| L4 Standard Version | New revenue/lease/financial instrument standards | Record version |
Execute scripts/data_validator.py → DataValidator.validate_all() before generating reports.
Single Company Multi-Company / Group
┌──────────────────────────┐ ┌──────────────────────────────┐
Single│ Scenario A: Single+Single │ │ Scenario B: Group+Single │
Year │ Report → L1/L2/L3 │ │ Group rpt → Sub rpts → L1/L2/L3│
├──────────────────────────┤ ├──────────────────────────────┤
Multi │ Scenario C: Single+Multi │ │ Scenario D: Group+Multi (full) │
Year │ Multi rpt → Yrly → L1/L2/L3│ │ Multi → Yrly Grp → Subs → L1/L2/L3│
└──────────────────────────┘ └──────────────────────────────┘
| Condition | Classification |
|---|---|
| Multiple BS/IS sheets in Excel, or user states parent-subsidiary | Group / Multi-company |
| Data spans multiple years/periods | Multi-year |
| User provides multiple year files at once | Multi-year |
| Single file, single company, single year | Single company single year |
Multi-year + Group → Multi-year summary → Yearly group → Per-company yearly → L1/L2/L3
Multi-year + Single → Multi-year summary → Yearly reports → L1/L2/L3
Single-year + Group → Group report → Per-company reports → L1/L2/L3
Single-year + Single → Comprehensive report → L1/L2/L3
Comprehensive Report (.html) — Hand-generated, Chart.js charts: Header + KPI cards (4-col grid) + P&L waterfall + BS structure + ratio cards (6-9 items) + Findings (P0/P1/P2, ≥5 items) + Diagnosis + Data verification.
Multi-Year Report (.html) — Hand-generated, comparison focus: Executive summary + KPI comparison table + Per-company cross-year + Ratio trends + Risk assessment matrix + Strategic recommendations.
L1/L2/L3 Reports — Pipeline auto-generated (ECharts): L1: health lights, Z/M/F-Score, top-5 risks, cash patterns. L2: radar, DuPont, box plots. L3: cross-checks, accounting policy, fraud risk, compliance.
Full report content templates → references/report-templates.md
| Type | Format | Example |
|---|---|---|
| Multi-year summary | {Group/Co}_YYYY-YYYY_兩年綜合財務分析報告.html |
哈爾濱優方集團_2024-2025_兩年綜合財務分析報告.html |
| Annual comprehensive | {Co}_YYYY年_財務分析報告.html |
科技公司_2025年_財務分析報告.html |
| Group annual | {Group}_YYYY年_財務分析報告.html |
哈爾濱優方集團_2025年_財務分析報告.html |
| L1/L2/L3 | {Co}_YYYY_L{N}_{Name}.html |
科技公司_2025_L1_急診初篩.html |
| # | Capability | Implementation |
|---|---|---|
| 1 | Cross-check verification | 8 categories, scripts/verify_crosschecks.py + references/verification-rules.yaml |
| 2 | Accounting estimate aggressiveness | Depreciation/bad-debt/capitalization vs. industry, references/industry-benchmarks.json |
| 3 | Operational reality reconstruction | Suspicious entries → operational actions mapping |
| 4 | Illustrated reports | Three-tier + Chart.js/ECharts, scripts/render_charts.py |
| 5 | Fraud quantification | Beneish M-Score (scripts/compute_mscore.py) + Piotroski F-Score |
| 6 | Audit procedure mapping | Red flags → simulated procedures → checklist (templates/audit_checklist.md) |
| 7 | Case pattern matching | Cosine similarity against references/case-library.json |
| 8 | Related-party penetration | 6-dim detection matrix, scripts/related_party_matcher.py |
| 9 | Practical management advice | scripts/generate_advice.py + references/advice-templates.yaml |
| 10 | Data quality scoring | 4-dim scorecard, scripts/data_quality_scorer.py |
| 11 | AR aging estimation | BS/IS → aging distribution, scripts/ar_aging_estimator.py |
| 12 | Multi-period merging | scripts/multi_period_merger.py |
| 13 | Excel export | 4-sheet summary, scripts/excel_exporter.py |
scripts/compute_ratios.pyto_wan() / to_wan_array() for display conversion — never manual divisionheight not min-height for chart containers.chart-box { height: 300px; } + .chart-box canvas { flex: 1; min-height: 0; }.chart-box { min-height: 300px; }@media print with -webkit-print-color-adjust: exact !importantbreak-inside: avoid on cards, findings, chart boxes@page { size: A4; margin: 15mm 12mm; }Chart.defaults.animation = { duration: 0 }| Error Type | Manifestation | Prevention |
|---|---|---|
| Unit ×10 error | Chart shows 4088萬 (actual 408.8萬) | Use to_wan(), never manual ÷10000 |
| Column swap | AR year-start/year-end reversed | Auto-alert on >500% change + row-number cross-check |
| Missing line items | Omitted investment income | Completeness check via REQUIRED_IS_ITEMS |
| Data entry error | Wrong retained earnings value | BS balance check + total cross-validation |
| Name misattribution | 哈爾濱→紹興, 水務→水利 | Hex-decode verification (see Encoding Protocol above) |
| Score | Grade | Action |
|---|---|---|
| 0-20 | A 🟢 | Routine monitoring |
| 21-40 | B 🟡 | Track trends |
| 41-60 | C 🟠 | Targeted investigation |
| 61-80 | D 🔴 | Recommend external audit |
| 81-100 | E 💀 | Suspend cooperation/investment |
scripts/)parse_router.py — Unified parsing entry (Excel/PDF/Image/DOCX/Paste)parse_excel.py, parse_pdf.py, parse_image.py, parse_docx.py, parse_paste.py, parse_audit_report.py — Format-specific parsersdata_validator.py — Data validation engine (Unit class, DataValidator class)compute_ratios.py — Ratio computationcompute_mscore.py — Beneish M-Scorescan_redflags.py — 21 red flag scanningverify_crosschecks.py — 8-category cross-check verificationdetect_anomalies.py — Anomaly detectiongenerate_report.py, render_charts.py — Report and chart generationgenerate_advice.py — Management advice generationmatch_cases.py — Case library matchingrun_pipeline.py — End-to-end pipeline entry (v2.3+)multi_period_merger.py, data_quality_scorer.py, ar_aging_estimator.py, related_party_matcher.py, excel_exporter.py, rd_capitalization_detector.py — v2.8+ modulesreferences/)account-mapping.yaml — Three-level account mappingred-flags.yaml — 21 red flag rulesverification-rules.yaml — 8-category cross-check rulescompliance-redlines.yaml — 14 compliance redlinesindustry-benchmarks.json — Industry benchmark parameterscase-library.json — Case feature vector libraryquestion-templates.yaml — 20 preset question templatesadvice-templates.yaml — Advice template libraryreport-templates.md — Detailed report content templatestemplates/)audit_checklist.md — 7-stage audit checklistreport_comprehensive.html, report_level1.html, report_level2.html, report_level3.html — HTML report templatestests/)test_ratios.py, test_mscore.py, test_redflags.py, test_parse_router.py, test_parse_image.py, test_integration.py — Unit and integration tests本技能來自小蔥技能站7w4.net。
fixtures/sample_manufacturer.json — Test fixture| Level | Condition | Action |
|---|---|---|
| 🔴 Fatal | Missing all 3 statements, undetermined currency unit, <2 periods of data | Block analysis |
| 🟠 Warning | Partial missing items, BS imbalance >0.1% | Continue with degraded output, note limitations |
| 🟡 Info | Old standard accounts, LLM unavailable | Continue, annotate |
Disclaimer: Reports generated by AI analysis based on accounting data, for internal reference only. "Abnormal", "suspicious" and similar terms indicate financial metric deviations from norms, not legal determinations.
© 2026 優方皚爾 Uform Ai
這個技能質量非常好,專業性很強。它能自動識別財務報表檔案,進行收入、資產、現金流等多維度分析,還能檢測財務造假風險並生成直觀的診斷報告。多格式支援也很實用,Excel、PDF、圖片都能處理。測試覆蓋全面,穩定性有保障。美中不足的是偶爾會遇到檔名識別的小問題,以及某些極端資料情況下的容錯能力可以再加強。總體來看,是一個值得信賴的財務分析工具。