Extract and organize chapters from an EPUB file into markdown for analysis. Use when the user wants to analyze a book, dissect an EPUB, import a book, or mentions EPUB extraction, book import, or reverse-engineering a book.
Extract raw chapter text from an EPUB file and scaffold an analysis directory, preparing the book for dissection through the analysis pipeline.
pip install ebooklib beautifulsoup4 markdownify
python .cursor/skills/epub-ingestion/scripts/extract_epub.py <epub_path> analysis/<book-title>/
After ingestion, create this structure under analysis/:
analysis/<book-title>/
metadata.md (generated by script)
chapter-manifest.md (generated by script)
raw-chapters/ (generated by script)
ch01-<title>.md
ch02-<title>.md
...
extracted/
world-bible.md (filled by world-extraction)
style-guide.md (filled by style-extraction)
plot-outline.md (filled by plot-extraction)
characters/ (filled by character-extraction)
chapters/ (filled by scene-extraction + chapter-analysis)
ch01/
scene-map.md
analysis.md
ch02/
scene-map.md
analysis.md
...
After running the script, create the empty extracted/ subdirectories so downstream skills have their output locations ready.
After extraction, verify:
metadata.md exists and contains title/authorchapter-manifest.md lists all extracted chapters with word countsraw-chapters/ contains one .md file per chapterextracted/ directory structure is scaffoldedOnce ingestion is complete, proceed to the analysis pipeline in this order: