# 导出版式校验Skill 设计 ## 1. Skill 定位 `导出版式校验Skill` 负责检查回填后的 Word 文件是否仍有未替换占位符、必填字段是否落位、基础版式是否完整。 英文实现标识建议使用 `ExportLayoutCheckSkill`。 ## 2. 输入 ```python @dataclass class ExportLayoutCheckInput: output_file_path: Path template_mappings: list[dict] ``` ## 3. 输出 ```python @dataclass class ExportLayoutCheckOutput: layout_check_status: str unfilled_placeholders: list[str] layout_warnings: list[dict] ``` ## 4. 核心方法 ### 4.1 `run(input) -> ExportLayoutCheckOutput` 主入口方法。 ### 4.2 `detect_unfilled_placeholders(file) -> list[str]` 检查残留占位符。 ### 4.3 `validate_required_fields(file, mappings) -> list[dict]` 校验必填字段。 ### 4.4 `validate_basic_layout(file) -> list[dict]` 校验基础版式元素。 ## 5. 技术实现 使用技术: 1. `python-docx` 2. 可选 LibreOffice 转 PDF 3. 占位符扫描规则 ## 6. 异常处理 1. 文件不存在:校验失败。 2. 残留占位符:标记待复核。 3. 版式元素缺失:标记警告。 ## 7. 测试要点 1. 残留占位符可识别。 2. 必填字段缺失可识别。 3. 正常文档通过校验。