本文へ移動
cccskills
無料GitHub で公開

ocr-and-documents

OCR for scanned/image-only PDFs and complex documents (pymupdf, marker-pdf). For text-based PDFs use read_file.

インストール方法を見る

含まれるファイル(4)

  • SKILL.md5.8 KB
  • DESCRIPTION.md147 B
  • scripts/extract_marker.py3.0 KB
  • scripts/extract_pymupdf.py3.1 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

OCR for scanned PDFs and complex documents

This skill is for scanned / image-only PDFs and complex layouts only. For text-based PDFs, DOCX, XLSX, or PPTX, the harness has native parsing built in — see Step 0.

Step 0: Is this actually OCR territory?

For text-based PDFs / DOCX / XLSX / PPTX, call read_file directly — don't OCR them:

read_file(path="path/to/document.pdf")

The harness parses text-based formats natively via markitdown and returns markdown. Only continue with this skill if all of these are true:

  1. The file is a PDF.
  2. read_file returned empty content, a parse error, or output that is clearly missing the visible text (i.e. the PDF is a scan / image wrapper with no text layer).
  3. OR the user explicitly asked for OCR / handwriting recognition / a richer layout-aware extraction than markitdown provides.

For DOCX use read_file (or python-docx / the docx skill for editing). For PPTX use read_file (or the pptx skill for editing).

Step 1: Remote URL Available?

If the document has a URL, always try web_extract first:

web_extract(urls=["https://arxiv.org/pdf/2402.03300"])
web_extract(urls=["https://example.com/report.pdf"])

This handles PDF-to-markdown conversion via Firecrawl with no local dependencies.

Only use local extraction when: the file is local, web_extract fails, or you need batch processing.

Step 2: Choose Local Extractor

Featurepymupdf (~25MB)marker-pdf (~3-5GB)
Text-based PDF✅✅
Scanned PDF (OCR)❌✅ (90+ languages)
Tables✅ (basic)✅ (high accuracy)
Equations / LaTeX❌✅
Code blocks❌✅
Forms❌✅
Headers/footers removal❌✅
Reading order detection❌✅
Images extraction✅ (embedded)✅ (with context)
Images → text (OCR)❌✅
EPUB✅✅
Markdown output✅ (via pymupdf4llm)✅ (native, higher quality)
Install size~25MB~3-5GB (PyTorch + models)
SpeedInstant~1-14s/page (CPU), ~0.2s/page (GPU)

Decision: Use pymupdf unless you need OCR, equations, forms, or complex layout analysis.

If the user needs marker capabilities but the system lacks ~5GB free disk:

"This document needs OCR/advanced extraction (marker-pdf), which requires ~5GB for PyTorch and models. Your system has [X]GB free. Options: free up space, provide a URL so I can use web_extract, or I can try pymupdf which works for text-based PDFs but not scanned documents or equations."


pymupdf (lightweight)

pip install pymupdf pymupdf4llm

Via helper script:

python scripts/extract_pymupdf.py document.pdf              # Plain text
python scripts/extract_pymupdf.py document.pdf --markdown    # Markdown
python scripts/extract_pymupdf.py document.pdf --tables      # Tables
python scripts/extract_pymupdf.py document.pdf --images out/ # Extract images
python scripts/extract_pymupdf.py document.pdf --metadata    # Title, author, pages
python scripts/extract_pymupdf.py document.pdf --pages 0-4   # Specific pages

Inline:

python3 -c "
import pymupdf
doc = pymupdf.open('document.pdf')
for page in doc:
    print(page.get_text())
"

marker-pdf (high-quality OCR)

# Check disk space first
python scripts/extract_marker.py --check

pip install marker-pdf

Via helper script:

python scripts/extract_marker.py document.pdf                # Markdown
python scripts/extract_marker.py document.pdf --json         # JSON with metadata
python scripts/extract_marker.py document.pdf --output_dir out/  # Save images
python scripts/extract_marker.py scanned.pdf                 # Scanned PDF (OCR)
python scripts/extract_marker.py document.pdf --use_llm      # LLM-boosted accuracy

CLI (installed with marker-pdf):

marker_single document.pdf --output_dir ./output
marker /path/to/folder --workers 4    # Batch

Arxiv Papers

# Abstract only (fast)
web_extract(urls=["https://arxiv.org/abs/2402.03300"])

# Full paper
web_extract(urls=["https://arxiv.org/pdf/2402.03300"])

# Search
web_search(query="arxiv GRPO reinforcement learning 2026")

Split, Merge & Search

pymupdf handles these natively — use execute_code or inline Python:

# Split: extract pages 1-5 to a new PDF
import pymupdf
doc = pymupdf.open("report.pdf")
new = pymupdf.open()
for i in range(5):
    new.insert_pdf(doc, from_page=i, to_page=i)
new.save("pages_1-5.pdf")
# Merge multiple PDFs
import pymupdf
result = pymupdf.open()
for path in ["a.pdf", "b.pdf", "c.pdf"]:
    result.insert_pdf(pymupdf.open(path))
result.save("merged.pdf")
# Search for text across all pages
import pymupdf
doc = pymupdf.open("report.pdf")
for i, page in enumerate(doc):
    results = page.search_for("revenue")
    if results:
        print(f"Page {i+1}: {len(results)} match(es)")
        print(page.get_text("text"))

No extra dependencies needed — pymupdf covers split, merge, search, and text extraction in one package.


Notes

  • web_extract is always first choice for URLs
  • pymupdf is the safe default — instant, no models, works everywhere
  • marker-pdf is for OCR, scanned docs, equations, complex layouts — install only when needed
  • Both helper scripts accept --help for full usage
  • marker-pdf downloads ~2.5GB of models to ~/.cache/huggingface/ on first use
  • For Word docs: pip install python-docx (better than OCR — parses actual structure)
  • For PowerPoint: see the powerpoint skill (uses python-pptx)

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

The Arbor research-coordinator protocol: the OBSERVE -> IDEATE -> SELECT -> DISPATCH -> DECIDE cycle over a durable Idea Tree. Preloaded automatically on /auto-research sessions. The coordinator never edits code or runs commands — executors do that in isolated worktrees; the coordinator steers the tree with idea_tree / dispatch_experiments / merge_experiment.

日本語の概要は準備中です。原文の説明を表示しています。

invergent-ai/surogates282026年10月12日 更新

The Arbor executor workflow: clone the repo from the git bundle your brief hands you, implement and evaluate exactly ONE hypothesis with the file tools, then report structured results via worker_complete. Preloaded automatically on arbor-executor task workers. Never touch the held-out test split.

日本語の概要は準備中です。原文の説明を表示しています。

invergent-ai/surogates282026年10月12日 更新

Hard-gated ideation for an Arbor research run. Load at the START of every IDEATE round, before drafting any hypothesis. Enforces the PI mindset (mechanism over knob), the four-question first-principles probe, the kill-filter, and the four-line hypothesis format. Ported from Arbor's idea_drafting + first_principles_probe.

日本語の概要は準備中です。原文の説明を表示しています。

invergent-ai/surogates282026年10月12日 更新

DECIDE-phase doctrine for an Arbor research run: when to merge, prune, combine, or finalize; how the held-out merge gate works; and the rule that the final report uses TEST scores. Load before deciding what to do with completed experiments.

日本語の概要は準備中です。原文の説明を表示しています。

invergent-ai/surogates282026年10月12日 更新

Intake for an autonomous research run (Arbor). Use when the user wants to optimize a metric in a repo over many isolated experiments — 'optimize this benchmark', 'improve the model F1 overnight', 'beat the leaderboard'. Discovers the repo/eval/splits, measures the baseline, confirms a Research Contract, then emits a ready-to-send /auto-research command. Does NOT start the run itself.

日本語の概要は準備中です。原文の説明を表示しています。

invergent-ai/surogates282026年10月12日 更新

You MUST use this before any creative work — creating features, building components, drafting documents, designing workflows, or modifying behavior. Explores your human partner's intent, requirements, and design before any implementation begins.

日本語の概要は準備中です。原文の説明を表示しています。

invergent-ai/surogates282026年10月12日 更新

invergent-ai のスキルをすべて見る

このスキルの問題を報告する