Book-PDF:书籍级PDF手册生成器

深度调研一个主题,生成100页+书籍级PDF手册。模块化HTML片段架构 + 语义化版本管理 + 多Agent并行写作 + Playwright渲染PDF。 当用户需要制作完整的PDF手册、电子书、橙皮书、参考指南时触发。即使用户只是说「做一本书」「做个PDF手册」「做个完整指南」「做一本XX的手册」也应触发。...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 12 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The skill's stated purpose (generate 100+ page PDF books) matches the included scripts (build.js, build-pdf.js, update.sh) and templates. Minor inconsistency: registry metadata lists no required binaries/env, but SKILL.md clearly requires Node.js >=16 and Playwright (npm install playwright && npx playwright install chromium). This is expected for the described capability but should be represented in the metadata.
Instruction Scope
Runtime instructions stay within the declared purpose: initialize a project, read design-system.md and local research files, write fragments, merge HTML, and render PDF with Playwright. The SKILL.md does reference an example path (`01-公众号写作/_过程文件/openclaw-guide/`) outside the template that is only advisory; the included scripts do not automatically scan arbitrary system paths. The skill also instructs agents to spawn background research agents (logical workflow) — this is workflow behavior, not hidden I/O, but you should be aware agents will write project files under the chosen project directory.
Install Mechanism
No install spec is provided (instruction-only for the platform). The code relies on the user/environment having Node.js and Playwright installed; there are no remote downloads or archive extraction inside the skill itself. This is low-risk but requires the user to install Playwright (which downloads browser engines when run).
Credentials
The skill requests no credentials, no environment variables, and no special config paths. File I/O is limited to the project directory created by init-project.sh and standard output/versions directories. That level of access is proportionate to building and storing PDFs.
Persistence & Privilege
Skill is not always-enabled and uses normal model invocation. It does not request persistent platform-level privileges or modify other skills. Scripts create files within the chosen project directory only.
Assessment
This skill is internally consistent with its stated purpose, but review and accept these points before installing/using it: - SKILL.md requires Node.js >=16 and Playwright (the registry metadata did not list these) — install those first (npm install playwright && npx playwright install chromium). Playwright will download a browser binary. - The provided scripts will create and write files in the project directory you pass to init-project.sh (do not point it at an existing non-empty directory unless you want files copied there). - The PDF render uses Playwright to open a local file:// HTML page; if your fragments contain remote image or resource URLs, Playwright may fetch external resources during rendering. Avoid embedding sensitive local/remote URLs in fragments if you are concerned about network fetches. - The workflow mentions launching background agents and saving research files into the project — this will create files under the chosen project directory; confirm you are comfortable with the agent writing content there. - As with any third-party templates/scripts, inspect templates/fragments/styles.css/build.js/build-pdf.js/update.sh before running, especially if you will run them in sensitive environments. Overall: coherent and appropriate for a local book/PDF generation tool; no credentials or hidden network endpoints were found, so proceed after the checks above.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
bookvk975t7cgery0f1rnx8cq4wbgmh831gezdocumentationvk975t7cgery0f1rnx8cq4wbgmh831gezlatestvk975t7cgery0f1rnx8cq4wbgmh831gezmanualvk975t7cgery0f1rnx8cq4wbgmh831gezpdfvk975t7cgery0f1rnx8cq4wbgmh831gez

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Book-PDF:书籍级PDF手册全流程

从一个主题到100页+专业PDF。五个阶段:调研 → 规划 → 写作 → 构建 → 版本更新。

前置依赖

  • Node.js >= 16
  • Playwright:npm install playwright && npx playwright install chromium

参考资料导航

需要时读取文件内容
写HTML片段时references/design-system.mdCSS变量、主题、组件HTML速查、视觉红线
新建项目时templates/ 目录可直接复制的骨架文件(build.js/build-pdf.js/update.sh/styles.css)
参考已有项目时01-公众号写作/_过程文件/openclaw-guide/首个实战项目(8 Part、35节、100页+)

项目初始化

用 init 脚本一键创建项目骨架:

bash scripts/init-project.sh <项目目录> <手册标题>
# 示例:bash scripts/init-project.sh ./my-guide "Python完全指南"

自动创建目录结构、复制模板文件、生成 version.json/CHANGELOG.md/PROJECT.md、检查依赖。

项目结构

{项目名}/
├── PROJECT.md          # 项目中枢(大纲+进度+数据速查)
├── styles.css          # 共享CSS(从templates/复制)
├── build.js            # HTML合并脚本(从templates/复制,改FRAGMENT_ORDER)
├── build-pdf.js        # Playwright PDF渲染(从templates/复制)
├── update.sh           # 一键版本更新(从templates/复制)
├── version.json        # {"version":"1.0.0","build":1,"lastUpdate":"","title":""}
├── CHANGELOG.md        # 更新日志
├── fragments/          # 内容片段(纯HTML,不含<html><head>)
│   ├── 00-cover.html / 01-toc.html
│   ├── part{N}-{中文简称}.html
│   ├── appendix.html / 99-backpage.html
├── research/           # 调研资料
├── output/             # {title}-v{version}.html/.pdf
└── versions/           # 历史PDF存档

阶段1:调研

  1. 与用户确定主题和目标读者
  2. 拆分调研维度(6-10个方向)
  3. 启动多个background agent并行调研,每份保存到 {项目目录}/research/YYYY-MM-{关键词}.md
  4. 调研完成后汇总,进入规划

阶段2:规划

编辑项目目录下的 PROJECT.md,包含:

  • 章节大纲表(Part + 节号 + 标题 + 核心内容 + 信息来源)
  • 调研资料索引(路径 + 摘要 + 状态)
  • Agent并行分工方案(关联性强的Part分给同一个agent)
  • 进度追踪表 + 关键数据速查

修改 build.js 中的 FRAGMENT_ORDER。与用户确认大纲后进入写作。

阶段3:写作

多Agent并行,每个agent输出一个HTML片段。

每个写作agent需要:

  1. 读取 references/design-system.md 了解可用组件和片段结构规范
  2. 读取对应调研资料
  3. 输出纯HTML片段(不含 <html><head><style> 标签,只写正文内容)

⚠️ 片段结构铁律(必须在agent prompt中明确告知)

每个正文片段必须遵循以下结构,否则PDF排版会出错:

<div class="content">
<h2 class="section-title page-break" id="partN"><span class="num">§0N</span> 标题</h2>
<p class="section-en">English Title</p>
<p class="section-intro">概述</p>
<!-- 正文 -->
</div>

三条规则:

  • <div class="content"> 包裹 → 控制左右边距(没有它内容顶边)
  • id="partN" 属性 → 目录锚点跳转需要
  • page-break class → 每章从新页开始

目录片段使用 .toc + .toc-item + <a href="#partN"> 结构。详见 design-system.md。

作者信息配置(可选)

封面和尾页支持自定义作者信息,在 version.json 中配置:

{
  "title": "手册标题",
  "author": {
    "name": "作者名称",
    "title": "作者头衔/简介",
    "bio": "详细简介(显示在尾页)",
    "subtitle": "副标题",
    "exclusive": "专属内容说明(封面底部)",
    "qrImage": "二维码图片路径",
    "linkUrl": "链接地址",
    "linkText": "链接文字",
    "social": "社交链接(HTML格式)"
  }
}

封面占位符

  • {{AUTHOR_NAME}} - 作者名称
  • {{AUTHOR_TITLE}} - 作者头衔
  • {{AUTHOR_EXCLUSIVE}} - 专属内容说明

尾页占位符

  • {{BOOK_TITLE}} - 手册标题
  • {{BOOK_SUBTITLE}} - 副标题
  • {{AUTHOR_NAME}} - 作者名称
  • {{AUTHOR_BIO}} - 作者简介
  • {{AUTHOR_QR_IMAGE}} - 二维码图片
  • {{AUTHOR_LINK_URL}} - 链接地址
  • {{AUTHOR_LINK_TEXT}} - 链接文字
  • {{AUTHOR_SOCIAL}} - 社交链接
  • {{VERSION}} - 版本号
  • {{YEAR}} - 年份

详细模板见 design-system.md 和 templates/fragments/

阶段4:构建

node build.js       # 合并片段 → HTML
node build-pdf.js   # Playwright → PDF
# 或一键:
./update.sh build   # 仅构建

阶段5:版本更新

修改 fragments/*.html 后运行:

./update.sh patch "修正某个错误"     # 1.0.0 → 1.0.1
./update.sh minor "更新内容"          # 1.0.0 → 1.1.0
./update.sh major "新增章节"          # 1.0.0 → 2.0.0

自动:更新version.json → 写CHANGELOG → build HTML(版本号注入封面)→ 生成PDF → 备份到versions/

快速启动清单

  1. 确定主题、读者、规模
  2. bash scripts/init-project.sh <目录> <标题> 创建项目
  3. 修改 build.js 的 FRAGMENT_ORDER
  4. 编辑 PROJECT.md(大纲+调研索引+进度)
  5. 多Agent并行调研 → 并行写作 → ./update.sh minor "初版" 构建

Files

9 total
Select a file
Select a file to preview.

Comments

Loading comments…