From gjb438c-doc-filler
Pre-fills GJB 438C [08] Software Requirements Specification (.docx) by editing config and project JSON templates. Generates compliant documents via Python scripts.
How this skill is triggered — by the user, by Claude, or both
Slash command
/gjb438c-doc-filler:word-fillter-438c-08The summary Claude sees in its skill listing — used to decide when to auto-load this skill
当用户需要基于 `[08]软件需求规格说明-438C.docx` 模板生成或修改 GJB 438C 软件需求规格说明书时使用本 Skill。
documents/README.mddocuments/[08]软件需求规格说明-438C.docxdocuments/requirements.txtscripts/main.pyscripts/output/[08]软件需求规格说明-438C-filled.docxscripts/process.pyscripts/strict_word_filler/__init__.pyscripts/strict_word_filler/docx_ops.pyscripts/strict_word_filler/errors.pyscripts/strict_word_filler/loader.pyscripts/strict_word_filler/models.pyscripts/strict_word_filler/pipeline.pyscripts/strict_word_filler/template_rules.pytemplates/config.jsontemplates/project.json当用户需要基于 [08]软件需求规格说明-438C.docx 模板生成或修改 GJB 438C 软件需求规格说明书时使用本 Skill。
.docx 模板,不处理 .doccontent 字段和 rows 数组,不得修改模板结构documents/[08]软件需求规格说明-438C.docx:模板文档templates/config.json:封面与标识配置templates/project.json:章节内容、子章节和表格数据scripts/main.py:命令行入口(推荐)scripts/process.py:免参数入口(需将 config/project 放到 scripts/ 目录)templates/config.json 中各字段的 content,填写项目名称、版本、单位、日期等封面信息。templates/project.json 中各章节内容:
placeholders 数组tablesplaceholders,含 subsections(动态章节)和 tables(合格性、追踪表)tablestables.docx 文件,首次在 Word 中打开时刷新目录。config.json 包含 project、document、content 三部分,所有字段只修改 content 值。
| 字段位置 | type | 说明 | content 生成方式 |
|---|---|---|---|
| project.* | original_text | 项目基础信息(名称、版本、单位等) | 直接使用用户输入 |
| document.* | original_text | 文档元信息(编号、标题、日期等) | 直接使用用户输入 |
| content.overview | background_information | 项目概述 | 结合用户描述生成 |
| content.scope | background_information | 项目范围 | 结合用户描述生成 |
| content.features | background_information | 功能特性 | 结合用户描述生成 |
| type | 说明 | content 生成方式 |
|---|---|---|
content_generation | 根据提示生成内容 | 结合 generation_prompt + 用户需求生成 |
text_generation | 文本生成(较简单) | 根据用户描述生成 |
original_text | 原始文本 | 直接使用用户输入 |
静态章节(无 subsections):
{
"id": "1.2",
"name": "系统概述",
"type": "content_generation",
"replacement_pattern": "锚点文本...",
"content": "string"
}
动态章节(有 subsections):
{
"id": "3.2",
"name": "软件能力需求",
"type": "content_generation",
"generation_prompt": "生成子章节的提示...",
"content": "string(摘要)",
"subsections": {
"3.2.1": { "name": "模块名", "content": "string" },
"3.2.2": { "name": "模块名", "content": "string" }
}
}
表格填充:
{
"id": "2",
"tables": [{
"table_id": "reference_documents",
"locator_rows": [["序号", "名称", "版本", "发布日期", "来源"]],
"data_start_row": 1,
"preserve_tail_rows": 0,
"columns": ["number", "name", "version", "release_date", "source"],
"rows": [
{ "number": "1", "name": "...", "version": "...", "release_date": "...", "source": "..." }
]
}]
}
content 字段和 rows 数组id、name、type、columns、replacement_pattern 等模板结构字段subsections 的 key 必须是有效章节编号(如 "3.2.1")rows 中每行的字段必须严格等于 columns 定义
locator_rows严禁修改!locator_rows用于在模板 docx 中定位表格,脚本通过逐行比较单元格文本查找目标表格。 其中的文本必须与模板 docx 中的实际表头文本完全一致,包括标点符号、空格和特殊字符。修改后会导致报错
期望命中 1 张表,实际 0 张。若不确定实际表头文本,用以下脚本提取:
from docx import Document doc = Document("模板文件.docx") for i, table in enumerate(doc.tables): for j, row in enumerate(table.rows[:3]): print(f"Table {i} Row {j}: {[c.text.strip() for c in row.cells]}")
安装依赖(首次):
pip install python-docx>=1.1.0
生成文档(推荐,使用命令行入口):
python scripts/main.py \
--template "documents/[08]软件需求规格说明-438C.docx" \
--config "templates/config.json" \
--project "templates/project.json" \
--output "output/[08]软件需求规格说明-438C-filled.docx"
或使用免参数入口(需先将 config.json 和 project.json 复制到 scripts/ 目录):
cd scripts
python process.py
输出文档路径会打印在控制台。首次在 Word 中打开时,按提示刷新目录。
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cmoments/gjb438c-docskill --plugin gjb438c-doc-filler