Skip to main content
ClaudeWave
Skill990 repo starsupdated today

office-docx

The office-docx skill provides Python-based scripting tools to programmatically create, edit, append to, and validate Word `.docx` files with support for structured content blocks, tables, images, comments, and tracked changes. Use this skill when users need to generate business documents like briefs, reports, forms, or checklists from specifications, convert Markdown to Word format, prepare documents for Google Docs import, manage document redlines and comments, or verify accessibility and formatting in existing Word files.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/shiwenwen/hope-agent /tmp/office-docx && cp -r /tmp/office-docx/skills/office-docx ~/.claude/skills/office-docx
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Office DOCX

Use the bundled scripts in this skill package to produce editable `.docx`
files. The builder writes deterministic OOXML with real Word numbering,
tables, images with alt text, comments, and tracked changes. The skill
activation metadata includes `Skill directory`; treat that as `SKILL_DIR` and
run scripts from `SKILL_DIR/scripts/`.

## Workflow

1. Decide the document archetype: brief, proposal, SOP, form, checklist,
   report, memo, or reference guide.
2. Create a JSON spec in the working directory. Use semantic blocks:
   `heading`, `paragraph`, `bullet_list`, `numbered_list`, `table`, `callout`,
   `image`, `comment`, `revision`, and `page_break`.
3. For a new document, run:

```bash
python3 "$SKILL_DIR/scripts/check_env.py"
python3 "$SKILL_DIR/scripts/build_docx.py" --spec spec.json --out output.docx
python3 "$SKILL_DIR/scripts/inspect_docx.py" --verify output.docx
python3 "$SKILL_DIR/scripts/a11y_audit.py" output.docx
```

4. To append to an existing document, use a spec containing only the new
   `blocks`, then run:

```bash
python3 "$SKILL_DIR/scripts/append_docx.py" --input existing.docx --spec append.json --out output.docx
python3 "$SKILL_DIR/scripts/inspect_docx.py" --verify output.docx
```

5. To convert a Markdown draft directly:

```bash
python3 "$SKILL_DIR/scripts/markdown_to_docx.py" --markdown draft.md --out output.docx
python3 "$SKILL_DIR/scripts/inspect_docx.py" --verify output.docx
```

6. For Google Docs-targeted output, sanitize before render/import:

```bash
python3 "$SKILL_DIR/scripts/google_docs_title_sanitize.py" output.docx --out sanitized.docx
python3 "$SKILL_DIR/scripts/google_docs_title_sanitize.py" sanitized.docx --check
```

Use `sanitized.docx` for preview rendering and native Google Docs import.

7. For redline/comment work, use `comment` blocks or `revision` blocks:

```json
{"type": "comment", "target": "This sentence needs support.", "comment": "Add source."}
{"type": "revision", "delete": "old wording", "insert": "new wording"}
```

8. For delivery cleanup, use the focused helpers:

```bash
python3 "$SKILL_DIR/scripts/comments_strip.py" commented.docx --out no-comments.docx
python3 "$SKILL_DIR/scripts/comments_extract.py" commented.docx
python3 "$SKILL_DIR/scripts/add_tracked_replacements.py" --input input.docx --spec replacements.json --out redlined.docx
python3 "$SKILL_DIR/scripts/accept_tracked_changes.py" redlined.docx --mode accept --out accepted.docx
python3 "$SKILL_DIR/scripts/redact_docx.py" input.docx redacted.docx --emails --phones
python3 "$SKILL_DIR/scripts/privacy_scrub_metadata.py" input.docx --out scrubbed.docx
python3 "$SKILL_DIR/scripts/compare_docx.py" before.docx after.docx
```

9. For advanced Word structure tasks, use the focused OOXML helpers:

```bash
python3 "$SKILL_DIR/scripts/insert_toc.py" input.docx --out with-toc.docx
python3 "$SKILL_DIR/scripts/fields_report.py" with-toc.docx
python3 "$SKILL_DIR/scripts/insert_note.py" input.docx --kind footnote --text "Source note" --out with-note.docx
python3 "$SKILL_DIR/scripts/watermark_add.py" input.docx --text "DRAFT" --out watermarked.docx
python3 "$SKILL_DIR/scripts/watermark_audit_remove.py" watermarked.docx
python3 "$SKILL_DIR/scripts/set_protection.py" input.docx --mode readOnly --out protected.docx
python3 "$SKILL_DIR/scripts/content_controls.py" input.docx --spec controls.json --out form.docx
python3 "$SKILL_DIR/scripts/internal_nav.py" input.docx --spec nav.json --out linked.docx
python3 "$SKILL_DIR/scripts/merge_docx_append.py" --input a.docx --input b.docx --out merged.docx
python3 "$SKILL_DIR/scripts/docx_table_to_csv.py" input.docx --out-dir tables
```

10. If visual QA matters and LibreOffice is available, render previews:

```bash
python3 "$SKILL_DIR/scripts/render_preview.py" output.docx
```

11. Deliver the `.docx` path or attach it with `send_attachment`.

## Spec Shape

```json
{
  "title": "Document title",
  "subtitle": "Optional subtitle",
  "blocks": [
    {"type": "heading", "level": 1, "text": "Section"},
    {"type": "paragraph", "text": "Body copy."},
    {"type": "bullet_list", "items": ["Point one", {"text": "Point two", "comment": "Verify"}]},
    {"type": "image", "path": "chart.png", "alt": "Revenue trend chart", "caption": "Figure 1. Revenue trend", "width_inches": 5.5, "height_inches": 3.2},
    {"type": "revision", "delete": "Old sentence.", "insert": "Improved sentence."},
    {"type": "table", "headers": ["Metric", "Value"], "rows": [["ARR", "$1.2M"]]}
  ]
}
```

## Quality Bar

- Keep documents editable: use semantic headings, real Word lists, comments,
  tracked changes, images with alt text, and real tables.
- Run `a11y_audit.py` before delivery; fix hard issues such as fake bullets,
  missing image alt text, empty documents, and structural defects.
- Do not overuse tables for normal prose.
- Avoid dense walls of text unless the document type demands it.
- For Google Docs-targeted output, keep the title simple and native-looking and
  run `google_docs_title_sanitize.py --check`.
- When editing existing DOCX packages, preserve package structure: append body
  content before the final `w:sectPr`, keep existing headers/relationships, and
  let watermark helpers allocate a new header part instead of replacing one.
- If preview rendering fails because LibreOffice or a PDF-to-PNG renderer is
  missing, state exactly which verification passed; do not imply visual QA
  passed.
code-reviewSkill

>

email-draftSkill

Use when the user asks to draft, polish, translate, or reply to an email. Produces a clean draft with subject line, greeting, body, and sign-off, plus a pre-send self-check.

feishuSkill

Use when the user mentions 飞书 / Feishu / Lark workspace operations: docx (云文档) read/write, bitable (多维表格) records / views / dashboards, drive (云盘) upload/download, wiki (知识库) link resolution, approval (审批) instance create/cancel/query, calendar (日历) event create/list/update + attendees, contact (联系人) user/department lookup, hire (招聘) job/talent/application listing. Trigger on phrases like 'OKR 周报', '把这份文档发到飞书云盘', '给团队拉个评审会议', '查 [姓名] 的联系方式', '撤销那条审批', '/wiki 链接', or any request that mentions a feishu / lark URL / token (doxcn.../bascn.../wikcn.../boxcn.../om_...).

ha-browserSkill

Hope Agent browser automation — the standard `status → tabs → snapshot → act` loop, stale-ref recovery rules, and what to do when login / 2FA / captcha / camera-prompt / dialog blocks progress. Load this skill whenever you reach for the `browser` tool. Trigger on: user asks the agent to open / control / click / scrape / log into / verify something in a web app ('open X and click Y', '打开 X 然后点击 Y', 'log into my Gmail', 'scrape this page', 'fill out the form on X'); user reports a flow that requires real browser context (cookies, JS-rendered content, OAuth).

ha-find-skillsSkill

Discover and install third-party skills from external registries when the user needs a capability that no currently-active skill covers. Trigger when: (1) the user explicitly asks 'find a skill for X', 'is there a skill that does X', 'install a skill to X', (2) the user requests a well-known integration (Slack, Notion, Trello, GitHub, Hue, Sonos, iMessage, weather, TTS, transcription …) that isn't in the active skill catalog, (3) you are about to hand-write ad-hoc shell / API code for a domain that almost certainly has a published skill. Do NOT trigger if an active skill already covers the need — scan the visible skill catalog first.

ha-logsSkill

Self-service diagnostics — query Hope Agent's local SQLite databases (logs / sessions / async jobs) directly via the `exec` tool to investigate problems, analyze usage, and locate root causes. Trigger on: user reports something broken / failing / slow / stuck / not responding ('X 不工作', 'X 报错', 'X 卡住', '为什么 X 失败', 'why did X fail', 'show me the logs', 'check what happened'); ad-hoc data analysis ('this week's token usage', '最近调用最多的工具', 'how many subagent runs failed', 'tool error rate', 'find sessions where X happened'); verifying a fix ('did the error stop after I changed Y'). Use BEFORE asking the user to paste log snippets — the data is on disk, query it directly. Read-only — SELECT only, never UPDATE/DELETE/INSERT/DROP.

ha-mac-controlSkill

Hope Agent native macOS desktop control — the standard `mac_control` status / diagnostics / apps / dock / spaces / snapshot / visual / windows / menu / clipboard / dialog loop, target-first action rules, no-blind-coordinate policy, and recovery for stale AX/window/menu/dialog state. Load whenever using `mac_control`, or when the user asks to control local Mac apps, Dock, Spaces, click/type/menu/window/dialog/clipboard, automate Finder/TextEdit/System Settings, visually locate UI, or says 控制 Mac, macOS 自动化, 点按钮, 打开应用, Dock, Space, 关闭窗口, 菜单点击, 视觉定位.

ha-self-diagnosisSkill

Self-understanding and issue reporting for Hope Agent itself. Use when the user asks how Hope Agent works internally, asks about its own source code/docs/runtime behavior, reports a bug/failure/slowness/crash, asks to diagnose logs, or asks to create/submit a GitHub issue for a bug, feature request, or improvement (including when there is no bug). Chinese triggers: 自查, 了解自己, 自我诊断, 排查 Hope Agent, 提交 issue, 需求 issue, 功能改进.