epub-chapter-extractor

Extract all chapters from an EPUB file into separate markdown files. Use when the user wants to split an EPUB into individual chapter files, extract EPUB chapters, or convert an ebook to separate markdown documents.

⭐43stars🔀13forks📁View on GitHub🕐Updated Dec 22, 2025⬇️1downloads

When & Why to Use This Skill

The EPUB Chapter Extractor is a specialized utility designed to automate the process of deconstructing EPUB ebooks into individual, well-formatted Markdown files. It solves the problem of manual copy-pasting by programmatically extracting each chapter, preserving text structure, and applying sequential numbering for easy organization. This skill is essential for users looking to bridge the gap between ebook formats and text-based productivity workflows.

Use Cases

  • Personal Knowledge Management: Extracting specific book chapters to import into Markdown-based tools like Obsidian, Notion, or Logseq for structured note-taking.
  • Content Repurposing: Converting ebook segments into editable Markdown drafts for blog posts, newsletters, or educational materials.
  • AI & LLM Data Preparation: Segmenting large books into clean, individual text files to be used as context for RAG (Retrieval-Augmented Generation) or for training custom language models.
  • Ebook Editing and Revision: Breaking down a monolithic EPUB file into manageable chapters to facilitate easier editing in professional text editors.
nameepub-chapter-extractor
descriptionExtract all chapters from an EPUB file into separate markdown files. Use when the user wants to split an EPUB into individual chapter files, extract EPUB chapters, or convert an ebook to separate markdown documents.

EPUB Chapter Extractor

Extract each chapter from an EPUB file into its own markdown file.

Instructions

When the user wants to extract chapters from an EPUB, run the extraction script with uv:

cd ~/.claude/skills/epub-chapter-extractor && uv run --with ebooklib --with beautifulsoup4 --with html2text --with lxml python extract_chapters.py "/path/to/book.epub" [output_dir]

If output_dir is omitted, creates a folder named after the EPUB in the same directory.

Example

User: "Extract chapters from /path/to/mybook.epub"

cd ~/.claude/skills/epub-chapter-extractor && uv run --with ebooklib --with beautifulsoup4 --with html2text --with lxml python extract_chapters.py "/path/to/mybook.epub"

Output files will be at /path/to/mybook/:

  • 01_introduction.md
  • 02_chapter_one.md
  • etc.

After extraction, open the output folder:

open /path/to/mybook

Output Format

Each chapter file contains:

# Chapter Title

[Chapter content in markdown format]

Files are numbered for proper sorting: 01_, 02_, etc.