pdf-reader
Skill3 starsChanged 4 months agoMITView on GitHub
Convert PDFs to accurate Markdown for AI reading using pdf-inspector (Rust) — smart text/scanned classification, per-page OCR routing, page markers, and context-size chunking. Cross-platform (macOS/Linux/Windows).
- Installs packages
14 other projects use a version of this.
Adopted by
Most recently taken up by
- bwinken/skillstheir own version, first seen Nov 29, 2026
- drinkspiller/skillstheir own version, first seen Nov 23, 2026
- Damon-GSY/skillstheir own version, first seen Nov 8, 2026
- shkodnik1917/claude-brainlabtheir own version, first seen Nov 8, 2026
- Vepricov/claude-brainlabtheir own version, first seen Nov 1, 2026
- jtepe/slopclubtheir own version, first seen Oct 20, 2026
Other versions14 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 14
- amosblomqvist/pi-config★ 1.1ksame name
- Vepricov/claude-brainlab★ 37same name
- shkodnik1917/claude-brainlab★ 36same name
- BluebagAI/skills★ 33same name
- phanghonghao/THU-Awesome-Skills★ 8same name
- themusecatcher/ai-coding-kit★ 2same name
- tunnckoCore/skills★ 2same name
- bwinken/skills★ 1same name
- Damon-GSY/skills★ 1same name
- drinkspiller/skills★ 1same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Do NOT use for image-only/scanned PDFs expecting embedded text: pdf-inspector is not an OCR engine.
- Distinctive: line 35
If the folder is missing, clone or copy it from the skill repo, or follow README.md step-by-step installation.
- Very specific: line 50
Read the output: type=text_based|scanned|image_based|mixed, confidence, pages_needing_ocr=[...].
- Very specific: line 97
If pages_needing_ocr is non-empty, say so — never invent content for those pages.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
pdf-reader
Turn a PDF into clean, position-aware Markdown that an AI model can read without misreading the layout. Backed by pdf-inspector (Firecrawl's Rust engine), which handles columns, tables, headings, lists, and code blocks, and tells you exactly which pages (if any) need OCR.
When to use
- The user shares or points at a PDF and asks you to read, summarize, extract, or quote from it — and your model cannot read PDFs natively.
- The PDF contains tables, multi-column layouts, or dense formatting where a naive text dump would corrupt the meaning.
- You need to cite specific pages of a document.
Do NOT use for image-only/scanned PDFs expecting embedded text: pdf-inspector
is not an OCR engine. It will classify them as scanned/image_based and
flag every page — that is the signal to route to OCR (--ocr-cmd) instead.
Prerequisites
- Python 3 (≥ 3.8) with
pip install pdf-inspector(prebuilt wheels for macOS Intel/ARM, Linux x86_64/aarch64, Windows x64 — no Rust toolchain). - The core CLI is
scripts/pdf_read.py— thescripts/folder sits NEXT TO this SKILL.md. Resolve it relative to this file:<this-skill-folder>/scripts/pdf_read.py(and<this-skill-folder>/scripts/install.pyfor one-shot installation). Reference docs live inreferences/(api-guide.md,rules.md). If the folder is missing, clone or copy it from the skill repo, or followREADME.mdstep-by-step installation.
Procedure
PDF_READbelow stands for<this-skill-folder>/scripts/pdf_read.py— the folder next to this SKILL.md.
- Locate the wrapper — resolve
scripts/pdf_read.pynext to this file. If it is not present, tell the user it must be installed with the skill (README.mdhas the steps). - Classify first (fast, ~10–50 ms):
Read the output:python3 "$PDF_READ" <document.pdf> --classifytype=text_based|scanned|image_based|mixed,confidence,pages_needing_ocr=[...]. - Convert (default writes
<document>.md+<document>.md.meta.json):
For a quick answer you may pipe instead:python3 "$PDF_READ" <document.pdf>python3 "$PDF_READ" <document.pdf> --stdout --pages 1-10 - Read the Markdown, honoring these rules:
<!-- Page N -->markers = source pages. When you quote or cite, say which page a passage came from.|tables are real Markdown tables — read them as tables, with headers and cells, not as prose.- Headings are
#/##/###(font-size-based from the original PDF). <!-- OCR REQUIRED: page N ... -->means page N has no embedded text: do not guess its content. Either report that page N needs OCR, or run the OCR hook (step 5).
- OCR fallback for flagged pages — run a local OCR engine per page:
The hook output is spliced into the Markdown at the page's position. Placeholders (python3 "$PDF_READ" <document.pdf> --ocr-cmd 'tesseract {input} stdout -l eng'{input}{page}{out}{stem}{outdir}) are shell-quoted automatically — use them bare, never wrapped in quotes. - Long documents / small context windows — split into chunks:
Readspython3 "$PDF_READ" <document.pdf> --chunks 8000<document>.chunk-001.md,.chunk-002.md, ... in order; the manifest<document>.md.chunks.jsonlists sizes and page ranges. Do not feed more than fits the model's context; keep the page markers when quoting. - Machine-readable use (pipelines, tools):
Markdown → stdout, JSON envelope → stderr. Exit codes: 0 ok (OCR pages reported, not fatal), 1 error, 2 usage, 3python3 "$PDF_READ" <document.pdf> --json --stdout--fail-on-ocr: pages still lack reliable text after the OCR hook (nothing is written on exit 3).
Quality checks (do these before answering from the output)
- Spot-check 2–3 headings and 1 table against the original document's known structure; if the Markdown looks broken (garbled text, missing sections), mention it to the user instead of silently working from bad data.
- If
pages_needing_ocris non-empty, say so — never invent content for those pages. - For huge PDFs (hundreds of pages), prefer
--pagesor--chunksover reading everything at once.
Troubleshooting
| Symptom | Cause / fix |
pdf_inspector is not installed | python3 -m pip install pdf-inspector |
| Exit 1, "password-protected or malformed" | encrypted PDF — unlock it first |
type=scanned with all pages flagged | genuinely scanned; run --ocr-cmd or tell the user OCR is needed |
confidence low (< 0.7) on mixed docs | check pages_needing_ocr and treat flagged pages as unreadable |
| Math looks odd | equations extract as inline glyphs; preserve them but don't "fix" silently |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

