pdf-to-markdown
Skill491 starsChanged 3 months agoMITView on GitHub
Split a PDF into chunks and convert it to readable markdown text. Use when the user wants to read, extract, or convert a PDF document.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- laodao-ai/laodao-skillstheir own version, first seen Sep 26, 2026
- abr4xas/skillstheir own version, first seen Sep 23, 2026
- pamelafox/presentation-skillstheir own version, first seen Sep 2, 2026
- yhbcode000/paper-share-skillstheir own version, first seen Aug 10, 2026
- paulmaunders/claude-skill-pdf-to-markdowntheir own version, first seen Jun 10, 2026
- Emmerson-Miranda/claude-skillstheir own version, first seen Jun 9, 2026
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- pamelafox/presentation-skills★ 125same name
- aliceisjustplaying/claude-skill-pdf-to-markdown★ 52same name
- yhbcode000/paper-share-skills★ 43same name
- laodao-ai/laodao-skills★ 4same name
- abr4xas/skills★ 2same name
- Alex-tangt/skill-system★ 2same name
- paulmaunders/claude-skill-pdf-to-markdown★ 2same name
- tbrandenburg/skills★ 1same name
- Emmerson-Miranda/claude-skills★ 0same name
- loongyowl/my-skills★ 0same name
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.
- audit-analysisSkill
- explain-diffSkill
- explorable-deckSkill
- paper-versionSkill
- review-grantSkill
- review-paper-checksSkill
- review-paper-codeSkill
- review-paper-lightSkill
- review-paperSkill
- review-papSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
3
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 19
Before reading anything, check whether pdftotext (part of poppler) is available:
- Distinctive: line 30
If the path is relative, resolve it relative to the current working directory.
- Very specific: line 31
Run mdls -name kMDItemNumberOfPages "<pdf_path>" to get the total page count.
- Distinctive: line 105
After running, sanity-check the output:
- Distinctive: line 115
If the tail looks truncated mid-paragraph, the heading detection likely fired on a false positive.
- Very specific: line 119
Read the PDF in chunks of up to 20 pages at a time using the Read tool's pages parameter: 1-20, 21-40, 41-60, etc.
“Common” is measured: kept by at least 6 in 10 of the 6 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 Split & Convert
Convert a PDF file to readable markdown text. Handles large PDFs efficiently.
Input
$ARGUMENTS[0]— Path to the PDF file (required)
Choose the method first
Before reading anything, check whether pdftotext (part of poppler) is available:
which pdftotext- If available → use the pdftotext path below. It is 10–100× faster than the Read tool, uses no model context for the text content, and doesn't suffer from stream idle timeouts. Always prefer this for PDFs longer than ~30 pages.
- If not available → fall back to the Read-tool path. Warn the user that large PDFs (>40 pages) may hit stream idle timeouts when run in subagents (~12 min cap). Prefer running in the main conversation for large files.
Resolve the path and get page count
- If the path is relative, resolve it relative to the current working directory.
- Run
mdls -name kMDItemNumberOfPages "<pdf_path>"to get the total page count. Ifmdlsis unavailable or returns(null), usepdftotextor Read to probe.
Method A — pdftotext (preferred)
Extract the full PDF to text in one shot, then trim at references/appendix and add page markers. pdftotext emits a form-feed character (\f) at every page break — use that for pagination.
Reference implementation (bash + awk):
PDF="$1"
OUT="${PDF%.pdf}.md"
TITLE=$(basename "${PDF%.pdf}")
TMPTXT=$(mktemp)
pdftotext -layout "$PDF" "$TMPTXT"
awk -v title="$TITLE" '
BEGIN {
print "# " title
print ""
page = 1
printf "---\n## Pages %d-%d\n---\n", page, page+19
next_marker = page + 20
}
{
# Convert form-feed page breaks to newlines and count pages
n = gsub(/\f/, "\n")
if (n > 0) {
page += n
if (page >= next_marker) {
printf "\n---\n## Pages %d-%d\n---\n", next_marker, next_marker+19
next_marker += 20
}
}
# Build a stripped copy for heading detection.
# CRITICAL: strip both form feeds AND embedded newlines — gsub above inserts
# newlines into $0, which will defeat regex anchors like ^ and $ if you skip this.
stripped = $0
gsub(/[\f\n]/, "", stripped)
sub(/^[ \t]+/, "", stripped)
sub(/[ \t]+$/, "", stripped)
if (length(stripped) > 0) {
# References / Bibliography — standalone word, optionally numbered, short, no prose punctuation
if (length(stripped) < 50 && stripped !~ /[(),;]/) {
if (stripped ~ /^([0-9]+\.?[ \t]+)?(References|REFERENCES|Bibliography|BIBLIOGRAPHY)$/) exit
if (stripped == "Works Cited") exit
}
# Appendix — length up to ~120 chars (some titles are long), no prose punctuation
if (length(stripped) < 120 && stripped !~ /[(),;]/) {
# "Appendix A" alone (bare letter, no title)
if (stripped ~ /^Appendix[ \t]+[A-Z][0-9]*$/) exit
# "Appendix A. Title" or "Appendix A: Title" — punctuation REQUIRED to avoid
# matching body-text references like "Appendix H examines the effect..."
if (stripped ~ /^Appendix[ \t]+[A-Z][0-9]*[.:][ \t]+[A-Z].*$/) exit
# "APPENDIX A" variants
if (stripped ~ /^APPENDIX[ \t]+[A-Z][0-9]*([ \t]+.*)?$/) exit
# "Online Appendix [A]"
if (stripped ~ /^Online[ \t]+Appendix([ \t]+[A-Z].*)?$/) exit
# "Supplemental/Supplementary/Internet Appendix"
if (stripped ~ /^(Supplement(al|ary)|Internet)[ \t]+Appendix([ \t]+.*)?$/) exit
}
}
print
}
' "$TMPTXT" > "$OUT"
rm -f "$TMPTXT"
echo "Wrote $OUT ($(wc -l < "$OUT") lines)"After running, sanity-check the output:
# Should print nothing if trimming worked
grep -cE "^[[:space:]]*(References|Bibliography|REFERENCES|BIBLIOGRAPHY)[[:space:]]*$" "$OUT"
# Eyeball last few lines — should be prose/conclusion, not body-of-table or mid-paragraph
tail -5 "$OUT"If the tail looks truncated mid-paragraph, the heading detection likely fired on a false positive. If the tail shows references or appendix content, the detection missed the heading — inspect the PDF text around that area and extend the regex.
Method B — Read tool (fallback when pdftotext unavailable)
- Read the PDF in chunks of up to 20 pages at a time using the Read tool's
pagesparameter: 1-20, 21-40, 41-60, etc. - Focus on the MAIN TEXT ONLY. Stop including content once you hit "References", "Bibliography", "Works Cited", or an appendix section. If references appear mid-chunk, keep everything before them and drop the rest.
- Compile output:
- Save alongside the PDF with a
.mdextension. - Header:
# [Original Filename] - Page markers between chunks:
---\n## Pages X-Y\n--- - Preserve extracted text as-is.
- Save alongside the PDF with a
Warning: The Read tool is slow for large PDFs (roughly 30–60 seconds per 20-page chunk). A 60-page paper can take 3–4 minutes, and sub-agents have a ~13-minute stream idle timeout that this can hit. When running a batch of conversions, run them sequentially in the main conversation or use Method A.
Heading-detection pitfalls (hard-won lessons)
These false positives broke earlier attempts — keep them in mind whether you use Method A or B:
- Parenthetical references in body text like
(see Appendix B.5)— exclude lines containing(,),,, or;. - Body text starting with "Appendix X ..." like
Appendix H examines the differential effect...— require punctuation (.or:) immediately after the appendix letter when a title follows. Bare "Appendix A" alone on a line is still valid. - Line-wrapped headings —
pdftotextcan wrapOnline Appendixacross two lines if the PDF's layout is unusual. You'll seeOnlineon one line andAppendixon the next. The regex above matches the joined form; if you see false trims at a loneAppendixline, inspect and tighten. - Form-feed at start of page —
pdftotextemits\fas the first character on every new page. Aftergsub(/\f/, "\n")on$0, the line has an embedded\nthat defeats^/$anchors unless you alsogsub(/[\f\n]/, "", stripped)on your detection copy. - Length thresholds — simple "< 50 chars" is too tight for appendix titles. "Appendix A. Merging Mortgages with the Real Estate Database" is 59 chars. Use ~120 for appendix patterns, ~50 for bare References.
- Numbered section headings — some papers format as
7 Referencesor7. References. Allow an optional leading number.
Report results
Tell the user:
- Method used (pdftotext vs Read tool)
- Total pages processed
- Output file path and final line count
- Where trimming occurred (last section / page number included)
- Any pages that were unreadable or empty
For batch conversions, print a summary table and note any files whose trim point looks suspicious (very short output, or output ending mid-sentence).
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.

