dtyq/magic/document-converter
Claude Code and agent skill by dtyq/magic
- community
Checking that the SKILL.md file is still in the repository.
Use for reading, analyzing, summarizing, and converting complex documents into Markdown artifacts or other supported document formats.
Install
npx vskill@latest install dtyq/magic/document-converterSKILL.md
The same SKILL.md was published earlier as dtyq/magic/document-converter.
Document Converter Workflow
Use this workflow when the user asks to read, summarize, analyze, or convert a large or complex document.
Do not start by converting the entire file into one large Markdown document. First build a lightweight understanding of the document, sample a few representative units, then decide how to read the rest.
What Conversion Means
This skill uses "conversion" in two document-specific ways:
- Semantic conversion: turn complex documents into model-readable Markdown artifacts, such as
document.md,chunks/,document.index.json,document.outline.md,document.reading_state.json, visual-understanding records, and summaries. Use this for normal reading, analysis, summarization, and Markdown export. - Format conversion: create a new file in another supported document format. Use this only when the user explicitly asks for a converted file or when a format mismatch must be repaired before extraction.
Current supported raw format conversions:
- PDF ->
png,jpg,jpeg - Office-like documents ->
pdf,docx,pptx,xlsx
Office-like documents include Word, PowerPoint, spreadsheets, WPS Office, OpenDocument, RTF, templates, macro-enabled files, and slide-show files when the current runtime converter can handle them.
Other document types should usually be read or exported through semantic conversion, especially export_document_markdown, rather than forced through convert_document_format.
Default Approach
- Inspect the document first: identify its type, size, structure, outline, and representative samples.
- If the file is small, export it directly as one readable Markdown file.
- If the file is large, sample a few representative units before choosing a full reading strategy.
- Plan the next read from the sample result and the user's goal.
- After inspection and sampling, use the returned
strategy_contextand the user's goal to choose an asset strategy. - If the user did not specify an asset preference and the recommendation materially changes the output, call
ask_useronce before extraction. Put the recommended strategy first and omittimeout; the user may need time to decide. Usetimeout=60only when the choice is simple, has a safe default, and does not materially affect the result. - Extract or understand only the selected ranges into reusable Markdown artifacts.
- Read
document.reading_state.jsonbetween large-document steps to avoid rereading the same content. - For summaries, summarize smaller chunks first, then combine them into section-level and document-level summaries.
- Only perform format conversion when the user explicitly asks for a converted file or when conversion is necessary for extraction.
Large Document Rules
- Do not read or convert a large document all at once unless the user explicitly requires a full export.
- Always sample first for large files, then choose the next batch from the sample result.
- Use the outline, samples, and
document.reading_state.jsonto decide what to read next. - Prefer text extraction for ordinary document body content.
- Do not treat the presence of images as a reason to extract every embedded image object.
- Asset strategies are
text_only,page_visual,reusable_assets,full_fidelity, andauto. - Choose
text_onlyfor text reading,page_visualfor slides/layout/charts,reusable_assetsfor standalone pictures or logos, andfull_fidelityonly when the user explicitly needs every source asset. - When
strategy_context.requires_user_confirmationis true and the user has not already specified the strategy, use oneask_userselect question. The recommended strategy must be the first option and the default. - Do not use one strategy blindly for the whole file. If the sample shows extractable text, read text ranges. If the sample is image-dominant or scanned, understand document images in batches.
- Do not call the generic visual understanding tool directly for document parsing. Use
understand_document_imagesso results are saved and written back to chunks. - When image understanding is used, process at most 10 images per call. Successful results are written back to the related chunk, and
visual-results/is preserved as the per-image recognition record. - Before starting a large visual-understanding workload, call
ask_userto ask whether the user wants to continue because it may take a long time. This applies when many batches are needed, such as scanned PDFs or slide decks with many image-only pages. - Do not call
ask_userfor small visual reads, such as a document with only a few pages or a single batch of up to 10 images that is clearly needed for the user's request. - For spreadsheets, inspect sheets, headers, sample rows, and table size before extracting data.
- For slide decks, treat each slide as a natural unit.
- For Word-like documents, follow the heading structure when available.
- For notebooks, preserve cell order and cell type.
Small Document Rules
- Small files can use
export_document_markdowndirectly. The tool chooses the output artifact mode automatically. - For small files, prefer the simple output structure:
document.md, plusassets/when needed. If visual understanding runs, keepvisual-results/as the recognition record. - Do not create samples, chunks, indexes, or reading state just to read a small file.
- A PDF, Word file, PowerPoint file, or image set with 10 or fewer pages/slides/images is usually small.
- If a PDF, Word file, PowerPoint file, or image set has more than 10 pages/slides/images, use the large-document workflow instead of expecting a flat one-file result.
- Text, Markdown, and HTML files are small when they fit comfortably within one normal chunk.
- Small scanned files can be extracted and visually understood directly when needed; do not call
ask_userunless many visual-understanding batches are required. - Large-document exports automatically use progressive artifacts.
When The User Wants A Summary
For a large document summary, do not send all extracted text into the model at once.
Use this sequence:
- Inspect the structure.
- Sample representative pages, slides, sheets, or sections.
- Plan the next read from the sample and the user's goal.
- Extract relevant chunks, or understand image pages in batches when the document is scanned.
- Summarize each chunk.
- Merge chunk summaries into section summaries.
- Merge section summaries into a final answer.
Code Mode Use
Use Code Mode as the execution path for this workflow. Keep the user-facing response focused on what was inspected, what was extracted, where the readable result is, and what can be done next. Do not expose internal class names, package paths, implementation details, or raw metadata unless the user asks for debugging details.
All document-converter SDK tool calls must be executed through the run_sdk_snippet tool by passing code in its python_code parameter.
Inside that python_code, use from sdk.tool import tool and call document-converter tools with tool.call(...). Always check result.ok before using the result.
Do not use run_python_snippet for document-converter tool calls. run_python_snippet is only a generic Python executor; it is not the intended execution path for Code Mode tools that require sdk.tool.call(...).
When a code example below starts with run_sdk_snippet(...), call that tool directly. Do not paste that wrapper into run_python_snippet.
Correct execution shape:
All path parameters passed to these tools must be absolute paths.
For the same source document, reuse one stable output_dir across all document-converter tool calls. Keep document.index.json, document.outline.md, document.reading_state.json, samples/, chunks/, visual-results/, summaries, converted files, and combined Markdown exports under that same directory unless the user explicitly asks for a different location.
Asset path contract:
document.index.json.assets[].pathis canonical relative tooutput_dir, such asassets/page_001.png.- Images inside
chunks/*.mdare relative to the chunk file, such as../assets/page_001.png. - Images inside root-level
document.mdare relative todocument.md, such asassets/page_001.png. - When opening an image for visual understanding, resolve the canonical asset path from
output_dir; do not infer the filesystem path from the Markdown link text.
When the user does not provide an output directory, create one under the current workspace output area and derive the directory name from the current full file name, including the extension. For example, use sample_pdf for sample.pdf, sample_docx for sample.docx, and README_md for README.md. Do not use only the file stem in batch jobs, because files such as sample.pdf, sample.docx, and sample.png would otherwise overwrite or mix artifacts in the same sample/ directory.
Before writing to an existing output_dir, make sure it belongs to the same source file. If unsure, choose a fresh unique directory instead of reusing a possibly polluted directory.
Reuse Existing Parsed Artifacts
When starting a new topic or when the current context does not show whether a document has already been parsed, do not immediately re-run extraction. If the source file still exists, first look for an existing output directory that matches the current full file name, such as document-converter-output/sample_pdf/ for sample.pdf.
Reuse existing artifacts when all of these are true:
document.index.jsonexists.document.outline.mdexists.chunks/exists and contains Markdown chunk files.- The
source_pathindocument.index.jsonpoints to the same source document. - The source document has not changed since the index was created, when timestamps or stored metadata are available.
If valid parsed artifacts already exist, read document.reading_state.json when present, then read document.outline.md and document.index.json. Read only the needed chunk files or call summarize_document on that output_dir. Do not re-run export_document_markdown or extract_document_content just to rediscover content that is already available.
If only samples/ and document.reading_state.json exist, treat the document as sampled but not fully extracted. Use plan_document_reading to choose the next bounded extraction or image-understanding step.
Re-run extraction only when artifacts are missing, incomplete, point to a different source file, appear stale, do not cover the needed range, or the user explicitly asks to regenerate the Markdown.
When the user chooses a different explicit asset_strategy for a source that already has indexed artifacts, keep the original output_dir as the base name. The tool creates or reuses a sibling strategy version such as report_pdf__page_visual/; read the returned output_dir instead of assuming the base directory was overwritten.
Batch Conversion Rules
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingbackend/super-magic/agents/skills/document-converter/SKILL.md
Popularity
- Repository stars
- 5,063
- Repository forks
- 563
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dtyq/magic/document-converter)