{"id":"103ee1b0-d966-45b8-af7f-fc6ed24659f3","slug":"opencode-office-skills","kind":"skill","name":"opencode-office-skills","summary":"符合 OpenCode Agent Skills 规范的 Office 文档自动化编辑技能集（Word / PowerPoint / Excel）","owner":"yigefangbo","repoUrl":"https://github.com/yigefangbo/opencode-office-skills","license":"MIT","licenseTier":"permissive","trust":"community","stars":1,"match":null,"fewStars":true,"format":"skill","createdAt":"2026-09-11T14:26:38.000Z","addedAt":"2026-10-21T11:34:55.681Z","logoUrl":"https://avatars.githubusercontent.com/u/208776510?v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["files-documents"],"tags":["automation","docx","office","opencode","pptx","python","xlsx"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-22T10:36:02.701Z","sample":false,"url":"https://conduits.dev/tools/opencode-office-skills","language":"Python","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# opencode-office-skills\n\n符合 [OpenCode Agent Skills](https://opencode.ai/docs/skills/) 规范的 Office 文档自动化编辑技能集，覆盖 Word / PowerPoint / Excel 三大格式。每个 skill 都是独立目录，包含 `SKILL.md`（agent 使用的说明文档）和可直接执行的 CLI 脚本。\n\n## 技能列表\n\n| Skill | 目标格式 | Python 依赖 | 亮点 |\n|---|---|---|---|\n| [office-docx-editor](office-docx-editor/) | Word `.docx` | python-docx, lxml, matplotlib | 三级策略批量替换（保留格式/超链接）、LaTeX 公式（图片 / OMML 可编辑） |\n| [office-pptx-editor](office-pptx-editor/) | PowerPoint `.pptx` | python-pptx | 跨 Run 批量替换、安全删除幻灯片（清理关系防损坏）、副标题/要点列表填充 |\n| [office-xlsx-editor](office-xlsx-editor/) | Excel `.xlsx` | openpyxl | 9 种图表、服务端公式重算（无需打开 Excel 即可读到计算结果）、智能类型转换 |\n\n## 安装到 OpenCode\n\n将 skill 目录复制到 OpenCode 的 skills 目录即可（任选其一）：\n\n```bash\n# 全局安装（对所有项目生效）\ncp -r office-docx-editor ~/.config/opencode/skills/\n\n# 或项目级安装（仅当前项目生效）\ncp -r office-docx-editor .opencode/skills/\n```\n\n三个 skill 可按需单独安装，互不依赖。\n\n## 依赖\n\n各 skill 的 Python 依赖不同，安装对应 skill 后执行：\n\n```bash\npip install python-docx lxml matplotlib   # docx\npip install python-pptx                   # pptx\npip install openpyxl                      # xlsx\n```\n\n「渲染回看」与「服务端公式重算」（xlsx）为可选增强，依赖系统级 LibreOffice 与 poppler-utils，与 Python 库无关：\n\n```bash\napt install libreoffice poppler-utils     # Debian/Ubuntu\n```\n\n## 快速上手\n\n以 docx 批量替换为例（自动保留格式与超链接，含表格、页眉页脚）：\n\n```bash\npython docx_editor.py replace -i input.docx -o output.docx --old \"旧文字\" --new \"新文字\" --dry-run\n```\n\n以 xlsx 公式重算为例（写入公式缓存值，pandas / `data_only=True` 直接可读）：\n\n```bash\npython xlsx_editor.py write -i input.xlsx -o out.xlsx --cell C2 --value \"=SUM(A2:B2)\"\npython xlsx_editor.py recalc -i out.xlsx -o final.xlsx --strict\n```\n\n每个 skill 的 `SKILL.md` 内含完整功能清单、代码示例、CLI 用法与注意事项。\n\n## 通用设计\n\n- **自动备份**：所有写操作默认创建 `.bak` 备份（`--no-backup` 关闭）\n- **预览不写入**：替换类操作支持 `--dry-run` 预览影响范围\n- **渲染回看**：三个 skill 共享同一套 `render_preview.py`，经 LibreOffice headless → PDF → 逐页 PNG，支持 `--verify` 基础断言，可安全并发\n- **损坏预检**：渲染前校验 OOXML zip 完整性，损坏文件早失败而非产出乱码 PNG\n\n## License\n\nMIT\n"}