document-conversion
将 DOC/DOCX/PDF/PPT/PPTX 文档转换为 Markdown 格式。自动检测 PDF 类型(电子版/扫描版),提取图片到独立目录。当管理员入库非 Markdown 文档时使用此 Skill。触发条件:入库 DOC/DOCX/PDF/PPT/PPTX 格式文件。
When & Why to Use This Skill
This Claude skill automates the conversion of multi-format documents—including DOCX, PDF, and PPTX—into high-quality Markdown. It features intelligent PDF detection to switch between fast extraction and OCR for scanned files, while automatically managing image extraction to ensure seamless integration into AI-ready knowledge bases and RAG workflows.
Use Cases
- Knowledge Base Onboarding: Efficiently migrate legacy corporate documents (Word, PDF, PPT) into Markdown format for centralized AI knowledge management.
- Automated OCR Processing: Automatically detect scanned PDF documents and apply PaddleOCR to extract text and images into structured digital formats.
- Content Repurposing: Convert presentation slides (PPTX) into structured Markdown text and separate image assets for technical documentation or blog posts.
- Data Preparation for LLMs: Clean and format unstructured documents into standardized Markdown to improve the accuracy of retrieval-augmented generation (RAG) systems.
| name | document-conversion |
|---|---|
| description | Convert DOC/DOCX/PDF/PPT/PPTX documents to Markdown format. Automatically detect PDF type (electronic/scanned), extract images to separate directory. Use this Skill when administrator onboards non-Markdown documents. Trigger condition: Onboard DOC/DOCX/PDF/PPT/PPTX format files. |
Document Format Conversion
Convert various document formats to Markdown for knowledge base onboarding.
Supported Formats
| Format | Processing Method |
|---|---|
| DOCX | Pandoc conversion, preserve formatting and images |
| DOC | LibreOffice → DOCX → Pandoc |
| PDF Electronic | PyMuPDF4LLM fast conversion |
| PDF Scanned | PaddleOCR-VL online OCR |
| PPTX | pptx2md professional conversion |
| PPT | LibreOffice → PPTX → pptx2md |
Usage
python .claude/skills/document-conversion/scripts/smart_convert.py \
<temp_path> \
--original-name "<original_filename>" \
--json-output
Parameters:
<temp_path>: Temporary file path (e.g./tmp/kb_upload_xxx.pptx)--original-name: Must pass original filename, used to generate correct image directory name--json-output: Output JSON format result
Output Format
{
"success": true,
"markdown_file": "/path/to/output.md",
"images_dir": "original_filename_images",
"image_count": 5,
"input_file": "/path/to/input.pptx"
}
Processing Flow
- Execute conversion command (must use
--original-nameand--json-output) - Parse JSON output, check
successfield - If
success: false, report error and end - If
success: true, record generated file path and image directory
Important Notes
- Image directory uses original filename naming (e.g.
培训资料_images/) - Not passing
--original-namewill cause incorrect image reference paths - PDF type is automatically detected, scanned version processing is slower (tens of seconds to minutes)
Format Details
Detailed processing instructions for each format, see FORMATS.md