用 MinerU 将复杂PDF文档转换为LLM友好的Markdown/JSON格式。适用于:(1) PDF转Markdown/JSON,(2) 提取PDF中的文本、表格、公式、图像,(3) 解析学术论文、技术文档、商业报告,(4) 为RAG应用准备文档数据,(5) 批量处理PDF。触发关键词:"PDF解析"、"PDF转Markdown"、"提取PDF表格/公式"、"MinerU"、"parse PDF"等。不用于:PDF的阅读/填表/签名/拆分合并(用宿主pdf工具)、Word/PPT等非PDF格式解析、只需读几页内容的场景(直接读即可,不必转换)。
npx skills add https://github.com/staruhub/ClaudeSkills --skill mineru-pdf-parser
将复杂PDF文档转换为机器可读的Markdown/JSON格式,适用于LLM和RAG应用。
# 推荐使用uv安装
pip install uv
uv pip install -U "mineru[all]"
# 下载模型(首次使用)
mineru-models-download
# 解析单个PDF
mineru -p input.pdf -o output_dir
# 批量解析
mineru -p pdf_folder/ -o output_dir
# 指定解析模式
mineru -p input.pdf -o output_dir --backend vlm # VLM模式(高精度)
mineru -p input.pdf -o output_dir --backend pipeline # Pipeline模式(快速)
mineru -p input.pdf -o output_dir --backend hybrid # 混合模式(平衡)
from mineru import MinerU
mineru = MinerU()
result = mineru.parse("document.pdf")
# 获取输出
markdown = result.to_markdown()
json_data = result.to_json()
详细API见 references/api_reference.md
| 模式 | 特点 | 适用场景 |
|------|------|----------|
| pipeline | 快速、资源少 | 简单文档、纯文本PDF |
| vlm | 高精度、复杂布局 | 学术论文、公式表格文档 |
| hybrid | 平衡速度精度 | 通用场景 |
{filename}.md - Markdown正文{filename}_content_list.json - 结构化JSONimages/ - 提取的图像{filename}_middle.json - 中间结果(调试)格式详情见 references/output_formats.md
mineru -p paper.pdf -o output --backend vlm
from mineru import MinerU
import os
mineru = MinerU(backend="hybrid")
for pdf in os.listdir("pdfs/"):
if pdf.endswith(".pdf"):
result = mineru.parse(f"pdfs/{pdf}")
result.save(f"output/{pdf[:-4]}/")
sections = result.get_sections()
for section in sections:
vector_db.add(section.title, section.content)
修改 ~/.mineru.json 中 device-mode 为 cuda。
更多见 references/best_practices.md
.md 与 _content_list.json 都存在,把实际路径回报用户| 陷阱 | 具体表现 | 应对 |
|------|---------|------|
| 首次运行缺模型 | 未执行 mineru-models-download 直接解析报错 | 安装后先跑模型下载;下载体积大,提前告知用户耗时 |
| 无 GPU 硬跑 vlm | CPU 上 vlm 模式极慢,像卡死 | 无 GPU 时用 pipeline/hybrid;有 GPU 改 ~/.mineru.json 的 device-mode 为 cuda |
| 扫描件预期过高 | 低清晰度扫描 PDF 解析质量差 | 提前告知扫描件效果取决于清晰度;结果差时换 backend 重试一次,仍差则如实报告 |
| 大文件内存压力 | 数百页 PDF 单次解析内存暴涨 | 大文件分批解析或按章节拆分 |
使用 scripts/mineru_parse.py 进行解析,支持错误处理和日志记录。
Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
Use this skill any time a .pptx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates, layouts, speaker notes, or comments. Trigger whenever the user mentions \"deck,\" \"slides,\" \"presentation,\" or references a .pptx filename, regardless of what they plan to do with the content afterward. If a .pptx file needs to be opened, created, or touched, use this skill.
Create and edit Obsidian Flavored Markdown with wikilinks, embeds, callouts, properties, and other Obsidian-specific syntax. Use when working with .md files in Obsidian, or when the user mentions wikilinks, callouts, frontmatter, tags, embeds, or Obsidian notes.
Take staruhub/mineru-pdf-parser from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip, uv.
Without those the skill loads but fails at the first command.