How to Use book-to-skill with GitHub Copilot CLI
Use book-to-skill to extract and convert documents into deterministic skills that GitHub Copilot CLI can consume through a two-stage pipeline: extraction via scripts/extract.py and generation to ~/.copilot/skills/<slug>/.
The book-to-skill project transforms books, papers, and documents into structured, queryable skills for AI agents. According to the virgiliojr94/book-to-skill source code, this open-source tool implements a deterministic pipeline that ensures identical inputs always produce identical skill files—critical for reproducible agent behavior in GitHub Copilot CLI.
Understanding the book-to-skill Architecture
The architecture separates concerns into two distinct stages: extraction and generation.
Stage 1: Document Extraction
The extraction layer lives in the Python package under book_to_skill/ and is invoked through the thin shim [scripts/extract.py](https://github.com/virgiliojr94/book-to-skill/blob/master/scripts/extract.py). This module delegates to [book_to_skill/cli.py](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/cli.py) for argument parsing and multi-source handling.
Format-specific parsers reside in book_to_skill/parsers/ and handle:
Security hardening occurs in [book_to_skill/sanitize.py](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/sanitize.py), which strips zero-width Unicode characters and implements DOCX XXE guards. The extractor writes two artifacts to a temporary work directory:
full_text.txt— concatenated, source-marked textmetadata.json— page, word, token counts plus generated table of contents
Stage 2: Skill Generation
The generator follows the specification in [SKILL.md](https://github.com/virgiliojr94/book-to-skill/blob/master/SKILL.md), executing deterministic steps:
- Content-type detection
- Cost estimation
- Structure analysis
- Depth selection
- Per-chapter summarization
- Glossary and pattern generation
- Final
SKILL.mdassembly
Output lands in host-specific directories. For GitHub Copilot CLI, this defaults to ~/.copilot/skills/<slug>/.
Installing book-to-skill for Copilot CLI Integration
Before generating skills, verify your environment meets dependencies:
# Check for required external tools
python scripts/extract.py --check
The [book_to_skill/dependencies.py](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/dependencies.py) module probes for optional tools like pdftotext and ebook-convert, generating a readiness report.
Generating Skills for GitHub Copilot CLI
Basic Single-Document Extraction
Convert a PDF into a Copilot-usable skill:
# Extract a single PDF and name the skill "my-book-skill"
./book-to-skill ~/documents/my-book.pdf my-book-skill
The tool creates ~/.copilot/skills/my-book-skill/ containing the structured skill files.
Multi-Source Skill Creation
Combine multiple documents into one unified skill:
# Extract multiple files (PDF + Markdown) into one skill
./book-to-skill ~/papers/paper1.pdf ~/notes/notes.md unified-research
# Process an entire folder of supported documents
./book-to-skill ~/project-docs/ project-knowledge
# Use glob patterns for batch processing
./book-to-skill "~/books/*.epub" my-library
The [book_to_skill/utils.py](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/utils.py) module handles source resolution, chapter detection, and runner orchestration for multi-source scenarios.
Reloading and Using Skills in GitHub Copilot CLI
GitHub Copilot CLI scans skill folders only at startup. After generating a skill, you must reload the skill cache:
# Make Copilot aware of the new skill
/skills reload # refresh the skill cache
/skills list # verify "my-book-skill" appears
Once listed, invoke the skill using its slug:
# Show the skill's purpose and top-level summary
/my-book-skill
# List available chapters
/my-book-skill "list chapters"
# Dive into a specific chapter
/my-book-skill ch05
Validating and Securing Generated Skills
The repository includes validation tools to ensure skill integrity:
# Validate SKILL.md against Copilot-specific rules
python tools/validate_skill.py --lens copilot ~/.copilot/skills/my-book-skill/SKILL.md
# Scan for prompt injection, hidden Unicode, or authority-widening tags
python tools/scan_generated_skill.py ~/.copilot/skills/my-book-skill/
These tools reference [tools/validate_skill.py](https://github.com/virgiliojr94/book-to-skill/blob/master/tools/validate_skill.py) and [tools/scan_generated_skill.py](https://github.com/virgiliojr94/book-to-skill/blob/master/tools/scan_generated_skill.py) for implementation details.
Configuring Output Paths and Extensions
Control supported formats and default locations through [book_to_skill/config.py](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/config.py). This module declares:
- Supported file extensions
- Default output directory patterns
- Host-specific path conventions (Copilot, Claude, Amp)
Summary
- book-to-skill implements a two-stage pipeline (extraction → generation) for converting documents into agent-ready skills
- The extractor uses format-specific parsers in
book_to_skill/parsers/with security hardening viasanitize.py - Skills for GitHub Copilot CLI deploy to
~/.copilot/skills/<slug>/and require/skills reloadto become available - Multi-source inputs are supported: single files, multiple files, directories, and glob patterns
- Validation tools ensure skill integrity and guard against prompt injection vulnerabilities
Frequently Asked Questions
Where does book-to-skill place generated skills for Copilot CLI?
By default, skills land in ~/.copilot/skills/<slug>/ as configured in book_to_skill/config.py. The <slug> matches the skill name you provide as the final argument to the extraction command.
Why does my new skill not appear in /skills list immediately?
GitHub Copilot CLI caches skills at startup. Run /skills reload to refresh the cache after generating a new skill. This is a host-specific behavior documented in the Copilot CLI specification.
Can I combine multiple PDFs, EPUBs, and Markdown files into one skill?
Yes. Pass multiple paths, directories, or glob patterns to book-to-skill. The book_to_skill/utils.py module orchestrates source resolution and chapter detection across heterogeneous formats, producing unified output.
How does book-to-skill handle security in extracted documents?
The pipeline implements multiple hardening measures: zero-width Unicode stripping in sanitize.py, DOCX XXE attack prevention, and subprocess argument sanitization. The optional tools/scan_generated_skill.py performs post-generation audits for prompt injection vectors.
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 →