[ PROMPT_NODE_22458 ]
section-splitting
[ SKILL_DOCUMENTATION ]
# 章节文件编写
使用**并行子智能体**从计划中编写各个章节文件,以提高效率。
此步骤假设 `sections/index.md` 已经存在。
## 输入文件
- `/claude-plan.md` - 实现细节
- `/sections/index.md` - 章节定义和依赖关系
## 输出
/sections/
├── index.md (已存在)
├── section-01-.md
├── section-02-.md
└── ...
## 并行执行策略
**在单条消息中为每个章节启动一个子智能体**以实现最大并行化:
┌─────────────────────────────────────────────────────┐
│ 并行子智能体方法 │
│ │
│ 1. 解析 index.md 获取 SECTION_MANIFEST 列表 │
│ 2. 检查哪些章节已经存在 │
│ 3. 将所有缺失的章节作为并行任务启动: │
│ │
│ Task(prompt="编写 section-01-...") │
│ Task(prompt="编写 section-02-...") │
│ Task(prompt="编写 section-03-...") │
│ ... (全部在一条消息中) │
│ │
│ 4. 等待所有子智能体完成 │
│ │
└─────────────────────────────────────────────────────┘
### 解析 SECTION_MANIFEST
从 index.md 中提取章节列表:
markdown
### 启动并行任务
对于清单中的每个章节,在单条消息中包含一个任务:
python
Task(
subagent_type="general-purpose",
prompt="""
编写章节文件: section-01-foundation
输入:
- /claude-plan.md
- /sections/index.md
输出: /sections/section-01-foundation.md
要求: [见下方的章节文件模板]
"""
)
Task(
subagent_type="general-purpose",
prompt="编写章节文件: section-02-config ..."
)
# ... 每个章节一个任务
**为什么并行?** 每个章节都是独立的 - 它们都从相同的源文件 (`claude-plan.md`, `index.md`) 读取,但写入不同的输出文件。
### 恢复处理
如果某些章节已经存在:
1. 仅为缺失的章节启动任务
2. 跳过已有对应 `section-*.md` 文件的章节
## 章节文件要求
**关键: 每个章节