Skills Plugins MCP Prompt Model 博客 我的中心
開発 #github #ai #agent

book-to-skill

Converts books and documents (PDF, EPUB, DOCX, HTML, Markdown, plain text, RTF, MOBI/AZW with Calibre) into structured agent skills, extracting frameworks, mental models, principles, techniques, and anti-patterns. Use when the user wants to study a document through GitHub Copilot CLI, Amp, Claude Code, or Hermes Agent, apply an author's frameworks while working, or build a reusable knowledge base from a file.

DeepseekModel キュレーション済みスキル 品質 優秀 · 90 v1.0.0

取得

https://deepseekmodel.com/api/download.php?id=virgiliojr94-book-to-skill-skill-md&format=skill
ダウンロード .skill 標準形式。system_prompt と model_config を収録し、任意の Agent で利用可能
.skill ファイルの system_prompt フィールドの実際の内容。
name book-to-skill description Converts books and documents (PDF, EPUB, DOCX, HTML, Markdown, plain text, RTF, MOBI/AZW with Calibre) into structured agent skills, extracting frameworks, mental models, principles, techniques, and anti-patterns. Use when the user wants to study a document through GitHub Copilot CLI, Amp, Claude Code, or Hermes Agent, apply an author's frameworks while working, or build a reusable knowledge base from a file. Book-to-Skill Converter Transform written knowledge into actionable agent skills by extracting structure — not producing summaries. Philosophy Books contain crystallized expertise: frameworks, principles, and techniques that took years to develop. This skill extracts that knowledge into a format GitHub Copilot CLI, Amp, Claude Code, Hermes Agent, or another compatible agent can leverage repeatedly. Extract structure, not summaries. A skill isn't a book report. It's a toolkit of: Named frameworks (mental models with clear application) Actionable principles (rules that guide decisions) Techniques (step-by-step methods) Anti-patterns (what to avoid and why) Voice calibration (how the author thinks and communicates) Preserve the author's precision. Frameworks often have specific names for reasons. "The 5 Whys" isn't interchangeable with "ask why multiple times." Capture the exact formulation. Layer depth appropriately. Simple books → simple skills. Complex books with 10+ frameworks → skills with reference files and on-demand chapters. Modes of Operation Four paths available. Route based on what the user asks: 1. Full Conversion (Default) Trigger: User provides one or more document/directory/glob paths without special instructions Action: Run all steps below (Steps 0–9) Output: Complete skill with SKILL.md, chapters/, glossary, patterns, cheatsheet 2. Analyze Only Trigger: User says "analyze", "just extract", or "I want to review before generating" Action: Run Steps 0–3, then produce a structured extraction report (frameworks, principles, techniques found). Stop — do NOT generate skill files. Output: Analysis report for user review 3. Generate from Prior Analysis Trigger: User has existing analysis notes or previously ran analyze-only Action: Skip Steps 0–3, use the provided analysis as input, run Steps 4–9 Output: Skill files from the provided analysis 4. Update / Fold-in (Existing Skill) Trigger: User provides one or more new source paths and indicates they want to update an existing skill (either by pointing to the existing skill folder, providing a skill slug that already exists in SKILLS_HOME , or explicitly requesting an update). Action: Run Step 0 (out-of-scope check), Step 1 (validate inputs), Step 1.5 (identify book type), and Step 2 (extract new files). Then skip to Step 5 (identify/detect existing skill path) and run the Update / Fold-in Workflow to merge the new content into the existing skill files. Output: Updated existing skill with new/revised chapter summaries and merged indexes/glossaries. Skill Locations This converter can run from multiple skill systems. When looking for this converter's helper script or writing the generated book skill, prefer these locations in order: GitHub Copilot CLI personal skills: ~/.copilot/skills/ Cross-agent personal skills (Copilot, Amp, Codex): ~/.agents/skills/ Claude Code personal skills: ~/.claude/skills/ Project-local Copilot skills: .github/skills/ Project-local Claude skills: .claude/skills/ Project-local Amp / Copilot skills: .agents/skills/ Amp global skills: ~/.config/agents/skills/ Amp legacy global skills: ~/.config/amp/skills/ Hermes Agent personal skills: $HERMES_HOME/skills/ (defaults to ~/.hermes/skills/ ) Hermes Agent project skills: .hermes/skills/ or .agents/skills/ For generated book skills, prefer the user-level cross-agent root ~/.agents/skills/ — one physical copy serves every supported host. Copilot CLI and Amp discover it natively; Claude Code needs a symlink from ~/.claude/skills/<skill_name> (created in Step 10, see Step 5 for the rules). Pick a host-private or project-local root only when the user asks for one. Step 0 — Out-of-scope check If no arguments are provided, stop and respond: "book-to-skill requires a supported document path, folder, or glob pattern. Usage: book-to-skill <path-to-document-folder-or-glob>... [skill-name-slug] " Throughout the workflow: Identify the input paths and the optional skill slug. If the last argument is not a file, folder, or glob that exists or matches any files, and it looks like a skill slug (e.g. lowercase hyphens, alphanumeric), treat it as SKILL_NAME . Treat all other arguments as the list of INPUT_PATHS . If any input path is an existing skill directory (contains SKILL.md and a chapters/ sub-folder), or if SKILL_NAME matches an existing skill slug in SKILLS_HOME , flag this run as an Update/Fold-in operation (Mode 4). Step 1 — Validate input Verify that there is at least one supported file, directory, or glob pattern among the INPUT_PATHS . For directories and globs, expand them to find matching supported files ( .pdf , .epub , .docx , .txt , .md , .markdown , .rst , .adoc , .html , .htm , .rtf , .mobi , .azw , .azw3 ). If no supported files are found, stop with a clear error message. Step 1.5 — Identify content type Before extracting, ask the user: "What kind of content do these sources have? This helps me choose the best extraction method. Technical — has code blocks, tables, formulas, diagrams (e.g. programming books, academic papers, architecture guides) Text-heavy — mostly prose, few or no tables/code (e.g. management, productivity, narrative non-fiction) Not sure — I'll use the fast method and warn you if quality seems limited" Store the answer as BOOK_TYPE : Option 1 → BOOK_TYPE=technical Option 2 → BOOK_TYPE=text Option 3 → BOOK_TYPE=text If BOOK_TYPE=technical , inform the user before proceeding: "📐 Technical mode selected — using Docling for structure-aware extraction (tables, code blocks, formulas preserved as markdown). This takes ~1.5s per page, so expect a few minutes for longer sources. Starting now…" If BOOK_TYPE=text , inform: "📄 Text mode selected — using the fastest suitable extractor for each file type. Plain text/Markdown/HTML are usually ready in seconds; PDFs use pdftotext when available." Step 2 — Extract text from the source documents Run the extraction script, passing the input paths: SCRIPT_PATH= "" HERMES_HOME_RESOLVED= " ${HERMES_HOME:- $HOME /.hermes} " PROJECT_ROOT= " $(git rev-parse --show-toplevel 2>/dev/null || true) " HERMES_PROJECT_TRUSTED= false if [ -n " $PROJECT_ROOT " ] && [ " ${HERMES_AGENT:-} " = true ] && \ command -v hermes >/dev/null 2>&1 && \ command -v python3 >/dev/null 2>&1 && \ hermes config get skills.trusted_project_dirs --json 2>/dev/null | PROJECT_ROOT= " $PROJECT_ROOT " python3 -c 'import json, os, pathlib, sys; root=pathlib.Path(os.environ["PROJECT_ROOT"]).resolve(); sys.exit(not any(pathlib.Path(p).expanduser().resolve() == root for p in json.load(sys.stdin)))' 2>/dev/null then HERMES_PROJECT_TRUSTED= true fi CANDIDATES=( " $HOME /.copilot/skills/book-to-skill/scripts/extract.py" " $HOME /.agents/skills/book-to-skill/scripts/extract.py" " $HOME /.claude/skills/book-to-skill/scripts/extract.py" " $HERMES_HOME_RESOLVED /skills/book-to-skill/scripts/extract.py" " $HERMES_HOME_RESOLVED " /skills/*/book-to-skill/scripts/extract.py ) if [ " ${HERMES_AGENT:-} " != true ]; then CANDIDATES+=( ".github/skills/book-to-skill/scripts/extract.py" ".claude/skills/book-to-skill/scripts/extract.py" ".agents/skills/book-to-skill/scripts/extract.py" ) fi CANDIDATES+=( " $HOME /.config/agents/skills/book-to-skill/scripts/extract.py" " $HOME /.config/amp/skills/book-to-skill/scripts/extract.py" ) if [ " $HERMES_PROJECT_TRUSTED " = true ]; then CANDIDATES=( " $PROJECT_ROOT /.hermes/skills/book-to-skill/scripts/extract.py" " $PROJECT_ROOT /.hermes/skills" /*/book-to-skill/scripts/extract.py " $PROJECT_ROOT /.agents/skills/book-to-skill/scripts/extract.py" " $PROJECT_ROOT /.agents/skills" /*/book-to-skill/scripts/extract.py " ${CANDIDATES[@]} " ) fi for candidate in " ${CANDIDATES[@]} " do if [ -f " $candidate " ]; then SCRIPT_PATH= " $candidate " break fi done if [ -z " $SCRIPT_PATH " ]; then echo "Could not find scripts/extract.py for book-to-skill" >&2 exit 1 fi PYTHON_BIN= " ${PYTHON_BIN:-python3} " if ! command -v " $PYTHON_BIN " >/dev/null 2>&1; then PYTHON_BIN= "python" fi " $PYTHON_BIN " " $SCRIPT_PATH " $INPUT_PATHS --mode <BOOK_TYPE> --install-missing ask Before extraction, the script checks optional Python packages needed for the detected format. If a better extractor is missing, it prompts the user with the available fallback. Non-interactive sessions default to fallback unless install mode is explicitly yes . Tip — preflight the environment: run "$PYTHON_BIN" "$SCRIPT_PATH" --check to print a per-format report of which extractors are installed and the exact command to install whatever is missing, without processing any file. Useful when a user reports a setup or quality problem. This creates a per-run work directory — <tempdir>/book_skill_work-<pid>/ by default, or exactly the path you set in BOOK_SKILL_WORKDIR — containing: full_text.txt — combined extracted text of all sources with clear visually demarcated boundaries. metadata.json — overall combined size, words, pages, token counts, dropped EPUB image counts, the resolved workdir , and a detailed list of individual processed sources . The run prints all three paths on completion ( Workdir -> , Text -> , Meta -> ). Take the paths from that output (or from metadata.json 's own workdir field) rather than assuming a fixed location — the directory name differs per run so that concurrent extractions on one machine cannot overwrite each other's results. Read that run's metadata.json to inspect the results. Always confirm the extraction is the document you asked for before generating anything: check filename / source_file in metadata.json , or the SOURCE: header on the first line of full_text.txt . If you are waiting on a background run, wait on its specific workdir — polling a shared path can surface a different run's output. Step 2.5 — Pre-flight cost estimate Read this run's metadata.json (the Meta -> path from the extraction output) and present the user with an estimate before doing any generation : 📖 Sources detected: <total_sources> source(s) <list each source filename and format from the sources metadata list> <if images_dropped > 5: warn that N source images were not read> 📄 Combined Pages/Sections: ~<N> | Words: ~<N> | Total tokens: ~<N>K 💰 Estimated token cost (Full Conversion / Update): Input (reading + prompts): ~<N>K tokens Output (skill files generated/updated): ~<N>K tokens Total: ~<N>K tokens Cost: multiply the token counts above by your model's current input/output per-1M-token rates (prices and model names change often — do not hardcode them; quote today's rate and label it as an estimate). ⏱ Estimated time: ~<N> minutes 📁 Files to be generated/updated: SKILL.md + chapter files + glossary + patterns + cheatsheet ➡ Proceed with Full Conversion / Update? (or type "analyze only" to preview first) How to estimate: Input tokens ≈ estimated_tokens from metadata × 1.3 (prompts overhead per chapter pass) Output tokens ≈ chapters × per-chapter budget + 4,000 (SKILL.md) + 4,500 (glossary + patterns + cheatsheet) Per-chapter budget midpoint by BOOK_TYPE (DEPTH is decided later in Step 4 and can raise it): text ≈ 1,000, technical ≈ 1,800. If the user has already indicated reference-only vs deep study, use the matching row of the Step 7 matrix. Cost: report the token counts and multiply by the user's current per-1M-token input/output rates. Do NOT hardcode dollar figures — model names and prices change; if you show one, label it an estimate and date it. Wait for the user to confirm before proceeding. If they say "analyze only", switch to Mode 2. Step 2.6 — REPL-style access for large books (> 50k tokens) Inspired by the Recursive Language Model (RLM) paradigm: treat full_text.txt as a queryable corpus, not a single read. Loading the whole file into context burns budget you will need later for generation. For books over ~50k tokens, prefer programmatic probes over Read(full_text.txt) without bounds: # Size check before any Read wc -w " $FULL_TEXT_PATH " # Find chapter offsets without loading the whole file grep -n -E "^\s*(Chapter|CHAPTER)\s+[0-9]+" " $FULL_TEXT_PATH " | head -40 # Pull only the chapter you need (lines start..end inclusive) sed -n '<start>,<end>p' " $FULL_TEXT_PATH " # Verify a framework is actually mentioned before claiming it in SKILL.md grep -c -i "westrum\|dora" " $FULL_TEXT_PATH " # Targeted Read with offset/limit avoids dumping the full file # Read(file_path=full_text.txt, offset=<line>, limit=<lines>) Use this approach for Step 3 (structure analysis), Step 7 (per-chapter summaries), and Step 8 (glossary / patterns extraction). On books under 50k tokens, a single Read is fine. Why this matters: a 200-page book is ~75k tokens. Re-reading it once per chapter (28 passes) costs ~2M input tokens; using grep + sed to pull only relevant slices keeps generation cost proportional to the output, not the source. Step 3 — Analyze book structure Read the first 8,000 characters of the extracted full_text.txt to identify: Book title and author(s) Chapter structure (look for "Chapter N", "PART I", numbered headings, table of contents) Core themes and subject domain Approximate number of chapters Then read the Table of Contents section if present to map all chapters. If mode is "Analyze Only": produce the extraction report now and stop. Structure: ## Extraction Report — <Title> ### Author's Core Frameworks
このスキルを起動するキーワード。クリックでコピーできます。

このスキルにはトリガーワードがありません。

ダウンロードした .skill に含まれるフィールド。
フィールド 説明
formatフォーマット識別子(skill/v1)
skill_idスキル固有 ID
nameスキル名
versionバージョン
description説明
categoryカテゴリ(配列)
trigger_wordsトリガーワード
tagsタグ
sourceソース
source_urlソース URL(本ページ)
exported_atエクスポート日時(ダウンロード毎)
system_promptシステムプロンプト本文
model_configモデル設定:provider / model / temperature / max_tokens / top_p
examplesサンプル
install_guide各プラットフォームの導入説明(Coze / Dify / Claude / カスタム)
同じスキルを各プラットフォーム形式で出力できます。
.skill 標準形式。system_prompt と model_config を収録し、任意の Agent で利用可能 ダウンロード
.skillpro 拡張形式。scripts / tools / dependencies / hooks を含む ダウンロード
.json 純粋な JSON 出力。system_prompt とモデル設定のみ ダウンロード
Coze frontmatter 付き Markdown。Coze へのインポート用 ダウンロード
Dify Dify DSL。アプリ作成後にそのままインポート ダウンロード

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

验证码 --

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。