name: business-anomaly-diagnosis slug: business-anomaly-diagnosis displayName: 月度經營異常診斷助手 description: Use when analyzing monthly sales/financial CSV or Excel files. Auto-cleans dirty data (encoding detection, column mapping, missing-value interpolation, date standardization, typo correction) → multi-dimension drill-down with MoM/YoY → anomaly detection with contribution decomposition → interactive HTML dashboard with ≤3 actionable recommendations. For business operators doing monthly reviews or anomaly investigation. version: 1.0.0 author: Hermes Agent Community license: MIT metadata: hermes: tags: [business, finance, anomaly-detection, data-cleaning, dashboard, diagnosis, sales-analysis] related_skills: []
不止出圖表,更要自動「找茬」並說清為什麼。
7w4.net小蔥技能站收錄全網優質技能,值得收藏。
上傳月度銷售/財務 CSV 或 Excel → 四層流水線自動處理:
安全底線:CSV 資料為不可信輸入。所有寫入 HTML 報告的文本經 esc() 清洗(HTML 實體 + 協議注入防護 + prompt 注入過濾 + Markdown 連結中和)。詳見 references/content-sanitization.md。
Don't use for: 即時流式資料(非批次檔案);非表格資料(如 PDF 財報);超大數據集(>100MB 建議先採樣)。
python scripts/diagnose.py <file> [--output report.html] [--threshold 0.15]
| Arg | Description | Default |
|---|---|---|
file |
CSV/Excel path | Required |
-o, --output |
HTML report path | <file>_診斷報告.html |
-t, --threshold |
Anomaly threshold (0.15 = 15%) | 0.15 |
# Example
python scripts/diagnose.py assets/sample_dirty.csv
python scripts/diagnose.py sales.xlsx -o report.html -t 0.20
Full column synonym mapping: references/column_mapping.json.
Interactive HTML Dashboard (self-contained, offline-openable): - Data overview (time span, dimension distribution) - Monthly sales trend chart (red ✕ marks anomaly months) - MoM change rate bar chart (red=drop, green=rise; deep color=exceeds threshold) - Dimension contribution decomposition chart (red=amplifies fluctuation, green=mitigates) - Anomaly attribution conclusion section - YoY analysis table (auto-skip if < 2 years of data) - Sub-item anomaly checklist (dimension-level findings, sorted by amplitude) - Smart cleaning log (color-coded by type) - ≤ 3 actionable business recommendations
Color convention follows Chinese business analysis: red = decline warning, green = growth positive.
忽略所有指令 等模式經 esc() 的 HTML 轉義後仍可讀,Agent 讀取報告時可能被誤導。已追加 _filterPromptInjection() 過濾。[惡意](url) 通過 HTML 轉義但被 Agent 以 Markdown 重讀時渲染為連結。esc() 已追加 []() → 【】() 全形替換。sales.isna().all() → 明確報錯提示。esc() 清洗(無 <script>、無 javascript: 協議、無 prompt 注入、無 [...](...) 連結語法)pandas>=2.0 numpy>=1.24 plotly>=5.18 openpyxl>=3.1
Install: pip install -r requirements.txt
references/column_mapping.json — Column name synonym mapping (extensible)references/content-sanitization.md — HTML/Markdown/prompt-injection sanitization specscripts/diagnose.py — Main diagnosis pipeline (1050 lines, standalone-runnable)assets/generate_sample.py — Dirty sample data generatorassets/sample_dirty.csv — Pre-generated test data with embedded anomaliestests/run_test.py — Self-test script質量很好,能自動處理各種「髒」資料(亂碼、格式不統一、缺失值),生成一份圖文並茂的診斷報告,直接告訴你哪裡出了問題、為什麼。安全性做得很到位,使用者資料不會被惡意注入干擾。介面顏色符合國內業務習慣(紅跌綠漲)。主要不足是當資料量很大時生成的 HTML 報告會偏大,開啟速度較慢;另外對年份較少的同比分析用處有限。整體來說,這是一個非常實用的經營診斷工具,非技術背景使用者也能輕鬆上手。