docx

docx is a skill for Claude Code, Codex from TencentCloud/Octop. It costs 161 tokens per session (5,587 once invoked), scanned A, a copy of docx, MIT.

A document-handling skill for creating, reading, editing, and converting Microsoft Word files in .docx format. It can work with text, images, headings, page numbers, tables of contents, tracked changes, and comments.

In plain words
What is it for?
Use it to create reports, letters, templates, and other formatted Word documents, or to extract, reorganize, search, replace, edit, and review content in existing files.
Why use it?
It removes the need to handle Word files manually or understand their internal XML structure. It also provides ways to convert older .doc files and export documents as PDFs or images.

Skill for Claude CodeCodex

About the project

Octop is a self-hosted, multi-user AI assistant that runs multiple specialized agents and connects them to chat interfaces, tools, and external services. It is for individuals, families, and teams who want a locally operated assistant with shared experts and persistent capabilities. Catalogue add-ons extend its agent and assistant workflows.

TencentCloud/Octop · 1,454 stars · on GitHub · octop.cloud

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tencentcloud/octop/docx
Any agent
npx skills add TencentCloud/Octop --skill docx
Clone the repo
git clone --depth 1 https://github.com/TencentCloud/Octop

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for docx

README.md
[![agentmods](https://agentmods.dev/badge/skills/tencentcloud/octop/docx.svg)](https://agentmods.dev/skills/tencentcloud/octop/docx)
Your own site
<a href="https://agentmods.dev/skills/tencentcloud/octop/docx"><img src="https://agentmods.dev/badge/skills/tencentcloud/octop/docx.svg" alt="Measured on agentmods" height="20"></a>
Per session 161 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,587 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00161 $0.05587
Opus 5 $0.00081 $0.02794
Sonnet 5 $0.00032 $0.01117
Haiku 4.5 $0.00016 $0.00559

Measured 6d ago against content hash c43419c2af05, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

docx scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 15 executable files (scripts/__init__.py, scripts/accept_changes.py, scripts/comment.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to docx — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

src/octop/infra/agents/experts/library/office-automation/skills/docx/SKILL.md · 488 lines

How it starts

The opening of the file, as written. The whole thing — 488 lines — stays where its author put it; the contents beside it link to each section on GitHub.

重要: 所有 scripts/ 路径均相对于本技能目录。 运行方式: cd {this_skill_dir} && python scripts/... 或使用 execute_shell_commandcwd 参数。

DOCX 创建、编辑与分析

前置依赖

  • docx (npm install -g docx): 新文档创建
  • LibreOffice (soffice): .doc -> .docx 转换、修订接受和 PDF 导出
  • pandoc: 文本提取
  • pdftoppm (poppler-utils): 文档转图片工作流
  • 如果 pdftoppm 不可用,Python 备用路径可能使用 pdf2image
  • 在 Windows 上,依赖项必须已安装并在 PATH 中可用;如缺失,请报告依赖问题并停止(不要反复重试)。

概述

.docx 文件是包含 XML 文件的 ZIP 压缩包。

快速参考

任务 方法
读取/分析内容 pandoc 或解压获取原始 XML
创建新文档 使用 docx-js - 参见下方"创建新文档"
编辑现有文档 解压 → 编辑 XML → 重新打包 - 参见下方"编辑现有文档"

将 .doc 转换为 .docx

旧版 .doc 文件必须先转换才能编辑:

python scripts/office/soffice.py --headless --convert-to docx document.doc

读取内容

# 提取包含修订的文本
pandoc --track-changes=all document.docx -o output.md

# 访问原始 XML
python scripts/office/unpack.py document.docx unpacked/

转换为图片

python scripts/office/soffice.py --headless --convert-to pdf document.docx
pdftoppm -jpeg -r 150 document.pdf page

接受修订

生成接受所有修订后的干净文档(需要 LibreOffice):

python scripts/accept_changes.py input.docx output.docx

创建新文档

使用 JavaScript 生成 .docx 文件,然后进行验证。安装: npm install -g docx

初始设置

const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun,
        Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink,
        TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType,
        VerticalAlign, PageNumber, PageBreak } = require('docx');

const doc = new Document({ sections: [{ children: [/* content */] }] });
Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer));

验证

创建文件后进行验证。如果验证失败,解压、修复 XML 并重新打包。

python scripts/office/validate.py doc.docx

页面尺寸

// 关键: docx-js 默认为 A4,而非 US Letter
// 始终显式设置页面尺寸以获得一致的结果
sections: [{
  properties: {
    page: {
      size: {
        width: 12240,   // 8.5 英寸(DXA 单位)
        height: 15840   // 11 英寸(DXA 单位)
      },
      margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } // 1 英寸边距
    }
  },
  children: [/* content */]
}]

Read the full file on GitHub · 488 lines

Files

What ships with it

60 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 488 lines · 161 tokens per session scan A c43419c2af05

Subscribe to this mod's changes

docx is a skill published in the GitHub repository TencentCloud/Octop (1,454 stars, last pushed today), licensed MIT. It adds 161 tokens to every session and 5,587 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to docx, differing in 0 lines, and is treated as a copy.