From translate-pdf
Translate PDF documents between any language pair while preserving layout, images, and formatting as much as possible. Use this skill when the user asks to translate a .pdf file, convert a PDF to another language, or localize PDF content. Triggers on requests like 'translate this PDF to Japanese', 'localize this document into Spanish', or 'convert this PDF to French'.
How this skill is triggered — by the user, by Claude, or both
Slash command
/translate-pdf:translate-pdfThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Translate PDF documents while preserving layout and visual elements. Text is extracted as grouped spans, translated at the group level, then redacted and re-inserted.
Translate PDF documents while preserving layout and visual elements. Text is extracted as grouped spans, translated at the group level, then redacted and re-inserted.
All intermediate files are written to a temporary directory and cleaned up automatically.
pip install pymupdf "markitdown[pdf]"
python -m markitdown input.pdf
Identify the source language and total text volume.
If the user has not specified a target language, ask using AskUserQuestion:
ja)zh)es)import tempfile, os
tmpdir = tempfile.mkdtemp(prefix="translate_pdf_")
texts_json = os.path.join(tmpdir, "texts.json")
python scripts/extract_texts.py input.pdf $tmpdir/texts.json
Produces a JSON file with two arrays:
groups — Logical text lines, each with group_id, page, combined_text, bbox, font, size, color, span_countspans — Individual text spans, each linked to a group via group_idRead texts.json and add a "translated" field to each entry in the groups array.
Translation guidelines:
Handling multi-line blocks:
When consecutive groups share the same page and block_idx and form a single sentence or paragraph:
"translated" field"translated" to empty string ""For standalone groups (headings, labels), translate directly.
Large documents (>50 groups):
texts.jsonSmall documents (<=50 groups): Translate all groups at once.
python scripts/apply_translations.py input.pdf $tmpdir/texts.json output.pdf --lang <target>
The --lang flag selects the appropriate font: ja → CJK Japanese, zh → CJK Simplified Chinese, zh-tw → CJK Traditional Chinese, ko → CJK Korean, others → Helvetica.
Place the output file in the same directory as the input, with a language suffix (e.g., input_JA.pdf).
import shutil
shutil.rmtree(tmpdir)
python -m markitdown translated.pdf
Verify:
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub from2001/useful-skills