企业 Excel 清单清洗总入口 — Enterprise Excel Cleaner
Take one messy enterprise Excel list, decide what it is, clean it with the matching bundled module, validate the result, and hand back the cleaned workbook. Fully automatic: the user never picks a type and never confirms a guess.
Core Boundary
This skill is offline and file-based.
- Do not connect to any live purchasing, warehouse, or finance system.
- Do not read or write any production database.
- Do not place orders, approve purchases, post stock movements, or call any API.
- Do not perform financial accounting, tax calculation, or price compliance judgement.
- Never modify the uploaded workbook. Every layer opens it read-only.
- Never call another Skill at runtime. The four cleaning modules are bundled inside this package.
Fixed Flow
上传 Excel → 自动分析 → 自动识别 → 包内自动路由 → 自动清洗 → 自动验证 → 输出 Excel
Four layers, in this order, all inside the package:
| 层 | 模块 | 职责 |
| --- | --- | --- |
| 识别 | recognizer.py | 结构、表头、标题、Sheet 名、文件名、合并单元格、说明文字、正文关键词多层取证并打分 |
| 预检 | precheck.py | 对候选类型做只读兼容性预检,必填字段、专有字段、冲突字段、可用数据行 |
| 调度清洗 | dispatcher.py | 按候选顺序选择第一个预检通过的模块并执行清洗 |
| 输出验证 | validator.py | 校验输出工作簿的 Sheet、表头、数量金额一致性、报告与 errors.csv |
Only when validation passes does the router return success. If validation fails,
the partial outputs are discarded and nothing is presented as a result.
Behaviour Rules
- Never ask the user which type it is. Recognition is the product. Asking the user to confirm defeats the purpose of this entry skill.
- Never announce intermediate guesses. Do not narrate "看起来像采购清单". Run the pipeline and report the final outcome.
- Only deliver the final result. Hand the user the cleaned Excel plus
处理报告.md. Do not paste the whole report body into the chat. - Never mention the four vertical Skills by slug. Inside this entry skill the
modules are
inbound/purchase/stocktake/quotation, not separately published products. The router already strips legacy "可能选错了 Skill" hints from bundled module reports. - Structure beats keywords. A title saying 采购 does not outrank an 账面数量 + 实盘数量 column pair. Recognition already encodes this; do not override it.
Supported Types
| 模块 | 场景 | 主输出 |
| --- | --- | --- |
| inbound | 物资入库清单 | cleaned_inbound_template.xlsx |
| purchase | 采购清单 / 采购订单 | cleaned_purchase_template.xlsx |
| stocktake | 盘点表 | cleaned_stocktake_template.xlsx |
| quotation | 供应商报价单 | quotation_comparison.xlsx |
Not covered in v0.1.0: 领料 / 申领清单、工资考勤财务报销等高风险场景、图片型表格、 PDF 表格、扫描件 OCR、一个工作簿混合多种业务类型且要求一次全部清洗。
Safe Stop
Stop only in these cases, and say so plainly:
- 四类均无法可靠识别(
unsupported) - 文件损坏或无法读取(报告中带
文件读取失败) - 所有候选模块预检均失败(
unsupported) - 同一工作簿混有多种业务类型(
multi_sheet_conflict/multi_sheet_unsupported) - 清洗结果未通过自动验证(
validation_failed)
When stopping, tell the user 「不支持或无法可靠处理」, point at 处理报告.md, and
suggest splitting mixed workbooks into separate files. Never force a file into a
category just to produce output.
Script
One command does everything:
python3 scripts/clean_enterprise_excel.py input.xlsx --out-dir outputs
Exit codes: 0 cleaned and validated, 2 safely stopped, 1 internal error.
Add --json when the result needs to be consumed programmatically.
Outputs in --out-dir:
- the cleaned workbook (name depends on the recognised type)
- the module report (
import_report.md/purchase_report.md/stocktake_report.md/quotation_report.md), with legacy Skill hints removed errors.csv处理报告.md— the unified 07 report: 候选排序、命中证据、预检结果、自动验证、 输出文件完整性、关键字段识别证据.xlsx— the same evidence as a read-only workbook
Python API:
from enterprise_excel_cleaner.router import analyze_workbook, clean_enterprise_excel
result = clean_enterprise_excel("input.xlsx", "outputs")
result.status # "success" | "unsupported" | "validation_failed" | ...
result.selected_type # "inbound" | "purchase" | "stocktake" | "quotation" | None
result.output_file # Path | None,只有验证通过才非空
result.used_external_skill # 恒为 False
analyze_workbook is read-only and never cleans anything — use it when you only
need the recognition evidence.
Module Sync
The four cleaning modules are copies of the corresponding vertical cleaners.
MODULE_SYNC.md records upstream version, path, source SHA-256 and copy SHA-256.
python3 scripts/check_module_drift.py
Read-only: reports current / changed / missing, never copies and never
overwrites. On changed, do a sync review and a full regression run before
touching the bundled copy, then update MODULE_SYNC.md and this skill's version.
Human Review
The output is a preparation file, not a system of record. Structural and arithmetic consistency is checked automatically; business correctness is not. Tell the user to review quantities and amounts before importing anything.
微信扫一扫