← Back to Skills Marketplace
shixiangyu2

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

by ShiXiangYu2 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
112
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install huashu-book-pdf
Description
深度调研一个主题,生成100页+书籍级PDF手册。模块化HTML片段架构 + 语义化版本管理 + 多Agent并行写作 + Playwright渲染PDF。 当用户需要制作完整的PDF手册、电子书、橙皮书、参考指南时触发。即使用户只是说「做一本书」「做个PDF手册」「做个完整指南」「做一本XX的手册」也应触发。...
README (SKILL.md)

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

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

前置依赖

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

参考资料导航

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

项目初始化

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

bash scripts/init-project.sh \x3C项目目录> \x3C手册标题>
# 示例: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,不含\x3Chtml>\x3Chead>)
│   ├── 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片段(不含 \x3Chtml>\x3Chead>\x3Cstyle> 标签,只写正文内容)

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

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

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

三条规则:

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

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

品牌水印(封面+尾页必须包含)

所有PDF手册的封面和尾页必须包含以下品牌信息:

封面

  • 作者:\x3Cdiv class="cover-author">\x3Cstrong>蒲公英\x3C/strong>\x3Cbr>公众号「AI编程蒲公英」· B站「AI编程程序猿-蒲公英」\x3C/div> \x3C!-- - 专属标识:\x3Cdiv class="cover-exclusive">知识星球「AI编程:从入门到精通」专属内容\x3C/div> -->

尾页(class必须是 back-page,带连字符): \x3C!-- - 知识星球二维码:\x3Cimg src="../../知识星球/zsxq-qrcode.jpg"> --> \x3C!-- - 知识星球链接:https://wx.zsxq.com/group/48888144124288 -->

  • 社交链接:B站 https://space.bilibili.com/3493114559858979/ · 公众号「AI编程蒲公英」
  • 详细模板见 design-system.md 和 templates/fragments/99-backpage.html

阶段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 \x3C目录> \x3C标题> 创建项目
  3. 修改 build.js 的 FRAGMENT_ORDER
  4. 编辑 PROJECT.md(大纲+调研索引+进度)
  5. 多Agent并行调研 → 并行写作 → ./update.sh minor "初版" 构建
Usage Guidance
This skill is generally coherent for producing book‑style PDFs with Node + Playwright, but review a few things before you run it: - Requirements: you need Node >=16 and Playwright (npm install playwright + npx playwright install chromium). The scripts will create files and run local Node scripts. - External network: the CSS imports Google Fonts and Playwright will load any remote resources referenced in your fragments (images, fonts, CSS). If you want to avoid leaking build metadata or making external requests, run Playwright in a network‑restricted environment or remove external URLs from templates. - Local file reads: the SKILL.md references an example path outside the template (01-公众号写作/_过程文件/openclaw-guide/) and some fragment image paths point outside the project. Confirm the agents or tooling will only read the project folder you create, and not arbitrary host paths you don't intend to expose. - Forced branding: templates and design-system require specific author/branding content in cover/backpage — check and modify these if you don't want that text/links in generated PDFs. - Safe practice: inspect templates (build.js, build-pdf.js, update.sh, init-project.sh) yourself (they are small and readable), run the tooling in an isolated VM/container with limited network access, and do not place sensitive research materials in the project if you worry about remote requests from rendering. Given these caveats (local file path references and outbound resource loads), proceed only after verifying/adjusting templates and build environment.
Capability Analysis
Type: OpenClaw Skill Name: huashu-book-pdf Version: 1.0.0 The skill bundle provides a legitimate framework for generating professional PDF books using a modular HTML-to-PDF workflow. The included shell scripts (init-project.sh, update.sh) and Node.js scripts (build.js, build-pdf.js) are standard automation tools for project scaffolding, version management, and rendering via Playwright. No evidence of data exfiltration, unauthorized network access, or malicious prompt injection was found; the branding requirements and instructions are transparently aligned with the stated purpose of creating structured documentation.
Capability Assessment
Purpose & Capability
Name/description match the included scripts and templates: init-project.sh, build.js, build-pdf.js and update.sh implement a research→write→merge→Playwright→PDF workflow. Declared runtime deps (Node.js, Playwright) are appropriate. The requirement to include specific brand/author info is part of the claimed output, so it's coherent though opinionated.
Instruction Scope
SKILL.md instructs agents to read local files (references/design-system.md and project research files) and even points to an external example path '01-公众号写作/_过程文件/openclaw-guide/' outside the template — this could prompt the agent to read arbitrary local paths if implemented verbatim. Fragments may include remote resources (fonts via Google Fonts @import, external images/links). The skill also mandates embedding specific branding/links in cover/backpage, which changes generated outputs automatically.
Install Mechanism
No installer or external downloads are bundled; the skill is instruction + local scripts only. Users must have Node >=16 and install Playwright themselves. This is the low-risk pattern (no remote install URLs or archive extraction).
Credentials
The skill requests no environment variables or credentials. However, build/render steps implicitly perform network requests (Google Fonts in CSS, any external image/CSS referenced in fragments). These are reasonable for rendering but can leak requests to third parties if fragments include remote URLs. Also templates reference relative paths to QR images (e.g., '../../知识星球/zsxq-qrcode.jpg') which may point outside the project.
Persistence & Privilege
always:false and no code attempts to modify other skills or global agent settings. Scripts operate within the created project directory and write standard files (version.json, CHANGELOG, output/versions). No elevated persistence or system-wide changes observed.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install huashu-book-pdf
  3. After installation, invoke the skill by name or use /huashu-book-pdf
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
初始版本发布:深度调研一个主题,生成100页+书籍级PDF手册。包含模块化HTML片段架构、语义化版本管理、多Agent并行写作、Playwright渲染PDF等功能。
Metadata
Slug huashu-book-pdf
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

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

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

How do I install Book-PDF: 书籍级PDF手册全流程?

Run "/install huashu-book-pdf" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

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

Yes, Book-PDF: 书籍级PDF手册全流程 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Book-PDF: 书籍级PDF手册全流程 support?

Book-PDF: 书籍级PDF手册全流程 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

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

It is built and maintained by ShiXiangYu2 (@shixiangyu2); the current version is v1.0.0.

💬 Comments