Loading...
Loading...
Convert EPUB books to high-quality formatted Markdown using pandoc and AI-assisted formatting. Use when the user provides an EPUB file path and wants to convert it to professionally formatted Markdown, similar to the Clean Code Collection formatting. This skill handles the complete workflow from EPUB extraction through AI-driven content formatting, including fixing PDF conversion artifacts, joining split paragraphs, correcting code blocks, standardizing headers, and creating proper Table of Contents.
npx skill4agent add bmad-labs/skills book-converter/Users/username/Downloads/Book.Name.2024.epubpython3 scripts/convert_book.py "/path/to/book.epub"python3 scripts/convert_book.py "/path/to/book.epub"books/book-name/books/book-name/raw/books/book-name/chapters/books/book-name/images/books/book-name/raw/book-parsed.mdpython3 books/book-name/analyze_structure.py books/book-nameSTRUCTURE_ANALYSIS.mdTask(
subagent_type="general",
description="Create chapter map and formatting plan",
prompt="""Create CHAPTER_MAP.md and FORMATTING_PLAN.md:
1. Read books/book-name/STRUCTURE_ANALYSIS.md (concise report with headers and issues)
2. Read books/book-name/references/chapter-map-template.md for format
3. Read books/book-name/references/formatting-plan-template.md for format
4. Create books/book-name/CHAPTER_MAP.md:
- Use suggested chapter boundaries from analysis
- Verify line ranges make sense
- Create proper slugged filenames
5. Create books/book-name/FORMATTING_PLAN.md:
- Document issues found in analysis
- Add severity and priority
- Note book-specific patterns
6. Update books/book-name/progress.md to mark Phase 2 complete
Return: Summary of chapters found and major issues identified."""
)CHAPTER_MAP.mdFORMATTING_PLAN.mdprogress.md# Example for Chapter 1
Task(
subagent_type="general",
description="Format Chapter 1",
prompt="""Format Chapter 1 following the chapter formatting workflow.
**Critical Instructions:**
1. Read and follow ALL steps in books/book-name/references/chapter-workflow.md
2. Apply formatting rules from books/book-name/references/formatting-standards.md
3. Use books/book-name/CHAPTER_MAP.md to find line ranges for Chapter 1
4. Read books/book-name/FORMATTING_PLAN.md for known issues to watch for
**Workflow Summary (see chapter-workflow.md for complete details):**
Step 1: Read Standards and Chapter Map
- Read references/formatting-standards.md
- Read CHAPTER_MAP.md for your chapter's line ranges
- Read FORMATTING_PLAN.md for known issues
Step 2: Extract Chapter Content
- Extract Chapter 1 from raw/book-parsed.md using line ranges
Step 3: Identify Issues follow the standards
- Headers using bold instead of #
- Shattered code blocks
- Split paragraphs
- Missing code language identifiers
- Emphasis artifacts [word]
- Corrupted footnotes
- Missing image alt text
- Broken links
Step 4: Apply Formatting Fixes
- Follow the three-pass approach in chapter-workflow.md:
* First pass: Structure (headers, code blocks)
* Second pass: Content (paragraphs, emphasis)
* Third pass: Details (footnotes, images, links)
Step 5: Create Output File
- Write to books/book-name/chapters/chapter-01-title.md
- Use structure from chapter-workflow.md
Step 6: Update Progress
- Update books/book-name/progress.md with completion status
- Document fixes applied
**Quality Checklist (from chapter-workflow.md):**
- [ ] All headers use proper # syntax
- [ ] All code blocks have language identifiers
- [ ] No shattered code blocks remain
- [ ] Text flows naturally without mid-sentence breaks
- [ ] All footnotes have [^N] format with definitions
- [ ] Images have descriptive alt text
Return: Confirmation with summary of fixes applied."""
)books/book-name/chapters/merge_book.pypython3 books/book-name/merge_book.py books/book-nameCHAPTER_MAP.mdchapters/books/book-name-book.mdbooks/book-name-book.mdsubagent_type="general"books/book-name/progress.md# Book Name - Conversion Progress
## Phase 1: Setup ✓
- [x] EPUB extracted
- [x] Project structure created
## Phase 2: Planning ✓
- [x] Chapter map created (15 chapters identified)
- [x] Formatting plan documented
## Phase 3: Chapter Formatting (5/15 complete)
- [x] Front Matter
- [x] Chapter 1: Introduction
- [x] Chapter 2: Getting Started
- [x] Chapter 3: Advanced Topics
- [x] Chapter 4: Best Practices
- [ ] Chapter 5: Performance
- [ ] ...
## Phase 4: Assembly
- [ ] Merge script created
- [ ] Final book generated#*italic***bold**[brackets][^1]"Convert this EPUB to Markdown: /Users/john/Downloads/Effective.Java.3rd.Edition.epub"
books/effective-java-final.md