pdf-to-markdown
Skill0 starsChanged 3 months agoMITView on GitHub
Convert a PDF into OKF-frontmatter markdown through a tiered, correctness-first pipeline: local structure extraction (pdf-inspector, docling for table-heavy docs), OCR for scanned pages (ocrmypdf), cross-engine verification (poppler), and Claude-vision escalation for pages the tools can't resolve. Use for /pdf-to-markdown, \"convert this PDF to markdown\", \"extract the text/tables from this PDF\", or \"turn this paper/report into markdown\". Non-PDF office documents belong to the doc-to-markdown skill instead.
- Installs packages
18 other projects use a version of this.
Adopted by
Most recently taken up by
- troia-51/claude-skillstheir own version, first seen Nov 16, 2026
- yohei1126/agent-skillstheir own version, first seen Nov 15, 2026
- krishagel/geoffreytheir own version, first seen Nov 15, 2026
- pamelafox/presentation-skillstheir own version, first seen Nov 8, 2026
- neysofu/skillstheir own version, first seen Oct 30, 2026
- franklinbaldo/skillstheir own version, first seen Oct 13, 2026
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- claesbackman/AI-research-feedback★ 523same name
- Azure-Samples/python-agentframework-demos★ 248same name
- pamelafox/presentation-skills★ 129same name
- aliceisjustplaying/claude-skill-pdf-to-markdown★ 49same name
- yhbcode000/paper-share-skills★ 29same name
- krishagel/geoffrey★ 9same name
- MoeenNehzati/famulus★ 4same name
- replynodes/replynodes-agent-skills★ 3same name
- abr4xas/skills★ 2same name
- paulmaunders/claude-skill-pdf-to-markdown★ 2same name
8 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.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- context-handoffSkill
- councilSkill
- deck-design-promptSkill
- doc-to-markdownSkill
- granolaSkill
- mckinsey-deckSkill
- url-to-markdownSkill
- wargameSkill
- yt-transcriptSkill
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 15 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
- Distinctive: line 47
Do the tier-3 workflow below, then deliver.
- Very specific: line 58
Read the listed pages of the source PDF directly with the Read tool (pages parameter.
- Very specific: line 69
Run pdf_to_markdown.py --reconcile <out.md> — it re-derives the report statuses from the markdown's own markers (placeholder gone + vision …
- Very specific: line 81
If the user asked for --no-vision (or offline), skip all of this and tell them which pages are unresolved and why.
“Common” is measured: kept by at least 6 in 10 of the 15 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-to-markdown
Deterministic, script-driven PDF conversion with a per-page audit trail. The
script does the tiered work (triage → extract → OCR → verify); you are
tier 3 — the script hands you exactly the pages it could not resolve, and
you transcribe them visually. references/design.md records the full design
and its rationale; read it before changing anything.
Convert
uv run <skill-dir>/scripts/pdf_to_markdown.py <file.pdf> [-o out.md] [--output-dir DIR]
# --json print the machine-readable report to stdout
# --no-vision fully local: flagged pages stay unresolved, no vision step
# --verify request a vision spot-check of unflagged pages too
# -l eng+spa OCR languages (tesseract codes)
# --images export figure images to <out>.assets/ and reference
# them (docling route; icons filtered by size)The markdown carries an invisible <!-- p.N --> anchor at every page
boundary — use it to locate a page when reviewing or citing. Deterministic
repair passes run before verification and are recorded per page in the
report's tier_history (repair:reversal(n) — word-order fixed against
the poppler reference; repair:debris(n) — OCR noise lines removed from
photo pages).
Outputs <stem>.md (OKF v0.2 frontmatter + content) and
<stem>.report.json (per-page status: every page is accounted for — nothing
is ever silently dropped).
Exit codes → what you do next
- 0 — clean. Every page extracted; born-digital pages cross-verified
against a second engine. Caveat: OCR'd pages pass verification
tautologically (both engines read the same tesseract output), so for
documents where correctness is critical, offer the user
--verify. Deliver the file. - 4 — converted, but pages need vision (
report.vision.pending_pages). Do the tier-3 workflow below, then deliver. - 2 — missing Homebrew dependency; stderr names the
brew installfix. - 1 — unexpected failure; read stderr, don't retry blindly.
Tier-3 workflow (you, on exit 4)
On exit 4 the command's own output ends with an ACTION REQUIRED block
listing the flagged pages, their reasons, and these exact steps — you never
need to open or parse <stem>.report.json (it exists as the provenance
artifact, nothing more).
- Read the listed pages of the source PDF directly with the Read tool
(
pagesparameter; ≤20 pages per request) — you get text + page image. - In the markdown file, replace each
<!-- page N: flagged (…) — awaiting vision transcription -->placeholder with your transcription of that page, headed by the label<!-- page N: transcribed by vision -->. If partial extractor output follows the placeholder, use it as a hint but trust the page image. - Numeric tables: cross-foot before accepting. Vision transcription
fails silently (plausible wrong values) — check totals/sums where the
table implies them; if a figure is illegible, write
[illegible]rather than a guess. - Run
pdf_to_markdown.py --reconcile <out.md>— it re-derives the report statuses from the markdown's own markers (placeholder gone + vision label present ⇒vision) and exits 0 when every page is resolved. Never edit the report JSON by hand.
With --verify, additionally sample 2–3 unflagged pages, Read them, and
compare against the markdown; report discrepancies to the user rather than
silently patching them. Prioritize "ocr" pages and pages with
recall: null in the report — those are exactly the ones the automatic
cross-check cannot really vouch for (OCR verification is tautological:
both engines read the same tesseract text layer).
If the user asked for --no-vision (or offline), skip all of this and tell
them which pages are unresolved and why.
Routing (informational)
Triage picks the extractor per document: pdf-inspector by default; docling
when layout is complex or table-heavy (better table structure, slower,
model-based). Scanned/garbled pages get one ocrmypdf pass whose mode is
chosen by reason code (--skip-text / --redo-ocr / --force-ocr — see
design.md for why garbled-text pages must use force). Every page's markdown
is then cross-checked against poppler's independent extraction; low recall
flags the page rather than trusting either engine.
Troubleshooting
- "missing dependencies" (exit 2) → run the printed
brew installlines. - First run is slow / downloads models → docling fetching weights;
one-time, cached under
~/.cache. - Wrong language OCR → pass
-lwith the right tesseract codes (needstesseract-langfor non-English). - Report says
low_recallon a page that looks fine → the verifier is conservative by design; Read the page, confirm visually, and if the markdown is actually complete just note it in the report (status stays auditable either way). word_orderreason → tokens are all present but their order is corrupted beyond automatic repair (scrambled TOC columns, shuffled table cells). Vision-transcribe the page; pay attention to reading order.ocr_debrisreason → an OCR pass over a decorative/photo page left mostly noise; transcribe visually what real text the page carries (often just a chapter title).- Encrypted PDF → not supported; ask the user for a decrypted copy.
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.

