.agents/skills/pdf-to-markdown/SKILL.md
Convert PDF documents to clean structured Markdown for LLM context. Supports two modes: fast (PyMuPDF) and accurate (IBM Docling TableFormer AI). Features aggressive persistent caching, image extraction with metadata, table detection, and batch processing. Use when asked to convert PDFs, extract PDF content, parse documents, or prepare PDF data for AI/LLM consumption.
npx skillsauth add x402agent/solana-clawd pdf-to-markdownInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Extract entire PDF content as clean, structured Markdown optimized for LLM context windows.
# Install dependencies (fast mode)
uv pip install pymupdf pymupdf4llm
# Convert a PDF
python pdf_to_md.py document.pdf
# Accurate tables (IBM Docling AI)
uv pip install docling docling-core
python pdf_to_md.py document.pdf --docling
Uses PyMuPDF with text-based table detection. Good for most documents.
python pdf_to_md.py report.pdf
# Output: report.md (with images/ directory if PDF has images)
Uses IBM's TableFormer AI model for ~93.6% table extraction accuracy.
python pdf_to_md.py report.pdf --docling
# First run downloads AI models (~2-3 min one-time setup)
Extractions are cached in ~/.cache/pdf-to-markdown/. Cache is keyed by file content hash + extraction mode — the same PDF extracts once and reuses forever.
# View cache stats
python pdf_to_md.py --cache-stats
# Clear cache for one PDF
python pdf_to_md.py document.pdf --clear-cache
# Clear entire cache
python pdf_to_md.py --clear-all-cache
Cache invalidates automatically when:
---
source: document.pdf
total_pages: 42
extracted_at: 2026-03-23T22:00:00
images_dir: images
---
# Document Title
Content here...
| Column A | Column B |
|----------|----------|
| data | data |

**[Image: figure_0001.png (1920x1080, 245.3KB)]**
---
## Extracted Images
| # | File | Dimensions | Size |
|---|------|------------|------|
| 1 | figure_0001.png | 1920x1080 | 245.3KB |
python pdf_to_md.py input.pdf # → input.md
python pdf_to_md.py input.pdf output.md # custom output path
python pdf_to_md.py input.pdf --docling # accurate tables
python pdf_to_md.py input.pdf --no-progress # suppress progress
from extractor import extract_pdf_fast, extract_pdf_docling, get_page_count
# Fast extraction
pages = get_page_count("report.pdf")
markdown = extract_pdf_fast("report.pdf", image_dir="./images")
# Accurate extraction with images
markdown, image_paths = extract_pdf_docling(
"report.pdf",
output_dir="./images",
images_scale=4.0,
show_progress=True,
)
from pdf_to_md import CacheManager, ExtractionConfig, ImageManager
cache = CacheManager()
config = ExtractionConfig(pdf_path="report.pdf", docling=False)
valid, cache_key = cache.is_valid(config)
if valid:
result = cache.load(cache_key)
markdown = result.markdown
else:
# Extract and cache
markdown = extract_pdf_fast("report.pdf")
cache.save(cache_key, ExtractionResult(
markdown=markdown, image_dir=None, total_pages=pages
), config)
# Convert all PDFs in a directory
for f in *.pdf; do python pdf_to_md.py "$f"; done
# Parallel with xargs
ls *.pdf | xargs -P4 -I{} python pdf_to_md.py {}
pdf_to_md.py — CLI entry point, cache orchestration, output formatting
extractor.py — Extraction backends (fast + docling)
~/.cache/pdf-to-markdown/
└── {hash16}/
├── metadata.json — source info, mtime, version
├── full_output.md — cached markdown
└── images/ — cached extracted images
| Class | Purpose |
|-------|---------|
| ExtractionConfig | PDF path, mode (fast/docling), image scale |
| ExtractionResult | Markdown output, image dir, page count, cache flag |
| CacheManager | Content-hash keying, atomic writes, validation |
| ImageManager | Temp dir tracking, image metadata, path rewriting |
SHA256(file_size | SHA256(first_64KB + last_64KB) | mode)[:16]
This means:
| Package | Mode | Purpose |
|---------|------|---------|
| pymupdf | Both | PDF parsing, image extraction |
| pymupdf4llm | Fast | Markdown conversion with table detection |
| docling | Accurate | IBM document AI pipeline |
| docling-core | Accurate | Document model and export |
# Fast mode only
uv pip install pymupdf pymupdf4llm
# Both modes
uv pip install pymupdf pymupdf4llm docling docling-core
Images are extracted to an images/ directory next to the output markdown file. References use relative paths for portability.
--docling for financial reports, academic papers, or any document with complex table layouts--cache-stats<!-- PAGE_BREAK --> sentinels (not -----) to avoid false splits3.3.0) is tracked in cache to auto-invalidate on upgradesdevelopment
Formally verify programs by writing Lean 4 proofs. Trigger this skill whenever the user wants to formally verify code, generate Lean 4 proofs, prove properties about algorithms or smart contracts, verify invariants, convert program logic into formal specifications, or anything involving Lean 4 and formal verification. Also trigger when the user mentions "qedgen", "lean proof", "formal proof", "verify my code", "prove correctness", "formal verification", or wants mathematical guarantees about their implementation.
data-ai
Orchestrate multi-bot trading swarms on Pump.fun with persona-driven agents
tools
End-to-end Solana development playbook (Jan 2026). Prefer Solana Foundation framework-kit (@solana/client + @solana/react-hooks) for React/Next.js UI. Prefer @solana/kit for all new client/RPC/transaction code. When legacy dependencies require web3.js, isolate it behind @solana/web3-compat (or @solana/web3.js as a true legacy fallback). Covers wallet-standard-first connection (incl. ConnectorKit), Anchor/Pinocchio programs, Codama-based client generation, LiteSVM/Mollusk/Surfpool testing, and security checklists.
tools
Buy and sell tokens on Pump.fun bonding curves and AMM pools