Book-to-Skill Extractor Output Files: What Gets Generated and Where
The Book-to-Skill extractor produces exactly two output files—full_text.txt and metadata.json—inside a dedicated work directory for every extraction run.
Book-to-Skill is a Python tool that extracts structured text from books and documents to enable skill extraction pipelines. Understanding what output files the Book-to-Skill extractor produces helps you integrate it into larger workflows and locate your extracted data. According to the virgiliojr94/book-to-skill source code, the output generation is deterministic and well-defined.
Primary Output Files
The extractor writes two files to the output directory after processing all input sources:
full_text.txt
full_text.txt contains the consolidated plain-text content from every input document. Each source is clearly demarcated with a banner:
=== SOURCE: mybook.epub ===
[extracted text...]
=== SOURCE: another.pdf ===
[extracted text...]
This file is:
- Written in UTF-8 encoding
- Defined in
book_to_skill/config.pyasOUTPUT_TEXT = OUTPUT_DIR / "full_text.txt" - Created at line 1088 of
book_to_skill/utils.py
metadata.json
metadata.json captures structured metadata for the entire extraction batch, including:
- Per-source details: file size, format, extraction method, page counts, token estimates
- Document structure: chapter detection, table-of-contents presence
- Aggregate statistics across all processed sources
This JSON file is:
- Written with
ensure_ascii=Falseand 2-space indentation - Defined in
book_to_skill/config.pyasOUTPUT_META = OUTPUT_DIR / "metadata.json" - Created at line 1089 of
book_to_skill/utils.py
Where Output Files Are Located
The output directory follows a predictable hierarchy:
| Location Type | Path Pattern |
|---|---|
| Default (temporary) | /tmp/book-to-skill-XXXXXX/ |
| Custom (via environment variable) | $BOOK_SKILL_WORKDIR/ |
The exact path is stored within metadata.json itself, enabling downstream cleanup scripts to reference OUTPUT_DIR programmatically.
Code Implementation Details
From book_to_skill/utils.py, the final write operations occur in the main() function after all sources complete processing:
# Lines 1088-1089 in book_to_skill/utils.py
OUTPUT_TEXT.write_text(consolidated_text, encoding="utf-8")
OUTPUT_META.write_text(json.dumps(metadata, ensure_ascii=False, indent=2), encoding="utf-8")
Configuration constants reside in book_to_skill/config.py:
# Output path definitions
OUTPUT_DIR = Path(os.getenv("BOOK_SKILL_WORKDIR", tempfile.mkdtemp(prefix="book-to-skill-")))
OUTPUT_TEXT = OUTPUT_DIR / "full_text.txt"
OUTPUT_META = OUTPUT_DIR / "metadata.json"
CLI Usage Example
Running the extractor from command line produces visible output followed by the two files:
$ book-to-skill mybook.epub
# Console: extraction progress and summary
# Files created:
# /tmp/book-to-skill-a1b2c3/full_text.txt
# /tmp/book-to-skill-a1b2c3/metadata.json
Key Source Files for Output Generation
| File | Responsibility |
|---|---|
book_to_skill/config.py |
Declares OUTPUT_DIR, OUTPUT_TEXT, and OUTPUT_META paths |
book_to_skill/utils.py |
Implements extraction pipeline and file writes at lines 1088-1089 |
scripts/extract.py |
CLI entry point invoking book_to_skill.cli.main |
Summary
- Two files only:
full_text.txtandmetadata.jsonconstitute complete extractor output - Configurable location: Use
BOOK_SKILL_WORKDIRenvironment variable for persistent storage - UTF-8 encoding: Both files guarantee proper unicode handling
- Self-documenting: Metadata includes the output directory path for cleanup automation
- Deterministic structure: Banner-separated sources in text file, nested JSON with per-source and aggregate statistics
Frequently Asked Questions
Can I change where the Book-to-Skill extractor saves its output files?
Yes. Set the BOOK_SKILL_WORKDIR environment variable to any valid path before running the extractor. Without this variable, the tool creates a temporary directory under your system temp folder with the prefix book-to-skill-.
Does the extractor create any other files besides full_text.txt and metadata.json?
No. According to the source code in book_to_skill/utils.py and book_to_skill/config.py, these are the only two output files generated. The extractor intentionally keeps its surface area minimal for reliable pipeline integration.
What happens to the output directory if I don't set BOOK_SKILL_WORKDIR?
The temporary directory persists after extraction completes because the code does not automatically remove it. However, the metadata.json file contains the OUTPUT_DIR path, so you can implement custom cleanup logic in downstream tools.
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 →