
Document Conversion
- 92 installs
- 325 repo stars
- Updated August 2, 2026
- athola/claude-night-market
document-conversion is an agent skill, also Idea (research) and Grow (content), that converts files and URLs to sanitized markdown via MCP markitdown with native fallbacks.
About
document-conversion (fallback-tiers module) is the operational core of athola’s Claude Night Market skill for turning office and web documents into sanitized markdown your agent can reason over. Solo builders use it whenever specs, papers, or articles live outside the repo as PDFs or HTML and you need reliable text without manually copy-pasting. The workflow is deliberately two-tier: try MCP markitdown with constructed URIs, and only if the server is missing or the file fails conversion, fall back to native agent tools—Read on PDFs in 20-page chunks or WebFetch for HTML—then run content sanitization on the result. That design fits indie workflows where MCP may be offline on a laptop but you still want one skill to gate quality. Expect degraded structure on fallback paths; plan chunking for long PDFs and accept that scanned pages may yield empty text until OCR exists elsewhere.
- Tier 1: MCP markitdown via construct URI then convert_to_markdown
- Tier 2 native fallbacks: PDF via Read with 20-page chunking; HTML via WebFetch
- Detects Tier 1 outage via tool-not-found, connection refused, or per-file conversion errors
- Applies leyline:content-sanitization to successful markdown output
- Documents limitations: tables plain text, equations lost on PDF fallback, nav noise on HTML
Document Conversion by the numbers
- 92 all-time installs (skills.sh)
- Ranked #334 of 688 Office & Documents skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/athola/claude-night-market --skill document-conversionAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 92 |
|---|---|
| repo stars | ★ 325 |
| Security audit | 2 / 3 scanners passed |
| Last updated | August 2, 2026 |
| Repository | athola/claude-night-market ↗ |
What it does
Convert PDFs, HTML, and other sources to clean markdown for agents using MCP markitdown first and native Read/WebFetch fallbacks.
Who is it for?
Best when you're ingesting contracts, research PDFs, or marketing HTML into agent context when markitdown MCP may or may not be running.
Skip if: Pixel-perfect layout reproduction, reliable equation extraction from PDFs without Tier 1, or bulk OCR of scanned archives.
When should I use this skill?
You need markdown from office or web documents and want MCP markitdown first with Read/WebFetch fallbacks plus content sanitization.
What you get
You get markdown text through Tier 1 MCP or Tier 2 Read/WebFetch, passed through content sanitization, ready for summarization or implementation planning.
- Sanitized markdown representation of the source document
- Implicit tier used (MCP vs native fallback) for debugging quality issues
By the numbers
- 2-tier fallback pipeline (MCP markitdown then native tools)
- PDF chunking in 20-page increments
- estimated_tokens: 400 on fallback-tiers module frontmatter
Files
Document Conversion
Convert documents and URLs to markdown using a three-tier fallback strategy. This skill is infrastructure: consumer skills reference it via dependency rather than reimplementing conversion logic.
When To Use
- Converting PDF, DOCX, PPTX, XLSX, HTML, or images to
markdown for downstream processing
- Any skill that ingests external documents
- File format is not plain text or markdown
When NOT To Use
- Content is already markdown or plain text
- You only need to read a small text file (use Read directly)
Format Detection
Identify the document type from the URI before converting.
| Extension | Format | Tier 1 | Tier 2 |
|---|---|---|---|
.pdf | Yes | Read tool (pages) | |
.docx, .doc | Word | Yes | None |
.pptx, .ppt | PowerPoint | Yes | None |
.xlsx, .xls | Excel | Yes | None |
.html, .htm | HTML | Yes | WebFetch |
.csv | CSV | Yes | Read tool |
.json | JSON | Yes | Read tool |
.xml | XML | Yes | Read tool |
.png, .jpg, .jpeg, .gif, .webp | Image | Yes | Read tool (visual) |
.mp3, .wav, .m4a | Audio | Yes | None |
.zip | Archive | Yes | None |
.epub | E-book | Yes | None |
See modules/format-matrix.md for quality comparison across tiers.
Conversion Protocol
To convert a document to markdown:
1. DETECT -- Identify format from URI extension or context
2. TRY -- Tier 1: MCP markitdown (best quality)
3. DEGRADE -- Tier 2: native Claude Code tools (if Tier 1 fails)
4. INFORM -- Tier 3: tell user what's needed (if no coverage)
5. SANITIZE -- Apply content-sanitization (external content)Tier 1: MCP markitdown
Call the convert_to_markdown MCP tool with the document URI. See modules/uri-construction.md for URI formatting rules.
If the tool is available and succeeds, you have the best possible conversion. Proceed to the SANITIZE step.
If the tool is not available (not found, connection error) or fails, proceed to Tier 2.
Tier 2: Native Claude Code Tools
Use built-in tools as format-specific fallbacks. See modules/fallback-tiers.md for per-format instructions.
Supported in Tier 2: PDF, HTML, images, CSV, JSON, XML. Not supported in Tier 2: DOCX, PPTX, XLSX, audio, archives, e-books. Proceed to Tier 3 for these.
Tier 3: User Notification
When neither Tier 1 nor Tier 2 can handle the format:
I cannot convert this {format} file without the markitdown
MCP server. To enable conversion, add this to .mcp.json:>
```json
{
"mcpServers": {
"markitdown": {
"type": "stdio",
"command": "uvx",
"args": ["markitdown-mcp"]
}
}
}
```
>
Alternatively, convert the file to PDF or HTML first,
which I can read with built-in tools.
SANITIZE Step
All converted content is external. Apply the leyline:content-sanitization checklist:
- Size check (truncate sections over 2000 words)
- Strip system/instruction tags
- Wrap in external content boundary markers
Integration
Consumer skills depend on this skill and reference the protocol by name:
dependencies:
- leyline:document-conversionThen in their workflow: "Convert the document using the leyline:document-conversion protocol."
Detailed References
- Format support details:
modules/format-matrix.md - Per-format fallback instructions:
modules/fallback-tiers.md - URI construction rules:
modules/uri-construction.md
Fallback Tier Instructions
Tier 1: MCP markitdown
For all supported formats, the approach is the same:
1. Construct the URI (see modules/uri-construction.md) 2. Call convert_to_markdown with the URI 3. If the call succeeds, the result is markdown text 4. Apply leyline:content-sanitization to the output
Detecting Tier 1 availability: If the MCP tool call returns an error like "tool not found", "server not running", or "connection refused", Tier 1 is unavailable. Proceed to Tier 2.
If the tool exists but returns a conversion error for the specific file (corrupt file, unsupported variant), also proceed to Tier 2.
Tier 2: Native Tool Fallbacks
Use the Read tool with the pages parameter:
Read(file_path="/path/to/file.pdf", pages="1-20")For remote PDFs, first fetch with WebFetch to get a local path or use the URL directly with Read if supported.
Chunking strategy for large PDFs:
- Pages 1-20: first chunk
- Pages 21-40: second chunk
- Continue in 20-page increments
- Concatenate results
Limitations: Tables render as plain text. Equations are lost. Scanned pages produce no text. Images are not extracted.
HTML
Use WebFetch with the URL:
WebFetch(url="https://example.com/article.html")Limitations: Includes navigation, headers, footers, and boilerplate. Manually identify the main content section and discard the rest.
Images (PNG, JPG, GIF, WebP)
Use the Read tool to display the image visually:
Read(file_path="/path/to/image.png")Claude sees the image and can describe its contents.
Limitations: No OCR text extraction. No EXIF metadata. Good for visual inspection, not for extracting text from screenshots or scanned documents.
CSV
Use the Read tool to get raw comma-separated text:
Read(file_path="/path/to/data.csv")Then format the first N rows as a markdown table manually if needed for presentation.
JSON and XML
Use the Read tool directly. The structured format is readable as-is. Summarize or extract relevant sections rather than converting the entire file.
Tier 3: User Notification
For formats with no Tier 2 coverage, inform the user.
Formats requiring Tier 3: DOCX, PPTX, XLSX/XLS, MSG, audio (MP3/WAV/M4A), ZIP archives, EPUB.
Notification template:
This {format} file requires the markitdown MCP server
for conversion. Without it, I cannot extract the content.
>
Option A: Install markitdown-mcp by adding to
.mcp.json:```json
{"mcpServers": {"markitdown": {"type": "stdio",
"command": "uvx", "args": ["markitdown-mcp"]}}}
```
>
Option B: Convert the file to PDF or HTML manually,
then I can process it with built-in tools.
Do NOT guess or fabricate content from a document you cannot read. Clearly state the limitation.
Format Support Matrix
Quality ratings: High (preserves structure, tables, images), Medium (readable but loses some formatting), Low (raw text or visual only), None (not supported at this tier).
Office Documents
| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|---|---|---|---|
| High: structure, tables, OCR | Medium: Read tool, 20pp chunks | Native loses table formatting | |
| DOCX | High: headings, lists, tables | None | Tier 3 only without markitdown |
| PPTX | High: slide-by-slide, speaker notes | None | Tier 3 only |
| XLSX/XLS | High: tables to markdown | None | Tier 3 only |
| MSG | High: email headers and body | None | Outlook format, Tier 3 only |
Web and Data Formats
| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|---|---|---|---|
| HTML | High: clean extraction | Medium: WebFetch | WebFetch includes boilerplate |
| CSV | High: formatted tables | Medium: Read (raw) | Native readable but unformatted |
| JSON | High: structured output | Medium: Read (raw) | Native usually sufficient |
| XML | High: structured output | Medium: Read (raw) | Native usually sufficient |
Media Formats
| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|---|---|---|---|
| Images | High: OCR, EXIF, and description | Low: Read (visual) | Native shows image, no text |
| Audio | Medium: speech transcription | None | Tier 3 only |
Archive and Other
| Format | Tier 1 (markitdown) | Tier 2 (native) | Notes |
|---|---|---|---|
| ZIP | High: extracts and converts contents | None | Tier 3 only |
| EPUB | High: e-book to markdown | None | Tier 3 only |
Decision Guide
When Tier 2 is good enough (skip markitdown if unavailable):
- PDF with mostly text (no complex tables or equations)
- HTML articles (WebFetch handles well)
- CSV/JSON/XML (Read tool is fine for structured data)
- Images where visual inspection suffices
When Tier 1 matters most (strongly prefer markitdown):
- PDFs with tables, equations, or scanned content
- Office documents (DOCX, PPTX, XLSX): no Tier 2 at all
- Images requiring text extraction (OCR)
- Audio files requiring transcription
URI Construction
The convert_to_markdown MCP tool accepts a single uri parameter. The URI scheme determines how the document is located.
Supported Schemes
file://: Local Files
Prefix the absolute path with file://:
file:///home/user/documents/report.docx
file:///tmp/downloaded.pdfPath resolution rules:
- Always use absolute paths (start with
/) - Expand
~to the full home directory path first - Resolve relative paths against the working directory
before prefixing
- Spaces in paths: encode as
%20or quote the URI
Example resolution:
Input: ~/docs/report.docx
Step 1: /home/user/docs/report.docx
Step 2: file:///home/user/docs/report.docxhttp:// and https://: Remote URLs
Use the URL as-is:
https://arxiv.org/pdf/2301.00001v1
https://example.com/slides.pptxNo transformation needed. The MCP server fetches the remote resource.
data:: Inline Content
For content already in memory (rare):
data:application/pdf;base64,JVBERi0xLjQK...Format: data:<mediatype>;base64,<base64-encoded-data>
This is mainly useful for programmatic integrations, not typical skill workflows.
Common Patterns
| Source | URI Construction |
|---|---|
| User says "convert ~/file.pdf" | Resolve ~, prefix file:// |
| URL from WebSearch result | Use URL directly |
| arXiv PDF link | Use https://arxiv.org/pdf/... directly |
| File path from Glob/Read | Prefix with file:// |
| Google Drive link | Use the URL (may need public sharing) |
Error Cases
- File not found: Verify the path exists with Read
before constructing the URI
- Permission denied: Check file permissions
- URL unreachable: Try WebFetch first to confirm
accessibility
- Unsupported scheme: Only
file://,http://,
https://, and data: are supported
Related skills
How it compares
Structured fallback workflow across MCP and native tools—not a single-purpose markitdown-only snippet.
FAQ
Who is document-conversion for?
Developers and teams who need agents to ingest PDFs and HTML into markdown for planning, coding, or content reuse.
When should I use document-conversion?
Use it in Build (docs) for specs; Idea (research) when pulling competitor PDFs; Grow (content) when repurposing web articles—always when you need sanitized markdown, not raw binary.
Is document-conversion safe to install?
Tier 2 uses Read and WebFetch on paths and URLs you supply; review fetched domains and local files, and check the Security Audits panel on this Prism page before enabling network tools.