GetNotes Tools
virgiliojr94/book-to-skill
Tool นี้คืออะไร
book-to-skill เป็นเครื่องมือสำหรับนักพัฒนาที่ช่วยแปลงหนังสือ เอกสาร หรือแหล่งข้อมูลทางเทคนิคให้เป็น "Agent Skill" ที่มีโครงสร้าง เพื่อให้สามารถศึกษา อ้างอิง และใช้งานได้ง่ายขึ้นใน GitHub Copilot CLI, Amp หรือ Claude Code โดยลดจำนวนโทเค็นที่ใช้ในการตอบคำถามได้อย่างมีนัยสำคัญ
ข้อมูลโปรเจกต์
ดาว
13K
Forks
1.4K
License
MIT
อัปเดต GitHub ล่าสุด
27 ก.ค. 2569
เพิ่มใน GetNotes
30 ก.ค. 2569
Repository
virgiliojr94/book-to-skill
เหมาะกับอาชีพ
Ecosystem
Python
แปลและเรียบเรียงโดย AI
เนื้อหาฉบับภาษาไทย
ใช้อ่านเพื่อทำความเข้าใจเบื้องต้น โปรดตรวจสอบรายละเอียดสำคัญกับเอกสารต้นฉบับด้านล่าง
วิธีการทำงานใน 3 ขั้นตอน:
- 1ชี้ ไปที่ไฟล์ โฟลเดอร์ หรือ glob —
/book-to-skill ./my-book.pdf - 2มันจะกลั่นกรอง หนังสือให้เป็น skill — เฟรมเวิร์ก กฎการตัดสินใจ รูปแบบที่ไม่พึงประสงค์ และไฟล์ต่อบท โครงสร้าง ไม่ใช่แค่สรุป
- 3Agent ของคุณจะโหลดตามต้องการ — ถาม
/my-book replicationแล้วมันจะอ่านบทที่ถูกต้องและตอบจากเนื้อหาจริง ไม่มีการหลอน
🤔 ทำไม
คุณซื้อหนังสือเทคนิคดีๆ มาเล่มหนึ่ง คุณอ่านมันครั้งเดียว สามเดือนต่อมาคุณจำไม่ได้ว่ามีบทที่ 7 อยู่
วิธีแก้ปัญหาทั่วไปไม่ช่วยอะไร:
- 📄 "ขอฉันค้นหาใน PDF หน่อย" → คุณได้รายการหน้า ไม่ใช่คำตอบ
- 🧠 "ฉันจะถาม Agent เกี่ยวกับหนังสือเล่มนี้" → มันจะหลอนหรือไม่ก็บอกว่าไม่มีเนื้อหา
- 📝 "ฉันจะจดบันทึกขณะอ่าน" → คุณได้เอกสาร 200 บรรทัดที่คุณไม่เคยเปิดอีกเลย
book-to-skill แก้ปัญหานี้โดยการเปลี่ยนหนังสือให้เป็น skill ที่มีโครงสร้างซึ่ง Agent ของคุณจะโหลดตามต้องการ
เมื่อติดตั้งแล้ว คุณเพียงแค่พิมพ์ /your-book-slug replication แล้ว Agent จะอ่านบทที่ถูกต้องและตอบจากเนื้อหาจริง ไม่มีการหลอน ไม่ต้องขุดคุ้ย PDF หนังสือจะกลายเป็นส่วนหนึ่งของเวิร์กโฟลว์ของคุณ
ใช้งานได้กับโฮสต์ใดๆ ที่รองรับมาตรฐาน Agent Skills แบบเปิด — GitHub Copilot CLI, Amp และ Claude Code ทั้งหมดอ่านรูปแบบ SKILL.md เดียวกัน
📦 สิ่งที่สร้างขึ้น
การรัน /book-to-skill your-book.pdf (หรือโฟลเดอร์, glob, หรือรายการไฟล์) จะสร้าง skill ที่สมบูรณ์ในไดเรกทอรี skills ของ Agent ของคุณ (~/.copilot/skills/<slug>/ สำหรับ Copilot CLI, ~/.agents/skills/<slug>/ สำหรับ Amp หรือ cross-agent, ~/.claude/skills/<slug>/ สำหรับ Claude Code):
| ไฟล์ | วัตถุประสงค์ | ขนาด |
|---|---|---|
SKILL.md | โมเดลความคิดหลัก + ดัชนีบท | ~4,000 โทเค็น |
chapters/ch01-*.md … | หนึ่งไฟล์ต่อบท โหลดตามต้องการ | ~1,000 โทเค็นต่อไฟล์ |
glossary.md | คำศัพท์สำคัญทุกคำ เรียงตามตัวอักษรพร้อมการอ้างอิงบท | ~1,500 โทเค็น |
patterns.md | เทคนิค อัลกอริทึม และรูปแบบการออกแบบทั้งหมด | ~2,000 โทเค็น |
cheatsheet.md | ตารางการตัดสินใจและกฎอ้างอิงด่วน | ~1,000 โทเค็น |
ไฟล์บทจะถูกโหลดตามต้องการ — พวกมันจะไม่ถูกนับรวมในงบประมาณ skill จนกว่าคุณจะถามเกี่ยวกับหัวข้อนั้น
🏢 นอกเหนือจากหนังสือ
ชื่อบอกว่า "book" แต่ข้อมูลนำเข้าคือข้อความร้อยแก้วที่มีโครงสร้าง การแยกข้อมูลแบบเดียวกันนี้ใช้ได้กับความรู้ที่คุณเป็นเจ้าของและอ่านซ้ำอยู่เสมอ:
- เอกสารภายใน — บันทึกการตัดสินใจด้านสถาปัตยกรรม, runbook, คู่มือการเริ่มต้นใช้งาน รวมโฟลเดอร์
docs/ทั้งหมดให้เป็น skill เดียวและถามมันขณะที่คุณเขียนโค้ด - ระบบแบรนด์และการออกแบบ — แนวทางการใช้เสียง, เอกสารโทนเสียง, หลักการส่วนประกอบ เปลี่ยนหนังสือแบรนด์ให้เป็น skill ที่ทีมของคุณสามารถสอบถามได้แทนที่จะต้องอ่าน PDF 60 หน้า
- กลุ่มงานวิจัย — กองเอกสารวิจัยพร้อมบันทึกของคุณเอง รวมเข้าเป็น skill เดียวที่ครบวงจรและอัปเดตเมื่อมีเนื้อหาใหม่เข้ามา (ดู Update / fold-in)
- ข้อกำหนดและมาตรฐาน — RFCs, สัญญา API, เอกสารการปฏิบัติตามข้อกำหนดที่คุณอ้างอิงแต่ไม่เคยจำได้
หากคุณเปิดเอกสารบ่อยพอที่จะอยากจำมันได้ นั่นคือเอกสารที่เหมาะสม
🚀 การใช้งาน
/book-to-skill <path-to-document-folder-or-glob>... [skill-name-slug]รูปแบบเอกสารที่รองรับ: PDF, EPUB, DOCX, TXT, Markdown, reStructuredText, AsciiDoc, HTML, RTF, MOBI/AZW/AZW3
ตัวอย่าง:
# ประมวลผลหลายไฟล์พร้อมกันให้เป็น skill เดียว
/book-to-skill ~/papers/paper1.pdf ~/notes/export.txt unified-research
# ประมวลผลไฟล์ที่รองรับทั้งหมดในโฟลเดอร์พร้อมกัน
/book-to-skill ~/workspace/project-docs/ project-knowledge
# ประมวลผลไฟล์ที่ตรงกับรูปแบบ glob
/book-to-skill "~/books/*.epub" my-library
# อัปเดต/รวมเนื้อหาใหม่เข้ากับโฟลเดอร์ skill ที่มีอยู่
/book-to-skill ~/articles/new-paper.pdf ~/.claude/skills/project-knowledgeหลังจากสร้าง skill แล้ว ให้ใช้งานเหมือน skill Agent อื่นๆ:
/designing-data-intensive-apps # โหลดโมเดลความคิดหลัก
/designing-data-intensive-apps replication # ค้นหาและอธิบายหัวข้อ
/designing-data-intensive-apps ch05 # เจาะลึกบทที่ 5
/designing-data-intensive-apps "what chapters do you have?" ใน GitHub Copilot CLI คุณอาจต้องรัน /skills reload หลังจากเขียนไฟล์เพื่อให้ skill ใหม่ปรากฏใน /skills list ส่วน Claude Code และ Amp จะรับรู้ในการทำงานครั้งถัดไป
🔧 ข้อกำหนด
ตัวแยกข้อมูลจะลองใช้เครื่องมือตามลำดับสำหรับแต่ละรูปแบบและใช้เครื่องมือแรกที่พร้อมใช้งาน หากไม่มีการติดตั้งใดๆ มันจะบอกคุณว่าต้องรันคำสั่งใด Plain text, Markdown, reStructuredText และ AsciiDoc ไม่ต้องการ dependencies เพิ่มเติม
ตรวจสอบการตั้งค่าของคุณในคำสั่งเดียว: python3 scripts/extract.py --check จะพิมพ์ว่ามี extractors ใดบ้างที่ติดตั้งสำหรับทุกรูปแบบ และคำสั่งที่แน่นอนในการติดตั้งสิ่งที่ขาดหายไป — ไม่จำเป็นต้องมีไฟล์
PDF — เลือกตามประเภทหนังสือ:
| ประเภทหนังสือ | เครื่องมือ | ติดตั้ง | ความเร็ว |
|---|---|---|---|
| เน้นข้อความ (ร้อยแก้ว, ตารางน้อย) | pdftotext (poppler) | sudo apt install poppler-utils | ⚡ ทันที |
| เน้นข้อความ (สำรอง) | pypdf | pip3 install pypdf | ⚡ ทันที |
| เน้นข้อความ (สำรอง) | pdfminer.six | pip3 install pdfminer.six | ⚡ ทันที |
| เทคนิค (โค้ด, ตาราง, สูตร) | docling | pip3 install docling | ~1.5 วินาที/หน้า |
ก่อนการแยกข้อมูลจะเริ่มขึ้น skill จะถามคุณว่าหนังสือเป็นประเภท technical หรือ text-heavy และจะเลือกเครื่องมือที่เหมาะสมโดยอัตโนมัติ Docling จะรักษารูปแบบตาราง Markdown และบล็อกโค้ด; pdftotext จะเร็วกว่าสำหรับหนังสือที่เป็นร้อยแก้วเท่านั้น
EPUB:
| เครื่องมือ | ติดตั้ง | คุณภาพ |
|---|---|---|
ebooklib + beautifulsoup4 | pip3 install ebooklib beautifulsoup4 | ⭐⭐⭐ ดีที่สุด |
stdlib zipfile | มีมาให้ในตัว — ไม่ต้องติดตั้ง | ⭐⭐ พร้อมใช้งานเสมอ |
รูปแบบอื่นๆ:
| รูปแบบ | เครื่องมือ | ติดตั้ง |
|---|---|---|
| DOCX | python-docx (สำรอง: stdlib ZIP/XML) | pip3 install python-docx |
| HTML | beautifulsoup4 (สำรอง: stdlib html.parser) | pip3 install beautifulsoup4 |
| RTF | striprtf (สำรอง: regex) | pip3 install striprtf |
| MOBI / AZW / AZW3 | Calibre ebook-convert (แอปภายนอก ไม่ใช่ pip) | https://calibre-ebook.com/download |
| TXT / Markdown / reStructuredText / AsciiDoc | มีมาให้ในตัว | — |
⚙️ วิธีการทำงาน
ไฟล์เดียว · โฟลเดอร์ · glob · รายการพาธ
│
▼
ขั้นตอนที่ 1.5 — "หนังสือเป็นแบบ Technical หรือ Text-heavy?"
│
├── technical → Docling (ตาราง + บล็อกโค้ดในรูปแบบ markdown, ~1.5 วินาที/หน้า)
└── text → pdftotext → pypdf → pdfminer (ทันที)
│
▼
scripts/extract.py <paths…> --mode <technical|text>
ต่อแหล่งที่มา: PDF → pdftotext/Docling · EPUB → ebooklib → stdlib zipfile · DOCX/HTML/RTF/…
(แหล่งที่มาที่ไม่ดีหนึ่งแหล่งจะถูกข้ามพร้อมคำเตือน; ที่เหลือยังคงประมวลผล)
│
├── /tmp/book_skill_work/full_text.txt (แหล่งที่มาทั้งหมดรวมกัน พร้อมเครื่องหมายแหล่งที่มา)
└── /tmp/book_skill_work/metadata.json (สถิติรวม + อาร์เรย์ต่อแหล่งที่มา)
│
▼
Claude วิเคราะห์โครงสร้าง
(ชื่อเรื่อง, ผู้แต่ง, บท, สารบัญ — ครอบคลุมทุกแหล่งที่มา)
── หรือ, หากกำหนดเป้าหมาย skill ที่มีอยู่: รวมเนื้อหาใหม่เข้าด้วยกัน (โหมด 4)
│
▼
สร้างบทสรุปต่อบท (800–1,200 โทเค็นต่อบท)
technical → รวมถึงส่วน Code Examples + Reference Tables
สร้าง glossary, patterns, cheatsheet
สร้าง master SKILL.md พร้อมโมเดลความคิดหลัก
│
▼
Skill ถูกเขียนไปยังหนึ่งใน:
~/.copilot/skills/<slug>/ (GitHub Copilot CLI)
~/.agents/skills/<slug>/ (Copilot CLI หรือ Amp, cross-agent)
~/.claude/skills/<slug>/ (Claude Code)
/tmp/book_skill_work/ 🗑️ ถูกล้างออก
**เกณฑ์มาตรฐานการดึงข้อมูล** (หนังสือเทคนิค 103 หน้า, CPU เท่านั้น):
| วิธี | เวลา | โทเค็น | ตาราง | บล็อกโค้ด |
|---|---|---|---|---|
| pdftotext | 0.1s | 27K | 0 | 0 |
| Docling | 164s | 27K (+1.2%) | 48 | 36 |
**การแปลงจริง** (วัดจาก: จำนวนหน้า, โทเค็นที่ดึงมา, บทที่ตรวจจับอัตโนมัติ,
ประมาณการค่าใช้จ่ายแบบครั้งเดียวบน Claude Sonnet 4.5 ที่ $3/$15 ต่อ MTok):
| หนังสือ | รูปแบบ | หน้า | โทเค็น | บท | ~ค่าใช้จ่าย |
|---|---|---:|---:|---:|---:|
| Think Python 2 | PDF | 244 | 119K | 19 | $0.88 |
| Working Backwards | PDF | 371 | 175K | 10 | $0.96 |
| Pro Git | PDF | 501 | 229K | — † | $1.23 |
| Moby-Dick | EPUB | — | 301K | — † | $1.42 |
† การตรวจจับบทอัตโนมัติต้องใช้หัวข้อ `Chapter N` / `Capítulo N` ที่ชัดเจน Pro Git
ใช้ชื่อส่วนและ Moby-Dick ใช้ *ชื่อบท* / เลขโรมัน ดังนั้นจึงไม่มีการแบ่งส่วนอัตโนมัติ —
การดึงข้อมูลและการแปลงยังคงทำงานได้ แต่คุณต้องชี้ไปที่ส่วนต่างๆ ด้วยตนเอง
skill เต็มรูปแบบมีค่าใช้จ่ายประมาณ **$1 ต่อหนังสือ**; ซึ่งน้อยกว่าการอ่าน PDF ซ้ำทุกครั้งที่ใช้งานมาก
<details>
<summary>หลักการออกแบบ (คลิกเพื่อขยาย)</summary>
1. **ความหนาแน่นสำคัญกว่าความสมบูรณ์** — สรุป 1,000 โทเค็นดีกว่าข้อความที่ตัดตอนมา 10,000 โทเค็น
2. **เสียงของผู้ปฏิบัติงาน** — "ใช้ X เมื่อ Y" ไม่ใช่ "หนังสืออธิบาย X"
3. **SKILL.md ที่เน้นเนื้อหาสำคัญ** — การบีบอัดทำให้เนื้อหาสำคัญที่สุดประมาณ 5,000 โทเค็นแรกอยู่ด้านหน้า
4. **บทตามความต้องการ** — ดัชนีหัวข้อจะบอก Claude ว่าต้องอ่านไฟล์ใด; บทจะโหลดเมื่อจำเป็นเท่านั้น
5. **ไม่ใช้ข้อความดิบ** — สังเคราะห์, สรุป, ดึงสัญญาณจากแหล่งที่มาเสมอ
</details>
---
## 🧾 ค่าใช้จ่ายของวงจรการค้นหา (The Discovery Loop Tax)
เอเจนต์ที่อ่าน PDF ไม่ได้แค่ "อ่าน" — มัน "นำทาง" เมื่อคุณถามคำถามหนึ่ง มันจะดึงสารบัญ สังเกตเห็นคำศัพท์ที่มันไม่สามารถนิยามได้ ดึงหน้าเพิ่มเติม ย้อนกลับ ทุกการกระโดดเหล่านั้นจะถูกบันทึกในประวัติการสนทนาและถูก**ประมวลผลซ้ำในการตอบสนองครั้งถัดไปทุกครั้ง** เพื่อให้อยู่ในงบประมาณ เอเจนต์ย่อยจึงถูกบังคับให้บีบอัดสิ่งที่มันอ่านด้วยอัตราส่วนที่รุนแรง ส่งมอบ**สรุปที่ด้อยคุณภาพซึ่งไม่สามารถตรวจสอบข้อเท็จจริง**กับแหล่งที่มาได้ให้กับเอเจนต์หลัก
book-to-skill จ่ายค่าใช้จ่ายในการนำทาง**เพียงครั้งเดียว ณ เวลาคอมไพล์** ในขณะรันไทม์ ผู้ช่วยจะโหลดแกนหลักขนาดเล็กที่อยู่ในหน่วยความจำบวกกับบทที่คอมไพล์ไว้ล่วงหน้าหนึ่งบทที่จำเป็น — ไม่มีวงจรการค้นหา ไม่มีการบีบอัดให้พอดี และแหล่งที่มาที่ดึงมาทั้งหมดจะยังคงอยู่ในดิสก์เพื่อการตรวจสอบ
**วัดผล ไม่ใช่แค่กล่าวอ้าง** การรัน [`tools/discovery_tax.py`](https://github.com/virgiliojr94/book-to-skill/blob/master/tools/discovery_tax.py)
กับหนังสือจริงสามเล่ม — โทเค็นที่เข้าสู่บริบทเพื่อตอบคำถามเป้าหมายเดียว
(book-to-skill = แกนหลักที่อยู่ในหน่วยความจำ + บทที่คอมไพล์แล้วหนึ่งบท ≈ 5,000 โทเค็น):
| หนังสือ (ขนาด) | Context-dump | Discovery loop | book-to-skill | เทียบกับ dump / loop |
|---|---:|---:|---:|:---:|
| Think Python 2 (119K, บทเล็ก) | 119,264 | 12,152 | ~5,000 | 24× / **2.4×** |
| Working Backwards (175K, บทขนาดกลาง) | 175,253 | 33,444 | ~5,000 | 35× / 6.7× |
| AI Engineering (256K, บทขนาดใหญ่) | 256,287 | 77,866 | ~5,000 | 51× / **15.6×** |
ข้อได้เปรียบ**เพิ่มขึ้นตามขนาดบท**: เมื่อเทียบกับ context-dump จะอยู่ที่ 24–51 เท่าอย่างสม่ำเสมอ (และค่าใช้จ่ายนั้นจะเกิดขึ้นซ้ำ*ทุกครั้งที่ใช้งาน*); เมื่อเทียบกับ discovery loop แบบครั้งเดียว จะอยู่ระหว่าง 2.4 เท่าสำหรับหนังสือที่มีบทเล็กๆ ไปจนถึง 15.6 เท่าสำหรับหนังสือที่มีบทขนาดใหญ่ ทำซ้ำกับหนังสือของคุณเอง:
```bash
python3 tools/discovery_tax.py --full-text /tmp/book_skill_work/full_text.txt --target-chapter 5ข้อควรระวังที่ซื่อสัตย์: (1) ตัวเลขการค้นหาเป็นค่าใช้จ่ายแบบครั้งเดียวและเป็นโมเดลที่ใช้สารบัญจริง/ขนาดบทของหนังสือ — เอเจนต์ที่ปรับแต่งมาอย่างดีจะเข้าใกล้กรณีที่ดีที่สุด; ในทางตรงกันข้าม ค่าใช้จ่าย context-dump จะเกิดขึ้นซ้ำทุกครั้งที่ใช้งาน (2) เครื่องมือนี้ต้องการหัวข้อ Chapter N / Capítulo N ที่ชัดเจนเพื่อแบ่งส่วนหนังสือ; หนังสือที่มีแต่ชื่อเรื่องหรือเลขโรมัน (และ EPUBs ที่ดึงมาโดยไม่มี ebooklib) จะไม่สามารถแบ่งส่วนได้อย่างสะอาด book-to-skill จะมีประโยชน์เมื่อคุณกลับมาใช้ความรู้นั้นซ้ำๆ; สำหรับการอ่านครั้งเดียว เอเจนต์ PDF ธรรมดาก็เพียงพอแล้ว
❓ คำถามที่พบบ่อย
"ฉันไม่สามารถแค่โยน PDF/EPUB ลงในบริบทโปรเจกต์ Claude ของฉันได้เหรอ?"
คุณทำได้ — แต่ทุกการสนทนาจะเผาผลาญงบประมาณโทเค็นนั้นตั้งแต่ต้น หนังสือ 400 หน้ามีประมาณ 200K โทเค็น ด้วย skill จะโหลดเฉพาะบทที่เกี่ยวข้องกับคำถามของคุณเท่านั้น — โดยทั่วไปคือแกนหลัก SKILL.md (~4K) บวกกับบทที่คุณถามถึง (~1K) ส่วนที่เหลือจะยังคงอยู่ในดิสก์จนกว่าคุณจะต้องการ
เศรษฐศาสตร์คือการตัดจำหน่าย ไม่ใช่ขนาด การวางหนังสือลงไปจะจ่ายค่าโทเค็นเต็มจำนวนทุกครั้งที่ใช้งานในทุกเซสชัน ตลอดไป book-to-skill จ่ายค่าใช้จ่ายในการดึงข้อมูลเพียงครั้งเดียว และการสนทนาในอนาคตทุกครั้งจะโหลดเฉพาะส่วนที่ต้องการเท่านั้น ยิ่งหน้าต่างบริบทของคุณใหญ่เท่าไหร่ สิ่งนี้ก็ยิ่งสำคัญ — หน้าต่างขนาดใหญ่ทำให้การดัมพ์เป็นไปได้ แต่ไม่ถูก
ที่สำคัญกว่านั้น: การฉีดข้อความดิบคือการดึงข้อมูล skill คือการให้เหตุผล เมื่อคุณโหลดไฟล์บท Claude ไม่ได้กำลังค้นหาคำที่ตรงกัน — มันกำลังทำงานกับเฟรมเวิร์ก หลักการ และโมเดลทางความคิดที่ดึงมาล่วงหน้าและจัดโครงสร้างสำหรับการประยุกต์ใช้ ไม่ใช่สำหรับการอ่าน
"ตอนนี้ Claude มีหน้าต่างบริบท 1M โทเค็นแล้ว — ฉันไม่สามารถเก็บหนังสือทั้งเล่มไว้ในหน่วยความจำได้เหรอ?"
หน้าต่างที่ใหญ่ขึ้นเปลี่ยนสิ่งที่พอดี ไม่ใช่สิ่งที่ฉลาด มีสามเหตุผลที่มันไม่สามารถใช้แทนกันได้:
- คุณจ่ายตามโทเค็น ต่อการเรียกใช้ หน้าต่าง 1M ไม่ได้ทำให้โทเค็นเหล่านั้นฟรี — มันทำให้บิลขนาดใหญ่ที่เกิดขึ้นซ้ำๆ เป็นไปได้ skill โหลดเป็นกิโลไบต์ ไม่ใช่เมกะไบต์
- การเรียกคืนข้อมูลลดลงเมื่อบริบทเต็ม โมเดลจะสูญเสียความแม่นยำในการดึงข้อเท็จจริงเฉพาะที่ฝังอยู่ในบริบทที่เกือบเต็ม ("หลงทางอยู่ตรงกลาง") บทที่คัดสรรมา 1K ดีกว่าข้อความดิบ 200K สำหรับการตอบคำถามเดียว
- หน้าต่าง ≠ โครงสร้าง หนังสือทั้งเล่มในบริบทยังคงเป็นข้อความดิบที่โมเดลต้องแยกวิเคราะห์ใหม่ทุกครั้งที่ใช้งาน skill มาพร้อมกับเฟรมเวิร์กที่ดึงมาล่วงหน้า — เป็นการให้เหตุผล ไม่ใช่การดึงข้อมูล
ใช้หน้าต่างขนาดใหญ่สำหรับสิ่งที่มันทำได้ดี: การอ่านเนื้อหาแบบครั้งเดียวที่คุณไม่จำเป็นต้องใช้อีก ใช้ skill สำหรับความรู้ที่คุณจะใช้ซ้ำๆ
"นี่ไม่ใช่แค่ RAG เหรอ?"
RAG ทำงานในเวลาที่สอบถาม: แบ่งหนังสือเป็นส่วนๆ → ฝังทุกอย่าง → ค้นหาเวกเตอร์ที่คล้ายกัน → ฉีดเข้าสู่ prompt มันถูกปรับให้เหมาะสมสำหรับ "หาให้ฉันส่วนที่พูดถึง X"
book-to-skill ทำงานในเวลาคอมไพล์: การวิเคราะห์เชิงลึกหนึ่งครั้งจะดึงเฟรมเวิร์กจริงของผู้เขียน ตั้งชื่อ อธิบายว่าควรใช้แต่ละอันเมื่อใด จับรูปแบบที่ไม่พึงประสงค์ ผลลัพธ์คือโครงสร้างที่ผู้เขียนใช้เวลาหลายปีในการสร้าง — ไม่ใช่การค้นหาความคล้ายคลึงกันจากประโยคของพวกเขา
RAG ตอบว่า: "นี่คือส่วนที่ใกล้เคียงกับคำถามของคุณ" skill ตอบว่า: "นี่คือ 12 เฟรมเวิร์กที่ผู้เขียนคนนี้สร้างขึ้น พร้อมสำหรับการให้เหตุผล"
เลือกตามลักษณะของงาน:
- กว้างและตื้น — คลังหนังสือหลายสิบเล่ม "หาให้ฉันส่วนที่กล่าวถึง X" → เครื่องมือ RAG (เช่น CandleKeep) ชนะ
- แคบและลึก — หนังสือเล่มเดียวหรือกลุ่มแหล่งข้อมูลที่เกี่ยวข้องอย่างใกล้ชิด เฟรมเวิร์กที่คุณนำไปใช้ในขณะทำงาน → book-to-skill ชนะ
ทั้งสองเสริมกัน ไม่ได้แข่งขันกัน: RAG จัดทำดัชนีชั้นวางหนังสือ, book-to-skill เชี่ยวชาญหนังสือเล่มเดียว
"หนังสือยอดนิยมมีอยู่ในข้อมูลการฝึกอบรมของ Claude อยู่แล้ว ทำไมต้องยุ่งยาก?"
สำหรับหนังสือที่เป็นที่รู้จักกันอย่างแพร่หลาย (Clean Code, DDIA, Pragmatic Programmer) Claude มีความรู้ทั่วไป — แต่เป็นความรู้ที่ถูกบีบอัด เฉลี่ยจากข้อมูลการสนทนาเกี่ยวกับหนังสือทั่วทั้งอินเทอร์เน็ต และอาจสร้างข้อมูลเท็จเกี่ยวกับคำพูดเฉพาะหรือตำแหน่งบท
book-to-skill ทำงานจากสำเนาจริงของคุณ ชื่อเฟรมเวิร์กทุกชื่อ รายการรูปแบบที่ไม่พึงประสงค์ทุกรายการ หมายเลขบททุกหมายเลข อ้างอิงจากข้อความที่คุณให้มา ไม่มีการเปลี่ยนแปลงข้อมูลการฝึกอบรม ไม่มีการสร้างชื่อบทเท็จ
นอกจากนี้ยังโดดเด่นสำหรับหนังสือที่ Claude ไม่รู้จักเลย: ข้อมูลอ้างอิงทางเทคนิคเฉพาะทาง เอกสารภายในบริษัท สิ่งพิมพ์ล่าสุด งานแปล
"NotebookLM จัดการหนังสือหลายเล่มได้ดีกว่า"
จริงอย่างยิ่ง — หากเวิร์กโฟลว์ของคุณคือ "ฉันมีหนังสือ 80 เล่มแยกกัน และฉันต้องการค้นหาข้อมูลจากทั้งหมด" NotebookLM คือเครื่องมือที่เหมาะสม
book-to-skill สร้างขึ้นมาเพื่องานที่แตกต่างกัน: คุณต้องการเจาะลึกในหัวข้อเฉพาะหรือคลังข้อมูล โดยมีเอกสารที่เกี่ยวข้องหลายฉบับ (บทความ, บท, บันทึก) รวมเข้าเป็น skill เดียวกัน และยังสามารถอัปเดตได้ตลอดเวลาเมื่อมีเนื้อหาใหม่เข้ามา! สิ่งนี้จะรวมฐานความรู้ที่ปรับแต่งของคุณเข้ากับเวิร์กโฟลว์การเขียนโค้ดหรือการเขียนของคุณโดยตรง แทนที่จะอยู่ในแท็บเบราว์เซอร์แยกต่างหาก
📥 การติดตั้ง
สองวิธีในการใช้งาน อย่าสับสน:
- ในฐานะ agent skill (คำสั่ง
/book-to-skillใน Claude Code, Copilot CLI, หรือ Amp) →git cloneลงในโฟลเดอร์ skills ของคุณ (ด้านล่าง) นี่คือสิ่งที่ทำให้คุณมีคำสั่ง slash และขั้นตอนการแปลงหนังสือแบบเต็ม - ในฐานะ CLI แบบสแตนด์อโลน (เฉพาะตัวดึงข้อความ) →
pip install book-to-skillจากนั้นbook-to-skill --helpสิ่งนี้ไม่ได้ลงทะเบียน agent skill; มันแค่ติดตั้งเอนจินการดึงข้อมูล ดู ส่วน CLI
skill นี้เป็นไปตามมาตรฐาน Agent Skills แบบเปิด ดังนั้นการติดตั้งครั้งเดียวจึงใช้งานได้กับโฮสต์ที่เข้ากันได้ทุกชนิด
GitHub Copilot CLI (skill ส่วนตัว):
git clone https://github.com/virgiliojr94/book-to-skill.git ~/.copilot/skills/book-to-skill
# จากนั้น ในเซสชัน `copilot`:
/skills reload
/skills info book-to-skill
หรือใช้เส้นทาง cross-agent ที่ Copilot CLI และ Amp ตรวจพบ:
```bash
git clone https://github.com/virgiliojr94/book-to-skill.git ~/.agents/skills/book-to-skillClaude Code:
คัดลอกข้อความนี้ลงใน session ของ Claude Code:
Install book-to-skill: https://raw.githubusercontent.com/virgiliojr94/book-to-skill/master/SKILL.mdหรือติดตั้งด้วยตัวเองโดยใช้ git clone มาตรฐาน (เพื่อให้มั่นใจว่าไฟล์ modular engine ถูกดึงมาอย่างถูกต้อง):
git clone https://github.com/virgiliojr94/book-to-skill.git ~/.claude/skills/book-to-skillจากนั้นใน session ของ agent ใดก็ได้:
/book-to-skill ~/path/to/your-book.pdf
# หรือ
/book-to-skill ~/path/to/your-book.epubStandalone CLI (pip)
pip install book-to-skill เป็นเส้นทาง แยกต่างหากและเป็นทางเลือก ซึ่งจะติดตั้งเฉพาะ text-extraction engine ในรูปแบบ CLI สำหรับการเขียนสคริปต์หรือเพื่อใช้งาน optional extractors โดยจะ ไม่ ลงทะเบียน agent skill /book-to-skill (หากต้องการใช้งานส่วนนั้น ให้ใช้ git clone ด้านบน)
pip install "book-to-skill[pdf,epub,docx]" # engine + optional extractors
book-to-skill ~/path/to/book.pdf --mode text # หรือ: python -m book_to_skill ...
book-to-skill --check # รายงานว่ามีการติดตั้ง extractor ตัวไหนบ้าง📁 โครงสร้าง Repository
book-to-skill/
├── SKILL.md # คำจำกัดความของ Skill + คำแนะนำทีละขั้นตอน (generator spec)
├── scripts/
│ ├── extract.py # Thin entrypoint wrapper
│ └── extractor/ # Modular extraction package
│ ├── config.py # Extensions, paths, dependency constants
│ ├── dependencies.py # optional-dep probing + --check
│ ├── exceptions.py # ExtractionError (ข้อผิดพลาดรายแหล่งข้อมูล, batch-safe)
│ ├── utils.py # CLI parsing, multi-source resolution, chapter detection, runner
│ └── parsers/ # Format-specific parsers (pdf, epub, docx, html, rtf, calibre, text)
├── tools/
│ ├── discovery_tax.py # วัดค่า token cost เทียบกับ context-dump / discovery loop
│ └── validate_skill.py # ตรวจสอบ SKILL.md ที่สร้างขึ้นตามกฎของ host (--lens claude|copilot|amp)
├── tests/ # pytest suite (extraction, detection, discovery tax)
├── docs/
│ ├── PERFORMANCE.md # ผลการทดสอบ benchmark, discovery tax, cost
│ └── ARCHITECTURE.md # pipeline + component map
├── CHANGELOG.md # ประวัติการ release (semver)
├── CONTRIBUTING.md # การตั้งค่า dev, PR conventions, กระบวนการ release
├── SECURITY.md # การรายงานช่องโหว่
└── README.md # ไฟล์นี้⚖️ ลิขสิทธิ์และการใช้งานอย่างเป็นธรรม (Fair Use)
book-to-skill ไม่มีเนื้อหาหนังสือ แถมมาให้แม้แต่หน้าเดียว มันคือตัวแปลงที่คุณต้องระบุไปยังไฟล์ที่คุณเป็นเจ้าของอยู่แล้ว
- การประมวลผลเกิดขึ้นในเครื่อง (Local): การดึงข้อมูลและการวิเคราะห์ทำงานบนเครื่องของคุณ ไฟล์ของคุณจะไม่ถูกอัปโหลดโดยเครื่องมือนี้ (หากโมเดลของ agent ทำงานบนคลาวด์ ข้อความที่คุณส่งให้จะเป็นไปตามข้อกำหนดข้อมูลปกติของผู้ให้บริการรายนั้น เช่นเดียวกับการส่ง prompt ทั่วไป)
- ใช้สำเนาของคุณเอง: โปรดใช้หนังสือที่คุณซื้อมา, เอกสารที่บริษัทของคุณเป็นเจ้าของ หรือบทความที่คุณมีสิทธิ์อ่าน
- ผลลัพธ์คือโน้ตของคุณ: Skill ที่ถูกสร้างขึ้นคือสิ่งที่ถูกสังเคราะห์และจัดโครงสร้างใหม่ (เช่น ชื่อ framework, คำจำกัดความ, ประเด็นสำคัญ) ไม่ใช่การคัดลอกข้อความ โดย Skill จะไม่มีการคัดลอกข้อความดิบโดยเด็ดขาด (ดู Quality Rule #7) ให้ถือว่าสิ่งนี้เหมือนโน้ตสรุปที่เขียนด้วยลายมือ: เป็นของคุณ เพื่อการใช้งานส่วนตัว
- ห้ามนำไปเผยแพร่ต่อ: การเผยแพร่หรือแบ่งปัน Skill ที่สร้างจากงานที่มีลิขสิทธิ์อาจเป็นการละเมิดสิทธิ์ของผู้ถือลิขสิทธิ์ โปรดเก็บ Skill ของหนังสือบุคคลที่สามไว้เป็นส่วนตัว สำหรับเอกสารภายใน, งานเขียนของคุณเอง และเนื้อหาที่ได้รับอนุญาตแบบเปิด สามารถแบ่งปันได้ภายใต้ขอบเขตของใบอนุญาตนั้นๆ
หากไม่แน่ใจ ให้ปฏิบัติตามใบอนุญาตหรือข้อกำหนดของเอกสารต้นฉบับ โปรเจกต์นี้เป็นเพียงเครื่องมือ วิธีการใช้งานขึ้นอยู่กับตัวคุณเอง
💖 ผู้สนับสนุน
book-to-skill เป็นซอฟต์แวร์ฟรีภายใต้ใบอนุญาต MIT ซึ่งดูแลโดยใช้เวลาส่วนตัว หากเครื่องมือนี้ช่วยคุณประหยัด token หรือชั่วโมงในการเรียนรู้ โปรดพิจารณาสนับสนุนการดูแลรักษา: การรีวิว PR, การแก้ไขหลายภาษา, การ release และการทำเอกสาร
Become a sponsor → github.com/sponsors/virgiliojr94
รายชื่อผู้สนับสนุนทุกคนจะปรากฏใน BACKERS.md ขอบคุณที่ช่วยให้เครื่องมือแบบ open source ที่ให้ความสำคัญกับความเป็นส่วนตัวยังคงอยู่ ✨
License
MIT — ใช้กับตัวแปลง (โค้ด + คำจำกัดความของ skill) ใน repository นี้ ไม่ใช่ กับหนังสือหรือเอกสารใดๆ ที่คุณนำมาประมวลผลด้วยเครื่องมือนี้
Star History
เอกสารโปรเจกต์
อ่านเอกสารต้นฉบับ
README วิธีติดตั้ง วิธีใช้งาน และข้อกำหนดจาก repository ต้นฉบับ

How it works, in 3 steps:
- 1Point it at a file, folder, or glob —
/book-to-skill ./my-book.pdf - 2It distills the book into a skill — frameworks, decision rules, anti-patterns, and per-chapter files. Structure, not a summary.
- 3Your agent loads it on demand — ask
/my-book replicationand it reads the right chapter and answers from the real content, no hallucination.
🤔 Why
You buy a great technical book. You read it once. Three months later you can't remember chapter 7 existed.
The usual workarounds don't help:
- 📄 "Let me just search the PDF" → you get a list of pages, not answers
- 🧠 "I'll ask the agent about this book" → it either hallucinates or says it doesn't have the content
- 📝 "I'll take notes as I read" → you end up with a 200-line doc you never open again
book-to-skill solves this by turning the book into a structured skill your agent loads on demand.
Once installed, you just type /your-book-slug replication and the agent reads the right chapter and answers from the actual content. No hallucination. No digging through PDFs. The book becomes part of your workflow.
Works with any host that supports the open Agent Skills standard — GitHub Copilot CLI, Amp, and Claude Code all read the same SKILL.md format.
📦 What it generates
Running /book-to-skill your-book.pdf (or a folder, glob, or list of files) creates a full skill in your agent's skills directory (~/.copilot/skills/<slug>/ for Copilot CLI, ~/.agents/skills/<slug>/ for Amp or cross-agent, ~/.claude/skills/<slug>/ for Claude Code):
| File | Purpose | Size |
|---|---|---|
SKILL.md | Core mental models + chapter index | ~4,000 tokens |
chapters/ch01-*.md … | One file per chapter, loaded on-demand | ~1,000 tokens each |
glossary.md | Every key term, alphabetically sorted with chapter refs | ~1,500 tokens |
patterns.md | All techniques, algorithms, and design patterns | ~2,000 tokens |
cheatsheet.md | Decision tables and quick-reference rules | ~1,000 tokens |
Chapter files are loaded on-demand — they don't count against the skill budget until you ask about that topic.
🏢 Beyond books
The name says "book", but the input is any structured prose. The same extraction works on knowledge you own and re-read constantly:
- Internal documentation — architecture decision records, runbooks, onboarding guides. Fold a whole
docs/folder into one skill and ask it while you code. - Brand & design systems — voice guidelines, tone-of-voice docs, component principles. Turn a brand book into a skill your team queries instead of skimming a 60-page PDF.
- Research clusters — a stack of papers plus your own notes, merged into a single unified skill and updated as new material lands (see Update / fold-in).
- Specs & standards — RFCs, API contracts, compliance docs you reference but never memorize.
If you re-open a document often enough to wish you'd memorized it, it's a candidate.
🚀 Usage
/book-to-skill <path-to-document-folder-or-glob>... [skill-name-slug]Supported document formats: PDF, EPUB, DOCX, TXT, Markdown, reStructuredText, AsciiDoc, HTML, RTF, MOBI/AZW/AZW3.
Examples:
# Process several files together into a unified skill
/book-to-skill ~/papers/paper1.pdf ~/notes/export.txt unified-research
# Process all supported files in a folder together
/book-to-skill ~/workspace/project-docs/ project-knowledge
# Process files matching a glob pattern
/book-to-skill "~/books/*.epub" my-library
# Update/fold new material into an existing skill folder
/book-to-skill ~/articles/new-paper.pdf ~/.claude/skills/project-knowledgeAfter the skill is created, use it like any other agent skill:
/designing-data-intensive-apps # load core mental models
/designing-data-intensive-apps replication # find and explain a topic
/designing-data-intensive-apps ch05 # dive into chapter 5
/designing-data-intensive-apps "what chapters do you have?"In GitHub Copilot CLI you may need to run /skills reload after the file is written so the new skill appears in /skills list. Claude Code and Amp pick it up on the next session.
🔧 Requirements
The extractor tries tools in order per format and uses the first available. If nothing is installed, it tells you which command to run. Plain text, Markdown, reStructuredText and AsciiDoc need no extra deps.
Check your setup in one command: python3 scripts/extract.py --check prints which extractors are installed for every format and the exact command to install anything missing — no file needed.
PDF — choose by book type:
| Book type | Tool | Install | Speed |
|---|---|---|---|
| Text-heavy (prose, few tables) | pdftotext (poppler) | sudo apt install poppler-utils | ⚡ instant |
| Text-heavy fallback | pypdf | pip3 install pypdf | ⚡ instant |
| Text-heavy fallback | pdfminer.six | pip3 install pdfminer.six | ⚡ instant |
| Technical (code, tables, formulas) | docling | pip3 install docling | ~1.5s/page |
Before extraction begins, the skill asks you whether the book is technical or text-heavy and picks the right tool automatically. Docling preserves markdown tables and code blocks; pdftotext is faster for prose-only books.
EPUB:
| Tool | Install | Quality |
|---|---|---|
ebooklib + beautifulsoup4 | pip3 install ebooklib beautifulsoup4 | ⭐⭐⭐ Best |
stdlib zipfile | built-in — no install needed | ⭐⭐ Always available |
Other formats:
| Format | Tool | Install |
|---|---|---|
| DOCX | python-docx (fallback: stdlib ZIP/XML) | pip3 install python-docx |
| HTML | beautifulsoup4 (fallback: stdlib html.parser) | pip3 install beautifulsoup4 |
| RTF | striprtf (fallback: regex) | pip3 install striprtf |
| MOBI / AZW / AZW3 | Calibre ebook-convert (external app, not pip) | https://calibre-ebook.com/download |
| TXT / Markdown / reStructuredText / AsciiDoc | built-in | — |
⚙️ How it works
One file · a folder · a glob · a list of paths
│
▼
Step 1.5 — "Technical or text-heavy book?"
│
├── technical → Docling (tables + code blocks as markdown, ~1.5s/page)
└── text → pdftotext → pypdf → pdfminer (instant)
│
▼
scripts/extract.py <paths…> --mode <technical|text>
per source: PDF → pdftotext/Docling · EPUB → ebooklib → stdlib zipfile · DOCX/HTML/RTF/…
(one bad source is skipped with a warning; the rest still process)
│
├── /tmp/book_skill_work/full_text.txt (all sources merged, with source markers)
└── /tmp/book_skill_work/metadata.json (aggregated stats + per-source array)
│
▼
Claude analyzes structure
(title, author, chapters, ToC — spanning all sources)
── or, if targeting an existing skill: folds new content in (Mode 4)
│
▼
Generates per-chapter summaries (800–1,200 tokens each)
technical → includes Code Examples + Reference Tables sections
Generates glossary, patterns, cheatsheet
Generates master SKILL.md with core mental models
│
▼
Skill written to one of:
~/.copilot/skills/<slug>/ (GitHub Copilot CLI)
~/.agents/skills/<slug>/ (Copilot CLI or Amp, cross-agent)
~/.claude/skills/<slug>/ (Claude Code)
/tmp/book_skill_work/ 🗑️ cleaned upExtraction benchmark (103-page technical book, CPU only):
| Method | Time | Tokens | Tables | Code blocks |
|---|---|---|---|---|
| pdftotext | 0.1s | 27K | 0 | 0 |
| Docling | 164s | 27K (+1.2%) | 48 | 36 |
Real conversions (measured: pages, extracted tokens, chapters auto-detected, estimated one-pass cost on Claude Sonnet 4.5 at $3/$15 per MTok):
| Book | Format | Pages | Tokens | Chapters | ~Cost |
|---|---|---|---|---|---|
| Think Python 2 | 244 | 119K | 19 | $0.88 | |
| Working Backwards | 371 | 175K | 10 | $0.96 | |
| Pro Git | 501 | 229K | — † | $1.23 | |
| Moby-Dick | EPUB | — | 301K | — † | $1.42 |
† Chapter auto-detection needs explicit Chapter N / Capítulo N headings. Pro Git
uses section titles and Moby-Dick uses chapter titles / roman numerals, so neither
auto-segments — extraction and conversion still work, but you point at sections
manually. A full skill costs roughly $1 per book; far less than re-reading the
PDF every session.
- 1Density over completeness — a 1,000-token summary beats a 10,000-token excerpt
- 2Practitioner voice — "Use X when Y", not "The book explains X"
- 3Front-loaded SKILL.md — compaction keeps the first ~5,000 tokens; the most important content comes first
- 4On-demand chapters — the topic index tells Claude which file to read; chapters load only when needed
- 5Never raw text — always synthesize, summarize, extract signal from the source
🧾 The Discovery Loop Tax
A PDF-reading agent doesn't just read — it navigates. Ask it one question and it fetches the table of contents, notices a term it can't define, pulls more pages, backtracks. Every one of those hops lands in the conversation history and gets re-processed on every subsequent turn. To stay inside its budget, a sub-agent is then forced to compress what it read at brutal ratios, handing the main agent a degraded summary it can't fact-check against the source.
book-to-skill pays the navigation cost once, at compile time. At runtime the assistant loads a small resident core plus the one pre-compiled chapter it needs — no discovery loop, no compress-to-fit, and the full extracted source stays on disk for verification.
Measured, not asserted. Running tools/discovery_tax.py
on three real books — tokens entering context to answer a single targeted question
(book-to-skill = resident core + one compiled chapter ≈ 5,000 tokens):
| Book (size) | Context-dump | Discovery loop | book-to-skill | vs dump / loop |
|---|---|---|---|---|
| Think Python 2 (119K, small chapters) | 119,264 | 12,152 | ~5,000 | 24× / 2.4× |
| Working Backwards (175K, medium chapters) | 175,253 | 33,444 | ~5,000 | 35× / 6.7× |
| AI Engineering (256K, large chapters) | 256,287 | 77,866 | ~5,000 | 51× / 15.6× |
The advantage scales with chapter size: against a context-dump it's consistently 24–51× (and that cost recurs every turn); against a one-time discovery loop it ranges from a modest 2.4× on a book of small chapters to 15.6× on one of large chapters. Reproduce on your own book:
python3 tools/discovery_tax.py --full-text /tmp/book_skill_work/full_text.txt --target-chapter 5Honest caveats: (1) the discovery figures are a one-time cost and a model
using the book's real ToC/chapter sizes — a well-tuned agent lands nearer the best
case; the context-dump cost, by contrast, recurs on every turn. (2) The tool
needs explicit Chapter N / Capítulo N headings to segment a book; titles-only
or roman-numeral books (and EPUBs extracted without ebooklib) won't segment
cleanly. book-to-skill wins when you return to the knowledge repeatedly; for a
single one-off read, a plain PDF agent is fine.
❓ FAQ
"Can't I just dump the PDF/EPUB into my Claude project context?"
You can — but every conversation will burn that token budget upfront. A 400-page book is ~200K tokens. With a skill, only the chapters relevant to your question load — typically a SKILL.md core (~4K) plus the one chapter you asked about (~1K). The rest stays on disk until you need it.
The economics are amortization, not size. Pasting the book pays the full token bill on every turn of every session, forever. book-to-skill pays the extraction cost once and every future conversation loads only the slice it needs. The bigger your context window, the more this matters — a large window makes the dump possible, not cheap.
More importantly: raw text injection is retrieval. A skill is reasoning. When you load a chapter file, Claude isn't searching for keyword matches — it's working with pre-extracted named frameworks, principles, and mental models structured for application, not for reading.
"Claude has a 1M-token context window now — can't I just keep the whole book loaded?"
A bigger window changes what fits, not what's smart. Three reasons it isn't a substitute:
- You pay per token, per call. A 1M window doesn't make those tokens free — it makes a large, recurring bill possible. The skill loads kilobytes, not megabytes.
- Recall degrades with fill. Models lose precision retrieving a specific fact buried in a near-full context ("lost in the middle"). A 1K curated chapter beats 200K of raw prose for answering one question.
- Window ≠ structure. A full book in context is still raw text the model must re-parse every turn. The skill ships pre-extracted frameworks — reasoning, not retrieval.
Use the big window for what it's good at: a one-off pass over material you'll never need again. Use a skill for knowledge you'll reach for repeatedly.
"Isn't this just RAG?"
RAG works at query time: chunk the book → embed everything → find similar vectors → inject into prompt. It's optimized for "find me the part that talks about X."
book-to-skill works at compile time: one deep analysis run extracts the author's actual frameworks, names them, describes when to use each, captures the anti-patterns. The output is structure the author spent years building — not a similarity search over their sentences.
RAG answers: "here are chunks close to your query."
A skill answers: "here are the 12 frameworks this author built, ready to reason with."
Pick by shape of the job:
- Wide and shallow — a library of dozens of books, "find the part that mentions X" → a RAG tool (e.g. CandleKeep) wins.
- Narrow and deep — one book or a tight cluster of related sources, frameworks you apply while you work → book-to-skill wins.
They're complementary, not competing: RAG indexes a shelf, book-to-skill masters a spine.
"Popular books are already in Claude's training data. Why bother?"
For widely-known books (Clean Code, DDIA, Pragmatic Programmer), Claude has general knowledge — but it's compressed, averaged across the entire internet's discussion of the book, and may hallucinate specific quotes or chapter locations.
book-to-skill works from your actual copy. Every framework name, every anti-pattern list, every chapter number is grounded in the text you provided. No training data drift, no hallucinated chapter titles.
It also shines for books Claude doesn't know at all: niche technical references, internal company documentation, recent publications, translated works.
"NotebookLM handles multiple books better."
Absolutely true — if your workflow is "I have 80 separate books and I want to search across all of them," NotebookLM is the right tool.
book-to-skill is built for a different job: you want to go deep on a specific topic or library, having multiple related documents (papers, chapters, notes) folded into a single unified skill, and even updating it over time as new material arrives! This integrates your customized knowledge base right into your coding or writing workflow, rather than in a separate browser tab.
📥 Install
Two ways to use it, do not confuse them:
- As an agent skill (the
/book-to-skillcommand in Claude Code, Copilot CLI, or Amp) →git cloneinto your skills folder (below). This is what gives you the slash command and the full convert-a-book flow. - As a standalone CLI (just the text extractor) →
pip install book-to-skill, thenbook-to-skill --help. This does not register the agent skill; it only installs the extraction engine. See the CLI section.
The skill follows the open Agent Skills standard, so a single install works for any compatible host.
GitHub Copilot CLI (personal skill):
git clone https://github.com/virgiliojr94/book-to-skill.git ~/.copilot/skills/book-to-skill
# then, in a `copilot` session:
/skills reload
/skills info book-to-skillOr the cross-agent path that Copilot CLI and Amp both discover:
git clone https://github.com/virgiliojr94/book-to-skill.git ~/.agents/skills/book-to-skillClaude Code:
Copy this into your Claude Code session:
Install book-to-skill: https://raw.githubusercontent.com/virgiliojr94/book-to-skill/master/SKILL.mdOr manually using standard git clone (ensures modular engine files are fetched correctly):
git clone https://github.com/virgiliojr94/book-to-skill.git ~/.claude/skills/book-to-skillThen in any agent session:
/book-to-skill ~/path/to/your-book.pdf
# or
/book-to-skill ~/path/to/your-book.epubStandalone CLI (pip)
pip install book-to-skill is a separate, optional path. It installs only the
text-extraction engine as a CLI, for scripting or to grab the optional extractors;
it does not register the /book-to-skill agent skill (use the git clone above
for that).
pip install "book-to-skill[pdf,epub,docx]" # engine + optional extractors
book-to-skill ~/path/to/book.pdf --mode text # or: python -m book_to_skill ...
book-to-skill --check # report which extractors are installed📁 Repository structure
book-to-skill/
├── SKILL.md # Skill definition + step-by-step instructions (the generator spec)
├── scripts/
│ ├── extract.py # Thin entrypoint wrapper
│ └── extractor/ # Modular extraction package
│ ├── config.py # Extensions, paths, dependency constants
│ ├── dependencies.py # optional-dep probing + --check
│ ├── exceptions.py # ExtractionError (per-source failures, batch-safe)
│ ├── utils.py # CLI parsing, multi-source resolution, chapter detection, runner
│ └── parsers/ # Format-specific parsers (pdf, epub, docx, html, rtf, calibre, text)
├── tools/
│ ├── discovery_tax.py # measures token cost vs context-dump / discovery loop
│ └── validate_skill.py # checks a generated SKILL.md against host rules (--lens claude|copilot|amp)
├── tests/ # pytest suite (extraction, detection, discovery tax)
├── docs/
│ ├── PERFORMANCE.md # measured benchmarks, discovery tax, cost
│ └── ARCHITECTURE.md # pipeline + component map
├── CHANGELOG.md # release history (semver)
├── CONTRIBUTING.md # dev setup, PR conventions, release process
├── SECURITY.md # vulnerability reporting
└── README.md # This file⚖️ Copyright & fair use
book-to-skill ships no book content — not a single page. It's a converter you point at files you already own.
- Processing is local. Extraction and analysis run on your machine. Your files are never uploaded by this tool. (If your agent's model runs in the cloud, the text you feed it follows that provider's normal data terms — same as any prompt.)
- You use your own copy. Bring a book you bought, docs your company owns, or papers you have the right to read.
- The output is your notes. A generated skill is a structured, synthesized derivative — framework names, definitions, takeaways — not a reproduction of the text. The skill explicitly never copies raw passages (see Quality Rule #7). Treat it like handwritten study notes: yours, for personal use.
- Don't redistribute. Publishing or sharing a generated skill of a copyrighted work can infringe the rights holder. Keep skills of third-party books private. Internal docs, your own writing, and openly-licensed material are fine to share within the bounds of their license.
When in doubt, follow the license or terms of the source document. This project is a tool; how you use it is on you.
💖 Sponsors
book-to-skill is free and MIT-licensed, maintained on personal time. If it saves you tokens or study hours, consider sponsoring its upkeep: PR reviews, multilingual fixes, releases, and docs.
Become a sponsor → github.com/sponsors/virgiliojr94
Every sponsor is listed in BACKERS.md. Thank you for keeping open, privacy-first tooling alive. ✨
License
MIT — applies to the converter (code + skill definition) in this repository, not to any book or document you process with it.
