智能解析办公文档,一键提取核心内容
简介
一键解析 PDF/Word/Excel/PPT 内容,智能提取关键信息、生成摘要并支持多文档对比,办公文档处理首选工具。
原始描述
Read, extract, summarize, and compare office documents including PDF, Word, Excel, and PowerPoint. Use when a user provides .pdf/.doc/.docx/.xls/.xlsx/.ppt/....
通过你的 Agent 添加
安装目录:office-document-assistant/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Office Document Assistant 是一款面向办公场景的多格式文档解析技能,支持 PDF、Word(.doc/.docx)、Excel(.xls/.xlsx)和 PowerPoint(.ppt/.pptx)的文本提取与结构化分析。用户上传文档后,系统自动调用捆绑的 Python 脚本(extract_office_text.py)进行确定性文本提取,优先提取内嵌文本,PDF 遇扫描件时自动降级至 OCR 识别。
典型使用场景包括:生成文档摘要、提取关键字段(日期、金额、联系人、行动项)、输出逐页/逐页大纲、解析表格结构、以及多文档内容对比。输出格式默认为一句概述 + 3-8 个要点,支持按需扩展为详细分析。
显著优点
- 多格式统一处理:单技能覆盖四大主流办公格式,无需切换工具链。
- 分层降级策略:PDF 先尝试
pypdf 内嵌文本提取,失败自动触发 OCR(支持中英双语),兼顾效率与兼容性。
- 结构化输出:JSON 中间结果包含
type/extraction/warning/truncated/text 等字段,便于程序化调用。
- 依赖灵活配置:现代文档仅需 Python + 4 个核心包;完整环境追加 Poppler、Tesseract、LibreOffice 即可处理扫描件与 legacy 格式。
- 清晰的边界声明:明确告知用户不保留原始版式、不解析复杂图表、不处理加密文件,降低误用风险。
潜在缺点与局限性
- 版式信息丢失:纯文本优先策略导致表格错位、分栏混乱、字体层级消失。
- 图表与图像理解弱:无法解释示意图、流程图、数据可视化的视觉含义。
- OCR 质量受限于训练数据:手写体、低分辨率扫描件、复杂排版识别率不稳定。
- Legacy 格式依赖外部工具:.doc/.xls/.ppt 需 LibreOffice 转换,增加环境复杂度。
- 无公式审计能力:Excel 仅提取单元格值,不解析公式逻辑与依赖关系。
适合人群
- 知识工作者:快速消化合同、报告、会议纪要等长文档。
- 数据分析师:批量提取 Excel 表格字段进行后续清洗。
- 合规与法务:多文档版本对比、关键条款定位。
- 开发者:通过 JSON 接口集成文档解析能力至自动化工作流。
常规风险
- 敏感信息泄露:处理含机密内容的文档时,需确认执行环境的数据隔离策略。
- OCR 误读导致决策偏差:关键数字、人名识别错误可能引发业务风险,建议高价值场景人工复核。
- 依赖缺失导致解析失败:生产环境若未安装 Tesseract 或 LibreOffice,遇到扫描 PDF 或旧版 Office 文件将直接报错。
- 截断风险:默认输出有长度限制,超长文档可能被截断,需显式调整
--max-chars 参数。
pypdf 内嵌文本提取,失败自动触发 OCR(支持中英双语),兼顾效率与兼容性。type/extraction/warning/truncated/text 等字段,便于程序化调用。- 版式信息丢失:纯文本优先策略导致表格错位、分栏混乱、字体层级消失。
- 图表与图像理解弱:无法解释示意图、流程图、数据可视化的视觉含义。
- OCR 质量受限于训练数据:手写体、低分辨率扫描件、复杂排版识别率不稳定。
- Legacy 格式依赖外部工具:.doc/.xls/.ppt 需 LibreOffice 转换,增加环境复杂度。
- 无公式审计能力:Excel 仅提取单元格值,不解析公式逻辑与依赖关系。
适合人群
- 知识工作者:快速消化合同、报告、会议纪要等长文档。
- 数据分析师:批量提取 Excel 表格字段进行后续清洗。
- 合规与法务:多文档版本对比、关键条款定位。
- 开发者:通过 JSON 接口集成文档解析能力至自动化工作流。
常规风险
- 敏感信息泄露:处理含机密内容的文档时,需确认执行环境的数据隔离策略。
- OCR 误读导致决策偏差:关键数字、人名识别错误可能引发业务风险,建议高价值场景人工复核。
- 依赖缺失导致解析失败:生产环境若未安装 Tesseract 或 LibreOffice,遇到扫描 PDF 或旧版 Office 文件将直接报错。
- 截断风险:默认输出有长度限制,超长文档可能被截断,需显式调整
--max-chars 参数。
- 敏感信息泄露:处理含机密内容的文档时,需确认执行环境的数据隔离策略。
- OCR 误读导致决策偏差:关键数字、人名识别错误可能引发业务风险,建议高价值场景人工复核。
- 依赖缺失导致解析失败:生产环境若未安装 Tesseract 或 LibreOffice,遇到扫描 PDF 或旧版 Office 文件将直接报错。
- 截断风险:默认输出有长度限制,超长文档可能被截断,需显式调整
--max-chars参数。
技能正文
name: office-document-assistant
description: Read, extract, summarize, and compare office documents including PDF, Word, Excel, and PowerPoint. Use when a user provides .pdf/.doc/.docx/.xls/.xlsx/.ppt/.pptx files and asks for summaries, key point extraction, page-by-page outlines, field extraction, table explanation, or multi-document comparison. Prefer the bundled extraction script for deterministic text extraction; for PDFs, fall back to OCR when embedded text is missing.
Office Document Assistant
Read, extract, summarize, and compare common office documents:
- Word (
.docx,.doc) - Excel (
.xlsx,.xls) - PowerPoint (
.pptx,.ppt)
Use this skill when the user wants the contents of a document explained, summarized, searched, or extracted into a simpler structure.
When to Use
Use this skill when the user:
- uploads a
.pdf/.doc/.docx/.xls/.xlsx/.ppt/.pptx - asks to summarize a document
- asks to extract dates, amounts, contacts, conclusions, specifications, risks, or action items
- asks for page-by-page / slide-by-slide structure
- asks what a spreadsheet or slide deck is saying
- asks to compare two or more documents after extracting their text
When Not to Use
Do not position this skill as a high-fidelity layout or visual analysis system.
It is not ideal for:
- precise preservation of original layout, formatting, or pagination
- detailed chart / diagram / image interpretation
- password-protected or encrypted files
- OCR-heavy image understanding beyond basic text recovery
- advanced spreadsheet analytics or formula auditing
- tracked-changes / redline reconstruction in Office documents
Core Workflow
- Confirm the document path.
- Run the bundled script:
python3 {skill_dir}/scripts/extract_office_text.py <file> --json
- Inspect the JSON fields:
type
extraction
warning
truncated
text
- Separate clearly in your response:
- directly extracted content
- your summary / inference based on that content
- If extraction is empty or weak:
- for PDF, check OCR availability first
- for legacy Office formats, check conversion tools
- If the user asks for a summary, default to:
- one-sentence overview
- 3–8 key points
- extra sections only when clearly present (dates, people, risks, data, conclusions, contacts)
- If the user asks for extraction, prefer structured fields over long prose.
Supported Formats and Strategy
PDF
- First extract embedded text with
pypdf.
- If extracted text is too short, fall back to OCR.
- OCR prefers
chi_sim+eng, then chi_sim, then eng.
- OCR pipeline requires both
pdftoppm and tesseract.
- If an official first-class PDF tool is exposed in the environment and the task is high-value or multi-PDF, you may prefer that tool; otherwise use this skill's script.
Word
python3 {skill_dir}/scripts/extract_office_text.py <file> --json
typeextractionwarningtruncatedtext
- directly extracted content
- your summary / inference based on that content
- for PDF, check OCR availability first
- for legacy Office formats, check conversion tools
- one-sentence overview
- 3–8 key points
- extra sections only when clearly present (dates, people, risks, data, conclusions, contacts)
pypdf.chi_sim+eng, then chi_sim, then eng.pdftoppm and tesseract..docx: extract paragraphs and tables directly..doc: tryantiword, thencatdoc, then LibreOffice conversion to.docx.
Excel
- Extract sheet names and the first rows of each sheet.
- Best for quickly understanding workbook structure and core fields.
- When explaining, focus on what each sheet represents, key columns, important figures, and obvious anomalies.
PowerPoint
- Extract slide text from shapes.
- Extract speaker notes when present.
- Summaries should usually be slide-by-slide or theme-based, not a giant raw dump.
Tools and Dependencies
- Extract slide text from shapes.
- Extract speaker notes when present.
- Summaries should usually be slide-by-slide or theme-based, not a giant raw dump.
Tools and Dependencies
Document clearly what is required versus optional.
Required runtime
python3
Required Python packages
pypdf — embedded text extraction from PDFs
python-docx — .docx extraction
openpyxl — .xlsx extraction
python-pptx — .pptx extraction
Optional but strongly recommended system tools
poppler-utils — provides pdftoppm for PDF → image conversion before OCR
tesseract-ocr — OCR engine
tesseract-ocr-chi-sim — Simplified Chinese OCR language pack
libreoffice — conversion fallback for legacy .doc, .xls, .ppt
antiword — direct .doc extraction fallback
catdoc — additional .doc extraction fallback
What each tool is used for
pypdf: try text-layer extraction from PDFs first
pdftoppm: rasterize PDF pages when OCR is needed
tesseract: recover text from scanned/image PDFs
python-docx: read paragraphs and tables from .docx
openpyxl: read sheets and rows from .xlsx
python-pptx: read slide text and notes from .pptx
libreoffice: convert older Office formats into newer parseable formats
antiword / catdoc: lightweight extraction options for .doc
Minimum useful setup
python3pypdf— embedded text extraction from PDFspython-docx—.docxextractionopenpyxl—.xlsxextractionpython-pptx—.pptxextraction
Optional but strongly recommended system tools
poppler-utils — provides pdftoppm for PDF → image conversion before OCR
tesseract-ocr — OCR engine
tesseract-ocr-chi-sim — Simplified Chinese OCR language pack
libreoffice — conversion fallback for legacy .doc, .xls, .ppt
antiword — direct .doc extraction fallback
catdoc — additional .doc extraction fallback
What each tool is used for
pypdf: try text-layer extraction from PDFs first
pdftoppm: rasterize PDF pages when OCR is needed
tesseract: recover text from scanned/image PDFs
python-docx: read paragraphs and tables from .docx
openpyxl: read sheets and rows from .xlsx
python-pptx: read slide text and notes from .pptx
libreoffice: convert older Office formats into newer parseable formats
antiword / catdoc: lightweight extraction options for .doc
Minimum useful setup
poppler-utils — provides pdftoppm for PDF → image conversion before OCRtesseract-ocr — OCR enginetesseract-ocr-chi-sim — Simplified Chinese OCR language packlibreoffice — conversion fallback for legacy .doc, .xls, .pptantiword — direct .doc extraction fallbackcatdoc — additional .doc extraction fallbackpypdf: try text-layer extraction from PDFs firstpdftoppm: rasterize PDF pages when OCR is neededtesseract: recover text from scanned/image PDFspython-docx: read paragraphs and tables from.docxopenpyxl: read sheets and rows from.xlsxpython-pptx: read slide text and notes from.pptxlibreoffice: convert older Office formats into newer parseable formatsantiword/catdoc: lightweight extraction options for.doc
Minimum useful setup
If only modern documents matter, the minimum practical setup is:
python3- Python packages:
pypdf,python-docx,openpyxl,python-pptx
Recommended full setup
For the most robust behavior across real-world files, install:
python3- Python packages:
pypdf,python-docx,openpyxl,python-pptx - system tools:
poppler-utils,tesseract-ocr,tesseract-ocr-chi-sim,libreoffice,antiword,catdoc
Dependency check
Use the bundled checker to quickly see what is missing in the current environment:
python3 {skill_dir}/scripts/check_deps.py
Common Commands
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.pdf" --json
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.docx" --json
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.xlsx" --json
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.pptx" --json
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.pdf" --json
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.docx" --json
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.xlsx" --json
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.pptx" --json
Useful flags:
# limit PDF pages scanned/extracted
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.pdf" --page-limit 10 --json
# limit rows per sheet when probing spreadsheets
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.xlsx" --row-limit 30 --json
# cap output text size
python3 {skill_dir}/scripts/extract_office_text.py "/path/to/file.pdf" --max-chars 30000 --json
Output Style
Default to a compact answer:
- one-sentence summary
- 3–8 key points
- then expand only if the user asks for:
- detailed summary
- page-by-page / slide-by-slide notes
- field extraction
- document comparison
Failure Handling
- If PDF text is empty, suspect scanned pages or missing OCR tools.
- If Chinese OCR is weak, check whether
tesseract-ocr-chi-sim is installed.
- If
.doc / .xls / .ppt extraction fails, check libreoffice, antiword, and catdoc.
- If tables look messy, explain that this is text-first extraction rather than full layout reconstruction.
- If a file is encrypted or unreadable, say so plainly and stop guessing.
References
tesseract-ocr-chi-sim is installed..doc / .xls / .ppt extraction fails, check libreoffice, antiword, and catdoc.Read these only when needed:
references/capabilities.md— capability boundaries and what each format can/can't do wellreferences/troubleshooting.md— dependency checks and common failure modes
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。