document-conversion

Document-to-markdown conversion with tiered fallback: MCP markitdown, native tools, or user notice

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "document-conversion" with this command: npx skills add athola/nm-leyline-document-conversion

Night Market Skill — ported from claude-night-market/leyline. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

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.

ExtensionFormatTier 1Tier 2
.pdfPDFYesRead tool (pages)
.docx, .docWordYesNone
.pptx, .pptPowerPointYesNone
.xlsx, .xlsExcelYesNone
.html, .htmHTMLYesWebFetch
.csvCSVYesRead tool
.jsonJSONYesRead tool
.xmlXMLYesRead tool
.png, .jpg, .jpeg, .gif, .webpImageYesRead tool (visual)
.mp3, .wav, .m4aAudioYesNone
.zipArchiveYesNone
.epubE-bookYesNone

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:

{
  "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-conversion

Then 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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Huo15 Openclaw Enhance

火一五·克劳德·龙虾增强插件 v5.7.8 — 全面适配 openclaw 2026.4.24:peerDep ^4.24 + build/compat 同步到 4.24 + 14 处 api.on 全部去掉 as any 改成 typed hook(hookName 联合类型 + handler 自动推断 Pl...

Registry SourceRecently Updated
General

Content Trend Analyzer

Aggregates and analyzes content trends across platforms to identify hot topics, user intent, content gaps, and generates data-driven article outlines.

Registry SourceRecently Updated
General

Prompt Debugger

Debug prompts that produce unexpected AI outputs — diagnose failure modes, identify ambiguity and conflicting instructions, test variations, compare model re...

Registry SourceRecently Updated
General

Indie Maker News

独行者 Daily - 变现雷达。读对一条新闻,少走一年弯路。每天5分钟,给创业者装上商业雷达。聚焦一人公司、副业、创业变现资讯,智能分类,行动导向。用户下载即能用,无需本地部署!

Registry SourceRecently Updated