From math-coach
Converts PDF files to EPUB, MOBI, or AZW3 ebook formats using Calibre's ebook-convert via Bash. Validates files, detects scanned PDFs for optional OCR with ocrmypdf, and lists outputs. Use for PDF-to-ebook tasks.
npx claudepluginhub cgbarlow/skills --plugin math-coachThis skill is limited to using the following tools:
Convert a PDF to one or more ebook formats using Calibre's `ebook-convert`.
Translates entire books (PDF/DOCX/EPUB) to any language using Claude Code parallel subagents, resumable chunked Markdown pipeline, Calibre conversion, and Pandoc merging.
Converts Office docs (DOCX/PPTX/XLSX) to PDF/HTML, PDFs to images/images to PDF, performs PDF merge/split/rotate/encrypt/decrypt, and OCR on scans using local tools: LibreOffice, Ghostscript, pdftk, Tesseract, ImageMagick.
Generates styled PDF books from directories of ordered markdown chapters using pandoc and weasyprint, with TOC, page numbers, and resolved inter-chapter links.
Share bugs, ideas, or general feedback.
Convert a PDF to one or more ebook formats using Calibre's ebook-convert.
$ARGUMENTS — space-separated: first arg is the PDF path, optional second arg is the format(s).
epub, mobi, azw3, allExtract the PDF path from $ARGUMENTS. If a format argument is also present, use it. If not, ask:
Which formats would you like to export?
- epub
- mobi
- azw3 (Kindle, recommended over mobi)
- all (epub + mobi + azw3)
Wait for the user's response before continuing.
which ebook-convert
If missing, tell the user to install it:
sudo apt install calibrebrew install calibreRun a quick text extraction check:
ebook-convert "<input.pdf>" /tmp/pdf_text_check.txt 2>/dev/null && wc -c /tmp/pdf_text_check.txt
If the output is fewer than 500 characters, the PDF is likely image-based (scanned). Warn the user:
This PDF appears to be scanned or image-based and may convert poorly. Would you like to run OCR first using
ocrmypdf? (Requires:pip install ocrmypdfandtesseract)
If they say yes:
ocrmypdf "<input.pdf>" "<input_ocr.pdf>"
Use the OCR'd file for all subsequent conversions.
Derive the output base name from the input file (strip .pdf extension).
For each requested format, run:
ebook-convert "<input.pdf>" "<basename>.<format>" \
--output-profile kindle_oasis \
--enable-heuristics
Format-specific notes:
--output-profile; use --output-profile tablet instead--output-profile kindle--output-profile kindle_oasis (best Kindle compatibility)Run conversions sequentially. Report each one as it completes.
List each output file with its path and size:
ls -lh "<basename>.epub" "<basename>.mobi" "<basename>.azw3" 2>/dev/null
If any conversion failed, show the error output from ebook-convert.
/pdf-to-ebook book.pdf
/pdf-to-ebook book.pdf epub
/pdf-to-ebook book.pdf all
/pdf-to-ebook /path/to/document.pdf azw3