Agent skill
pdf-to-ebook
Convert a PDF file to ebook formats (epub, mobi, azw3/Kindle) using Calibre. Use when the user wants to convert a PDF to an ebook format.
Install this agent skill to your Project
npx add-skill https://github.com/cgbarlow/skills/tree/main/.claude/skills/pdf-to-ebook
SKILL.md
PDF to Ebook Converter
Convert a PDF to one or more ebook formats using Calibre's ebook-convert.
Arguments
$ARGUMENTS — space-separated: first arg is the PDF path, optional second arg is the format(s).
- Format options:
epub,mobi,azw3,all - If no format is provided, ask the user which formats they want before proceeding.
Workflow
Step 1 — Parse arguments
Extract 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.
Step 2 — Validate inputs
- Confirm the PDF file exists. If not, report the error and stop.
- Check Calibre is installed:
bashIf missing, tell the user to install it:
which ebook-convert- Linux:
sudo apt install calibre - macOS:
brew install calibre - Then stop.
- Linux:
Step 3 — Check for scanned/image-only PDF (optional but recommended)
Run 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.
Step 4 — Convert
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:
- epub: drop
--output-profile; use--output-profile tabletinstead - mobi: use
--output-profile kindle - azw3: use
--output-profile kindle_oasis(best Kindle compatibility)
Run conversions sequentially. Report each one as it completes.
Step 5 — Report results
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.
Example invocations
/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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
flow-coach
Interactive claude-flow orchestration coach that guides users through swarm topology selection, agent deployment, memory configuration, and SPARC workflows. Use when learning claude-flow, choosing between swarm vs hive-mind, selecting agents, or optimizing multi-agent coordination. NEVER auto-executes - always displays recommendations and asks first.
agentic-coach
Interactive prompt engineering coach that elevates vague prompts through Socratic dialogue, multiple transformation styles, and guided learning. Use when improving prompts, learning agentic engineering, or wanting coached guidance rather than automated transformation. NEVER auto-executes - always displays and asks first.
timesheet
Interactive timesheet entry — collects work description, date, start/end times via prompts, calculates hours, appends to .campaign/timesheet.md
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
handoff
Compact the current conversation into a handoff document for another agent to pick up.
Didn't find tool you were looking for?