ebook-converter
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "ebook-converter" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-bd75e9c18b04f9c4de1e79acadf7f61134eb5eaf01ba582ce4181e378d3f48aa. Verify the upstream source and version against https://skillhub.cn/skills/user_1aeb512d/ebook-convert before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Batch-convert e-books to PDF/Word/MOBI formats, with support for custom margins and fonts, and one-click import into the IMA knowledge base.
Introduction source: third_party · user_1aeb512d · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Inputs and outputs
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: ebook-converter
description: 电子书批量转PDF/Word/MOBI,支持自定义边距字体,支持一键导入ima知识库
version: 1.0.0
author: 阿胜
category: productivity
platforms:
- WorkBuddy
- qclaw
- OpenClaw
- Hermes
trigger:
- 电子书转换
- mobi转pdf
- epub转mobi
- azw3转pdf
- 电子书格式转换
- calibre转换
- 把电子书转成pdf
- 上传电子书到知识库
- Calibre书库导入ima
permission:
- 文件系统读取(扫描文件夹)
- 文件系统写入(生成转换后的文件)
- 命令执行(调用Calibre ebook-convert)
dependency:
- Calibre(需提前安装,免费开源)
pricing: 免费
agent_created: trueEbook Converter — 电子书格式转换 + ima 知识库上传
基于 Calibre ebook-convert 命令行工具的批量电子书格式转换 Skill。提供文件夹路径,自动扫描 MOBI/EPUB/AZW3 电子书,按指定规则批量转换为目标格式,输出到源文件同目录。支持将 Calibre 书库或任意文件夹的 PDF 一键导入 ima 知识库。
核心能力
| 能力 | 说明 |
|---|---|
| 🔄 多格式互转 | mobi / epub / azw3 → pdf / docx / mobi / epub / azw3 |
| 🎛️ 自定义排版 | 支持自定义边距 (pt) 和字体大小 (pt) |
| ⏱️ 超时保护 | 单本书转换 10 分钟上限,超时自动终止 |
| 📁 原位输出 | 转换后文件直接放在源文件同目录 |
| ☁️ ima 集成 | 一键将书库 PDF 导入 ima 知识库 |
前置依赖
- Calibre(必须):免费开源的电子书管理工具
- 下载地址:https://calibre-ebook.com/download
- 安装后自动提供
ebook-convert命令行工具
- ima 知识库(可选):仅使用"上传到 ima"功能时需要
使用方法
基础用法
| 你说 | 效果 |
|---|---|
| "把 D:\books 转换一下" | 全部 mobi/epub/azw3 → pdf |
| "把 epub 转成 mobi" | 仅 epub → mobi |
| "帮我把这个文件夹下的 azw3 全转 pdf" | 仅 azw3 → pdf |
| "D:\ebooks 转成 word" | 全部 → docx |
| "D:\novels 转一下,边距40,字体14号" | 全部 → pdf,窄边距大字体 |
ima 上传用法
| 你说 | 效果 |
|---|---|
| "把 Calibre 书库上传到 ima" | 扫描书库 PDF → 列出清单 → 引导导入 |
| "把 D:\ebooks 的 PDF 导入 ima 知识库" | 扫描指定文件夹 → 选择知识库 → 导入 |
执行流程(Part A:格式转换)
Step 1 — 检查 Calibre 安装
Windows 下按以下顺序查找 ebook-convert.exe:
C:\Program Files\Calibre2\ebook-convert.exeC:\Program Files (x86)\Calibre2\ebook-convert.exe- 用
where ebook-convert或which ebook-convert在 PATH 中查找
若均未找到,终止并提示用户安装 Calibre:https://calibre-ebook.com/download
若找到,记录完整路径为 EBOOK_CONVERT 变量。
Step 2 — 解析转换意图
从用户输入中提取以下参数:
| 参数 | 默认值 | 说明 |
|---|---|---|
| 输入格式 | 全部 (mobi, epub, azw3) | 用户可指定,如"只转 epub" |
| 输出格式 | 用户可指定,如"转成 mobi"、"转成 word/docx" | |
| 边距 (pt) | 72 | 用户可说"边距50"、"边距小一点(40)" |
| 字体大小 (pt) | 不使用(保持默认) | 用户可说"字体12号"、"字体大一点" |
| 纸张大小 | a4 | 用户可选 |
输出格式名称映射:
- "pdf" / "PDF" → pdf
- "word" / "docx" / "文档" → docx
- "mobi" → mobi
- "epub" → epub
- "azw3" → azw3
意图解析示例:
| 用户输入 | 输入格式 | 输出格式 |
|---|---|---|
| "把 D:\books 转换一下" | mobi, epub, azw3 | |
| "把 epub 转成 mobi" | epub | mobi |
| "帮我把这个文件夹下的 azw3 全转 pdf" | azw3 | |
| "D:\ebooks 转成 word" | mobi, epub, azw3 | docx |
如果用户没有明确指定文件夹,主动询问文件夹路径。
Step 3 — 扫描目标文件
用 find 或 ls 扫描用户指定的文件夹,找出所有匹配输入格式的文件(大小写不敏感:.mobi .MOBI .epub .EPUB .azw3 .AZW3)。
Windows Git Bash 路径注意:Git Bash 中的 find 输出 Unix 风格路径(如 /c/Users/...),但 ebook-convert.exe 是 Windows 原生程序,需要 Windows 风格路径。转换方式:
# 将 /c/path 转为 C:/path
echo "$path" | sed 's|^/\([a-z]\)/|\U\1:/|'
或直接构造 C:/Users/... 格式的路径(Windows 原生程序兼容正斜杠)。
统计文件数量,向用户报告:
- "在
D:\books找到 3 个 EPUB、5 个 MOBI、2 个 AZW3,共 10 个文件,将全部转换为 PDF。"
Step 4 — 执行批量转换(含超时控制)
核心规则:每本书转换时限 10 分钟。超过 10 分钟未完成则强制终止,标记为失败,继续下一本。
转换命令:
"EBOOK_CONVERT" "input_path" "output_path.pdf" \
--paper-size a4 \
--pdf-page-margin-left 72 \
--pdf-page-margin-right 72 \
--pdf-page-margin-top 72 \
--pdf-page-margin-bottom 72 \
--preserve-cover-aspect-ratio
实现细节:
- 对每本书单独发起一个 Bash 调用,设置
timeout: 600000(10 分钟 = 600000 毫秒) - 若命令在 10 分钟内正常返回且输出文件存在 →
[OK] - 若命令超时被系统终止 →
[FAIL] 超时(超过10分钟),建议用 Calibre 桌面版手动转换 - 若命令返回但输出文件不存在 →
[FAIL] 转换失败 - 若输出文件已存在 →
[跳过] 已有同名文件
不要用 run_in_background 批量转换——逐本同步转换,才能准确控制超时。
EPUB 缺失字体处理:添加 --filter-css "font-family" 可跳过字体引用,避免因缺失字体导致转换失败。
所有文件处理完后给出汇总:成功 N / 失败 N(含超时原因)/ 跳过 N
非 PDF 输出:
当输出格式为 mobi/epub/azw3/docx 时,去掉 --pdf-page-margin-* 参数(这些参数仅对 PDF 有效)。保留 --paper-size 和 --preserve-cover-aspect-ratio。
自定义边距:
将用户指定的边距值(单位 pt)替换到 --pdf-page-margin-* 参数中。如用户说"边距 40",则四个 margin 参数均设为 40。
自定义字体大小:
添加 --base-font-size N 参数(N 为用户指定字号,单位 pt)。注意:此参数对非 PDF/DOCX 输出可能无效,提示用户。
Word(docx) 输出提示: Calibre 生成的 docx 格式排版可能与原书有差异,建议用户用 Word 打开后自行微调。
执行流程(Part B:ima 知识库上传)
当用户表达"把 Calibre 书库/某个文件夹的电子书上传到 ima 知识库"时,执行此流程。
Step B1 — 确定目标文件夹
如果用户提到"Calibre 书库",默认 Calibre 书库路径为 C:\Users\<用户名>\Documents\Calibre Library\。提示用户确认或输入自定义路径。
Step B2 — 获取 ima 知识库列表
调用 mcp__ima-mcp__get_knowledge_base_list 获取当前用户的所有知识库:
参数: params: [{"limit": 50, "type": "KBT_MINE_KB"}]
列出知识库供用户选择目标。如果用户想新建知识库,引导用户在 ima 客户端创建后重新获取列表。
Step B3 — 扫描并准备 PDF
- 用
find扫描目标文件夹下所有 PDF 文件 - 统计 PDF 数量及总大小
- 如果用户原始文件是 mobi/epub/azw3 而非 PDF,先按 Part A 流程转换为 PDF(转换后 PDF 自动存到同目录)
Step B4 — 输出上传清单
当前 ima-mcp 暂不支持通过 API 上传文件,因此生成上传清单供用户操作:
- 列出所有 PDF 文件的完整路径和文件大小
- 提示用户:
- 打开 ima 桌面客户端
- 进入目标知识库
- 将列出的 PDF 文件拖入或点击"导入"批量添加
- 可选:用
start "" "文件路径"打开 PDF 所在文件夹方便用户操作
汇总格式:
📚 待上传 PDF 清单(目标知识库:xxx)
- D:\Calibre Library\Author\Book1.pdf (2.3MB)
- D:\Calibre Library\Author\Book2.pdf (1.8MB)
共 N 本,总计 X MB
👉 请打开 ima 客户端 → 进入「xxx」知识库 → 将以上文件拖入即可
已知限制
| 限制 | 说明 |
|---|---|
| 仅 Windows | 当前 Calibre 路径检测仅覆盖 Windows |
| 超大体量书籍 | 章节 > 1000 的网文可能超时,建议用 Calibre 桌面版 |
| ima 上传 | ima-mcp 暂无上传 API,需手动拖入 ima 客户端 |
| docx 排版 | Calibre 生成的 docx 格式可能与原书有排版差异 |
参考:ebook-convert 常用参数
| 参数 | 说明 |
|---|---|
--paper-size a4 |
纸张大小 (a4/letter/legal 等) |
--pdf-page-margin-left/right/top/bottom N |
PDF 页边距 (pt) |
--base-font-size N |
基础字号 (pt) |
--preserve-cover-aspect-ratio |
保留封面宽高比 |
--pdf-default-font-size N |
PDF 默认字号 |
--pdf-mono-font-size N |
PDF 等宽字体大小 |
--filter-css "font-family" |
跳过 CSS 中的字体引用规则 |
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 电子书格式转换是高频刚需场景
- 支持批量处理+自定义排版+超时保护等实用特性
- 集成 ima 知识库上传形成完整使用闭环
Highlights
- 触发词覆盖全面,包含核心动作、常见格式组合和口语化表达
- 边界清晰,无明显歧义或重叠风险
Areas to improve
-
description 重复定义 Reported severity: Minor
顶层 frontmatter 和 skill_body 内部均定义了 description,内容一致但属冗余
Recommendation: 建议保留一处即可,避免维护不一致风险
Highlights
- Phase/步骤清晰,Part A/B 分流程设计合理
- 含端到端示例和意图解析,用户易理解
- frontmatter 完整,单文件长度适中
Areas to improve
-
部分参数说明可更详细 Reported severity: Minor
--filter-css 参数的具体作用和适用场景说明较简略
Recommendation: 建议补充该参数的使用场景和注意事项
Highlights
- 工具来源明确(Calibre 官方),参数使用准确
- 异常覆盖全面:超时控制、路径兼容、文件检查等
- 不可逆操作有确认机制,依赖声明清晰
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- calibre-ebook.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.