Book-to-Skill Supported File Extensions: The Complete Guide to Document Extraction
Book-to-Skill supports 15+ file extensions spanning PDF, EPUB, DOCX, and specialized e-book formats, with the canonical list defined in the SUPPORTED_EXTENSIONS set within book_to_skill/config.py.
The virgiliojr94/book-to-skill repository is an open-source document extraction engine designed to ingest technical books and map them to skill taxonomies. Understanding which file types are eligible for processing is critical for CLI users and developers integrating the library into pipeline workflows.
Supported File Extension Categories
The repository organizes supported formats into four distinct groups, ensuring coverage of modern publications, legacy e-books, and markup-based documentation.
Core Document Formats
These represent the most common publication and office document standards:
.pdf— Portable Document Format.epub— Electronic Publication (e-book standard).docx— Microsoft Word Open XML format.rtf— Rich Text Format
Plain-Text and Markup Languages
Lightweight formats commonly used for version-controlled documentation and technical writing:
.txt,.text— Plain text files.md,.markdown— Markdown documentation.rst— reStructuredText (Python documentation standard).adoc,.asciidoc— AsciiDoc markup
HTML and Web Archives
Static web documents and XHTML-compliant book exports:
.html,.htm— Standard HTML documents.xhtml— Extensible HyperText Markup Language
Calibre-Compatible E-Book Formats
Legacy and Amazon-specific Kindle formats processed through specialized parsers:
.mobi— Mobipocket e-book format.azw— Amazon Kindle format (older generation).azw3— Amazon Kindle Format 8
How Extensions Are Defined in the Source Code
In book_to_skill/config.py (lines 37-45), the developers aggregate all supported extensions into a single immutable set named SUPPORTED_EXTENSIONS. This constant serves as the single source of truth throughout the application. The same authoritative list is mirrored in user-facing documentation at SKILL.md (lines 97-99) to ensure CLI users understand input constraints before execution.
CLI Validation and Error Handling
When invoking the tool, the entry point in scripts/extract.py expands user-supplied paths, globs, and directories. It validates that at least one discovered file carries an extension present in SUPPORTED_EXTENSIONS. If the scan returns no compatible files, the process aborts immediately with a descriptive error, preventing wasted computation on unsupported binary formats like images or video files.
Working with Supported Extensions Programmatically
You can import the configuration directly to build compatible file scanners or validation logic in your own scripts.
# List all supported extensions programmatically
from book_to_skill.config import SUPPORTED_EXTENSIONS
print("Supported extensions for extraction:")
for ext in sorted(SUPPORTED_EXTENSIONS):
print(ext)
# Process multiple files via CLI
book-to-skill ./my-book.pdf ./chapter1.epub ./notes.md
# Accepts .pdf, .epub, and .md; rejects unsupported types with validation error
# Filter a directory for only supported files
import pathlib
from book_to_skill.config import SUPPORTED_EXTENSIONS
def find_supported_files(root: pathlib.Path):
return [p for p in root.rglob("*") if p.suffix.lower() in SUPPORTED_EXTENSIONS]
print(find_supported_files(pathlib.Path("my_documents")))
Summary
- Book-to-Skill supports 15+ file extensions grouped into four categories: core documents, plain-text/markup, HTML, and Calibre e-books.
- The authoritative whitelist is maintained in
book_to_skill/config.pyas theSUPPORTED_EXTENSIONSset. - The CLI validates inputs against this set and aborts if no supported files are discovered.
- Individual parser modules (e.g.,
pdf.py,epub.py,docx.py) implement extraction logic specific to each extension type.
Frequently Asked Questions
Does Book-to-Skill support scanned PDF files?
Book-to-Skill processes text-based PDF files through its parser module. Scanned or image-based PDFs require OCR preprocessing before extraction, as the current implementation targets extractable text layers rather than performing bitmap-to-text conversion.
Can I add custom file extensions to Book-to-Skill?
The current implementation hardcodes supported extensions in book_to_skill/config.py. To add new formats, you must modify the SUPPORTED_EXTENSIONS set and implement a corresponding parser module following the interface established in scripts/extract.py.
Why does the CLI reject my .doc files?
Legacy Microsoft Word .doc (binary OLE format) is not included in SUPPORTED_EXTENSIONS. Only the modern Office Open XML .docx format is supported. Convert legacy .doc files to .docx or .pdf before processing.
Are file extensions case-sensitive when using Book-to-Skill?
No. The validation logic normalizes extensions to lowercase before checking membership in SUPPORTED_EXTENSIONS, ensuring that .PDF, .Pdf, and .pdf are treated identically during CLI invocation and directory scanning.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →