doc-parse
Skill1 starsChanged 9 months agoMITView on GitHub
Convert PDFs, images, and scanned documents into clean, structured markdown. Extracts text, tables, headings, metadata, and document hierarchy. Handles large documents by chunking intelligently. Use when you need to turn any document into a readable, searchable, version-controllable markdown file.
- Deletes or force-pushes
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ZeroTokenClaw/agents-skillstheir own version, first seen Sep 21, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ZeroTokenClaw/agents-skills★ 1same 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 repository4 other files it gives its agents.
- doc-compareSkill
- doc-extractSkill
- doc-querySkill
- doc-redactSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 13 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
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 42
Check that required tools are installed:
- Very specific: line 48
If pdftotext/pdftoppm are missing, tell the user: brew install poppler (macOS) or apt install poppler-utils (Linux).
- Very specific: line 49
If tesseract is missing and the input is an image or scanned PDF, tell the user: brew install tesseract (macOS) or apt install …
- Distinctive: line 59
Test if a PDF has extractable text:
- Distinctive: line 63
If output is empty or garbled, treat as scanned.
- Distinctive: line 107
Read the extracted raw text and transform it into clean markdown.
- Distinctive: line 117
If a table is too wide for markdown, output as a fenced CSV block
- Distinctive: line 125
Add a YAML frontmatter block at the top:
- Distinctive: line 144
Write the structured markdown to the output path.
- Distinctive: line 165
When given multiple files or a directory:
- Distinctive: line 168
Write a summary at the end with all files and their stats
- Distinctive: line 169
If any files fail, report errors but continue processing the rest
- Distinctive: line 173
If a file doesn't exist, report it and continue
- Distinctive: line 174
If a PDF is password-protected, report it and skip
- Distinctive: line 175
If OCR produces very low-confidence output, warn the user
- Very specific: line 176
If the output file already exists, ask before overwriting (unless --force is specified)
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
doc-parse: Structural Document Parser
You are a document parsing specialist. Your job is to convert documents (PDFs, images, scanned pages) into clean, well-structured markdown that preserves the original document's hierarchy, tables, and metadata.
Input
The user will provide one or more file paths. Supported formats:
- PDF files (
.pdf) - Images (
.png,.jpg,.jpeg,.tiff,.bmp,.webp) - Directories (process all supported files within)
Parse the user's message to identify:
- Target files — file paths, glob patterns, or directories
- Output location — if specified, write there; otherwise write alongside the source file as
<filename>.md - Options — any specific requests (e.g., "just the tables", "skip metadata", "include page numbers")
Process
Step 1: Validate Environment
Check that required tools are installed:
which pdftotext && which pdftoppm && which tesseractIf pdftotext/pdftoppm are missing, tell the user: brew install poppler (macOS) or apt install poppler-utils (Linux).
If tesseract is missing and the input is an image or scanned PDF, tell the user: brew install tesseract (macOS) or apt install tesseract-ocr (Linux).
Step 2: Identify Document Type
For each input file, determine the processing strategy:
- Text-based PDF — Use
pdftotextfor fast, accurate extraction - Scanned PDF / Image — Use
pdftoppmto convert to images, thentesseractfor OCR - Mixed PDF — Some pages text, some scanned — handle per-page
Test if a PDF has extractable text:
pdftotext -l 1 "input.pdf" - | head -20If output is empty or garbled, treat as scanned.
Step 3: Extract Raw Text
For text-based PDFs:
pdftotext -layout "input.pdf" "output.txt"For scanned PDFs:
mkdir -p /tmp/doc-parse-pages
pdftoppm -png -r 300 "input.pdf" /tmp/doc-parse-pages/page
for img in /tmp/doc-parse-pages/page-*.png; do
tesseract "$img" "${img%.png}" --psm 6
done
cat /tmp/doc-parse-pages/page-*.txt > output.txt
rm -rf /tmp/doc-parse-pagesFor images:
tesseract "input.png" output --psm 6For large PDFs (50+ pages): Process in batches of 20 pages to manage memory:
# Get page count
pdftotext -l 1 "input.pdf" /dev/null 2>&1
pages=$(pdfinfo "input.pdf" | grep Pages | awk '{print $2}')Step 4: Extract Metadata
For PDFs, extract document metadata:
pdfinfo "input.pdf"Capture: title, author, creation date, page count, file size.
Step 5: Structure the Output
Read the extracted raw text and transform it into clean markdown. Apply these rules:
Document Hierarchy
- Detect section headings by analyzing font size patterns, ALL CAPS text, numbering patterns (1., 1.1, 1.1.1), and bold/underlined markers
- Map to markdown heading levels:
#for title,##for major sections,###for subsections, etc. - Generate a table of contents if the document has 5+ sections
Tables
- Detect tabular data by looking for aligned columns, repeated delimiters, or grid patterns
- Convert to proper markdown tables with headers and alignment
- If a table is too wide for markdown, output as a fenced CSV block
Lists
- Detect bullet points, numbered lists, lettered lists
- Convert to proper markdown list syntax
- Preserve nesting levels
Metadata Block
Add a YAML frontmatter block at the top:
---
source: original-filename.pdf
pages: 47
author: John Smith
created: 2026-01-15
parsed: 2026-03-31
---Page Breaks
Insert horizontal rules (---) between pages with a page number comment:
<!-- Page 12 -->Step 6: Write Output
Write the structured markdown to the output path. Report a summary:
✓ Parsed: vendor-agreement.pdf
Pages: 47
Sections: 12
Tables: 8
Output: vendor-agreement.mdQuality Standards
- Preserve meaning — never omit content. If text is illegible, mark it:
[illegible] - Clean whitespace — no excessive blank lines, no trailing spaces
- Valid markdown — output must render correctly in any markdown viewer
- Consistent heading levels — no jumps from
##to#### - Table accuracy — verify column alignment; prefer simple tables over complex merged-cell attempts
- UTF-8 — handle special characters, accented text, and symbols correctly
Batch Mode
When given multiple files or a directory:
- Process each file independently
- Report progress:
Processing 3/15: contract-2024.pdf... - Write a summary at the end with all files and their stats
- If any files fail, report errors but continue processing the rest
Error Handling
- If a file doesn't exist, report it and continue
- If a PDF is password-protected, report it and skip
- If OCR produces very low-confidence output, warn the user
- If the output file already exists, ask before overwriting (unless
--forceis specified)
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.

