skill
opencode-office-skills
符合 OpenCode Agent Skills 规范的 Office 文档自动化编辑技能集(Word / PowerPoint / Excel)
Set up
Skills are installed by placing their folder where your agent loads skills.
The download comes from github.com/yigefangbo/opencode-office-skills itself, not from our server, so what you get is exactly what its author published.
Install instructions come from the README
README
synced Oct 22, 2026opencode-office-skills
符合 OpenCode Agent Skills 规范的 Office 文档自动化编辑技能集,覆盖 Word / PowerPoint / Excel 三大格式。每个 skill 都是独立目录,包含 SKILL.md(agent 使用的说明文档)和可直接执行的 CLI 脚本。
技能列表
| Skill | 目标格式 | Python 依赖 | 亮点 |
|---|---|---|---|
| office-docx-editor | Word .docx | python-docx, lxml, matplotlib | 三级策略批量替换(保留格式/超链接)、LaTeX 公式(图片 / OMML 可编辑) |
| office-pptx-editor | PowerPoint .pptx | python-pptx | 跨 Run 批量替换、安全删除幻灯片(清理关系防损坏)、副标题/要点列表填充 |
| office-xlsx-editor | Excel .xlsx | openpyxl | 9 种图表、服务端公式重算(无需打开 Excel 即可读到计算结果)、智能类型转换 |
安装到 OpenCode
将 skill 目录复制到 OpenCode 的 skills 目录即可(任选其一):
# 全局安装(对所有项目生效)
cp -r office-docx-editor ~/.config/opencode/skills/
# 或项目级安装(仅当前项目生效)
cp -r office-docx-editor .opencode/skills/
三个 skill 可按需单独安装,互不依赖。
依赖
各 skill 的 Python 依赖不同,安装对应 skill 后执行:
pip install python-docx lxml matplotlib # docx
pip install python-pptx # pptx
pip install openpyxl # xlsx
「渲染回看」与「服务端公式重算」(xlsx)为可选增强,依赖系统级 LibreOffice 与 poppler-utils,与 Python 库无关:
apt install libreoffice poppler-utils # Debian/Ubuntu
快速上手
以 docx 批量替换为例(自动保留格式与超链接,含表格、页眉页脚):
python docx_editor.py replace -i input.docx -o output.docx --old "旧文字" --new "新文字" --dry-run
以 xlsx 公式重算为例(写入公式缓存值,pandas / data_only=True 直接可读):
python xlsx_editor.py write -i input.xlsx -o out.xlsx --cell C2 --value "=SUM(A2:B2)"
python xlsx_editor.py recalc -i out.xlsx -o final.xlsx --strict
每个 skill 的 SKILL.md 内含完整功能清单、代码示例、CLI 用法与注意事项。
通用设计
- 自动备份:所有写操作默认创建
.bak备份(--no-backup关闭) - 预览不写入:替换类操作支持
--dry-run预览影响范围 - 渲染回看:三个 skill 共享同一套
render_preview.py,经 LibreOffice headless → PDF → 逐页 PNG,支持--verify基础断言,可安全并发 - 损坏预检:渲染前校验 OOXML zip 完整性,损坏文件早失败而非产出乱码 PNG
License
MIT