office-docs
用 python-docx / python-pptx / openpyxl 生成和修改 Office 文档(Word .docx、PPT .pptx、Excel .xlsx)。凡是要"写一份 Word/PPT/Excel""做汇报材料/纪要/名单模板/表格"的任务都用它。沙箱镜像已内置这三个库。
- License 许可
- MIT
- 所属仓库
- irisfeng/moqi
- 最近更新
- 2026-11-05
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- office-docs
- description
- 用 python-docx / python-pptx / openpyxl 生成和修改 Office 文档(Word .docx、PPT .pptx、Excel .xlsx)。凡是要"写一份 Word/PPT/Excel""做汇报材料/纪要/名单模板/表格"的任务都用它。沙箱镜像已内置这三个库。
03 SKILL.md 正文
办公文档生成(Word / PPT / Excel)
写一段 python 脚本在沙箱里生成文档,文件放当前工作区,回复里给出文件名和一行内容概要。 不要把文件内容整段贴进回复,除非对方明确要求。
选库
| 目标 | 库 | 要点 |
|---|---|---|
| Word | python-docx | 纪要、方案、通知、报告 |
| PPT | python-pptx | 汇报、框架、评审材料 |
| Excel | openpyxl | 名单、模板、带公式的小工具 |
中文排版约定
- 正文字体统一设 宋体,标题用 微软雅黑:python-docx 里对每个 run 设
run.font.name并run._element.rPr.rFonts.set(qn('w:eastAsia'), '宋体'); python-pptx 设font.name即可。 - 标题层级:文档题目一级,章节二级,不再更深。
- Word 页边距默认即可;段落
space_after = Pt(6)比较接近中文办公习惯。 - PPT 每页一个观点,标题 ≤ 18 字,正文 ≤ 6 条;用
Presentation()默认 16:9。 - Excel 表头加粗、冻结首行(
ws.freeze_panes = "A2"),列宽按内容估(中文一字约 2 个宽度单位)。
生成后
- 文件写到当前工作区相对路径(如
项目例会纪要.docx)。 - 用
ls -la确认生成成功、大小正常(.docx 通常 >6KB,明显小于此多为空文档)。 - 交付给用户(按会话类型):一对一
cp 文件名 "$AGENT_OUTBOX/",回合结束自动作为附件出现在聊天里;群 / 频道里 outbox 不生效——文件放普通工作区路径,发消息时在 post 的files参数里带上。修改已有文件的场景同样要重新交付新版本。命名与话术统一见 artifact-delivery 技能。 - 回复一句话:文件名 + 里面有什么(几个章节/几页/几个 sheet)。
不要用 write 工具的 share 参数把文件"发给"当前用户——那只会出现在对方的「文件」页,聊天里没有任何提示,对方会以为没收到。share 只用于把文件共享给别的范围(如项目/组织)。
常见坑
openpyxl公式写入用英文等号开头(=SUM(B2:B10)),保存后首次打开才计算。- 修改已有 .docx:
Document(path)打开改完原路保存;不要试图"追加写"二进制。 - 需要"再改一版"时,基于工作区里的上一个版本改,不要凭记忆重写全文。
04 同仓库更多 Skills
use-shared-credential
When you need to call a service the org has a SHARED credential for (a SERP/search key, a paid-API key, a data-vendor feed, a Git remote) — and the platform has told you that credential is available to this conversation — make the call BY PROXY through the credential broker. You never see the secret; the core stamps it onto the outbound request for you.
ui-state
See what the person is looking at in the QM web UI right now — the whole page (sidebar, every multiview pane, open dialogs) as raw HTML, the app's state as JSON, optionally the CSS and a screenshot. Use when they ask about something on their screen, want help with the UI, or you need to check what a canvas you wrote actually rendered.
ui-canvas
Draw your own HTML/CSS/JS as a full-window overlay on top of the QM web UI — a dashboard, a form, a visualization, controls that message you back. Write, update, replace, pin or dismiss it. Use when an interactive or visual result beats a chat reply.
taste-skill
Design taste and process for anything a person will look at in a browser — landing page, dashboard, prototype, deck. The default design driver for a browsable artifact, with an anti-slop playbook for the visual language.
slack-drafts
Create Slack message drafts in the user's own composer, as the user, through their per-user Slack OAuth. Drafting only — the user reviews and sends from Slack.
send
Make a PR, wait for CI with bounded transport retries, independently review, and merge only when all gates pass.