← 返回 Skills 市场
书籍生成器 (
内容优化器 (
素材搜索器 (
配置文件 (
834
总下载
0
收藏
3
当前安装
1
版本数
在 OpenClaw 中安装
/install book-writer
功能描述
使用AI辅助写作的OpenClaw技能,可以根据提示词生成书籍大纲并逐级扩写内容,支持添加公式、图表、代码等元素。适用于学术著作、技术书籍、小说等多种类型的创作。
使用说明 (SKILL.md)
OpenClaw 智能写书技能
这是一个功能完整的AI辅助写作技能,能够根据用户提供的提示词生成书籍大纲,并逐级扩写各章节内容,支持在内容中插入公式、图表、表格和代码等元素。
功能特性
📚 大纲生成能力
- 智能大纲生成: 根据提示词自动生成结构化书籍大纲
- 多层级结构: 支持章节、小节、子小节等多级结构
- 内容规划: 为每个章节提供内容概要和要点
- 风格适配: 根据书籍类型调整大纲结构
✍️ 内容扩写能力
- 逐级扩写: 从章节标题逐步扩展到具体内容
- 内容丰富: 自动添加公式、图表、表格、代码等元素
- 引用管理: 自动生成并管理文献引用
- 格式规范: 遵循学术或出版格式规范
🧩 多媒体支持
- 数学公式: LaTeX格式的数学公式插入
- 图表生成: 根据内容需求生成图表描述
- 代码片段: 支持多种编程语言的代码插入
- 表格设计: 结构化表格的创建和填充
📖 类型适配
- 学术著作: 符合学术写作规范
- 技术书籍: 包含代码示例和技术图表
- 小说创作: 支持情节发展和人物描写
- 教科书: 包含练习题和知识点总结
快速开始
1. 安装技能
# 进入技能目录
cd book-writer
# 安装依赖
python scripts/install_dependencies.py
2. 设置API密钥
# 设置环境变量
export OPENAI_API_KEY="your_openai_api_key"
export GOOGLE_CSE_ID="your_google_cse_id" # 用于搜索素材
export GOOGLE_API_KEY="your_google_api_key" # 用于搜索素材
3. 生成第一本书
# 生成大纲
python scripts/book_writer.py --action outline --prompt "机器学习入门教程"
# 扩写前三章
python scripts/book_writer.py --action expand --book-path "ml_intro_tutorial" --chapters 1,2,3
核心组件
书籍生成器 (scripts/book_writer.py)
主生成模块,负责协调整个书籍生成流程。
主要功能:
- 解析用户提示词
- 生成书籍大纲
- 逐级扩写内容
- 管理多媒体元素
使用方法:
from scripts.book_writer import BookWriter
writer = BookWriter()
# 生成大纲
outline = writer.generate_outline("深度学习理论与实践")
# 扩写内容
book = writer.expand_book(outline, max_chapters=3)
# 保存书籍
writer.save_book(book, "deep_learning_book")
内容优化器 (scripts/content_optimizer.py)
优化生成的内容质量。
主要功能:
- 语法和风格优化
- 引用和参考文献管理
- 公式和代码验证
- 图表描述生成
素材搜索器 (scripts/material_searcher.py)
从网络搜索相关素材。
主要功能:
- 根据内容需求搜索图片
- 查找相关数据和统计信息
- 搜索代码示例
- 获取引用文献
配置说明
配置文件 (config.yaml)
# API配置
openai:
api_key: ${OPENAI_API_KEY}
model: gpt-4o
max_tokens: 4000
temperature: 0.7
# 搜索API配置
google:
cse_id: ${GOOGLE_CSE_ID}
api_key: ${GOOGLE_API_KEY}
# 书籍生成默认参数
defaults:
max_chapters: 10
max_sections_per_chapter: 5
content_length: "medium" # short, medium, long
include_formulas: true
include_code: true
include_figures: true
include_tables: true
# 存储设置
storage:
output_dir: "generated_books"
temp_dir: "temp_files"
max_storage_gb: 10
使用示例
示例1:生成技术书籍大纲
python scripts/book_writer.py --action outline --prompt "Python Web开发实战指南" --output my_web_dev_book
示例2:扩写指定章节
python scripts/book_writer.py --action expand --book-path my_web_dev_book --chapters 1,2,3 --include-code true
示例3:生成学术著作
python scripts/book_writer.py --action full --prompt "量子计算基础理论" --chapters 3 --include-formulas true --citation-style "apa"
部署到OpenClaw
将整个 book-writer 目录复制到 OpenClaw 的技能目录中即可使用。
许可证
本技能使用MIT许可证。详见项目根目录的LICENSE文件。
安全使用建议
This package mostly does what its description says (uses OpenAI for text generation and Google CSE for finding materials), but there are mismatches you should be aware of:
- The registry claims no required env vars and 'instruction-only', but the files and SKILL.md clearly require OPENAI_API_KEY, GOOGLE_CSE_ID and GOOGLE_API_KEY and include Python scripts and an installer. Treat it as a code-based skill, not instruction-only.
- The included install script will pip install packages from PyPI (network activity and changes to your Python environment). Run it in a virtualenv or isolated environment if you proceed.
- The skill will create output, temp, and logs directories and write files (generated_books, temp_files, logs/book_writer.log). If you are concerned about file writes, run it in a disposable directory or container.
- Verify and limit the API keys you provide (use least-privilege keys, billing/quotas, and revoke if unsure). Consider using separate accounts or API quotas for testing.
- There are a few code issues (e.g., one loader references yaml in material_searcher without importing yaml) — the package has bugs and may fail in places; review the code before trusting with sensitive keys.
- If you require higher assurance, request the skill author/source or run the scripts in an isolated VM/container and inspect network traffic during a test run.
功能分析
Type: OpenClaw Skill
Name: book-writer
Version: 1.0.0
The skill is classified as suspicious due to two significant vulnerabilities. The `scripts/book_writer.py` file contains a path traversal vulnerability in its `save_book` function, where the output directory name (derived from user input or LLM output) is directly used to construct a file path without sanitization, potentially allowing arbitrary file writes outside the intended `generated_books` directory. Additionally, `scripts/install_dependencies.py` uses `subprocess.run(cmd, shell=True)`, which, while currently used with hardcoded commands, presents a shell injection risk if user-controlled input were ever passed to it.
能力评估
Purpose & Capability
The code and SKILL.md match the stated purpose (generate outlines, expand chapters, insert formulas/figures, search materials). Required capabilities (OpenAI for generation, Google Custom Search for material lookup) are coherent with the described features.
Instruction Scope
SKILL.md and scripts instruct the runtime to use OPENAI_API_KEY, GOOGLE_CSE_ID and GOOGLE_API_KEY; generate and write book files to generated_books; create temp and logs directories; and perform network requests to Google and OpenAI. These are expected for the feature set, but SKILL.md and scripts also assume certain local paths (logs/, temp_files/, generated_books/, assets/templates) and the test script checks for assets/templates which is not present in the manifest — the instructions have scope assumptions that don't match the packaged files.
Install Mechanism
No formal install spec in registry, but an included install_dependencies.py script will pip install packages from PyPI (openai, requests, pyyaml, etc.). That is a normal install method but requires network access and will modify the Python environment; there is no download from unknown servers or archives.
Credentials
Registry metadata declares no required environment variables, yet SKILL.md and multiple scripts require and check OPENAI_API_KEY, GOOGLE_CSE_ID and GOOGLE_API_KEY. Requesting exactly those three keys is proportionate to the stated functionality, but the metadata omission is inconsistent and could mislead users into granting keys without realizing they are required.
Persistence & Privilege
The skill does not request always:true and does not modify other skills or global agent settings. It writes logs and output files in its own directories (generated_books, temp_files, logs) which is expected for this type of tool.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install book-writer - 安装完成后,直接呼叫该 Skill 的名称或使用
/book-writer触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the "book-writer" skill for OpenClaw.
- Supports AI-assisted generation of book outlines and hierarchical content expansion based on user prompts.
- Enables insertion of formulas, charts, tables, and code for enhanced book content.
- Adapts output for various types including academic, technical, fiction, and textbooks.
- Includes modules for content optimization and searching reference materials.
- Provides configurable options and step-by-step usage instructions for book creation and extension.
元数据
常见问题
Book Writer 是什么?
使用AI辅助写作的OpenClaw技能,可以根据提示词生成书籍大纲并逐级扩写内容,支持添加公式、图表、代码等元素。适用于学术著作、技术书籍、小说等多种类型的创作。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 834 次。
如何安装 Book Writer?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install book-writer」即可一键安装,无需额外配置。
Book Writer 是免费的吗?
是的,Book Writer 完全免费(开源免费),可自由下载、安装和使用。
Book Writer 支持哪些平台?
Book Writer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Book Writer?
由 pyjhhh(@pyjhhh)开发并维护,当前版本 v1.0.0。
推荐 Skills