doc-processor

A document-processing guide for creating and converting Word files, spreadsheets, presentations, Markdown, HTML, and PDFs, including extracting PDF text.

In plain words
What is it for?
Use it to generate DOCX, XLSX, and PowerPoint files, convert between Markdown, HTML, DOCX, and PDF, extract PDF text, and merge or split PDFs.
Why use it?
It removes the need to handle each document format manually and supports repeatable conversions and batch processing. It also helps preserve structured data when moving between formats.

Skill for Claude CodeCodex

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/ntygod/zhiwei/doc-processor
Any agent
npx skills add ntygod/ZhiWei --skill doc-processor
Clone the repo
git clone --depth 1 https://github.com/ntygod/ZhiWei

Made for: Claude Code, Codex.

Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,066 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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 $0.00054 $0.01066
Opus 5 $0.00027 $0.00533
Sonnet 5 $0.00011 $0.00213
Haiku 4.5 $0.00005 $0.00107

Measured 2d ago against content hash 7f575773ac3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

doc-processor 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 2d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/md2docx.py, scripts/pdf_tools.py, scripts/xlsx_tools.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.

src/main/resources/skills/doc-processor/SKILL.md · 77 lines

How it starts

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

文档处理指南

文档处理优先走可执行工具链:code + Python 库(python-docx / openpyxl / python-pptx / pypdf)负责生成、编辑和精细处理;shell.exec + CLI(pandoc / poppler / wkhtmltopdf / libreoffice)负责格式转换和批处理。

当前 Agent 默认只注入少量核心工具。若运行时没有 codeshell.execfile.write 等 schema,先用 tool.search 按工具名或能力检索,发现后再执行。

适用场景

  • 生成 Word / Excel / PowerPoint(从 Markdown、CSV、JSON 或结构化数据)
  • 格式转换(Markdown ↔ HTML ↔ DOCX ↔ PDF)
  • PDF 文本提取
  • Excel 读写、多 sheet 处理
  • 多文档合并 / 批量转换
  • 从现有文档抽取内容,整理成 Markdown / CSV / JSON

不适用场景

  • 纯文本 / Markdown 编辑 → file.write
  • 内容创作(写文章 / 邮件 / 报告正文) → content-creator
  • 数据分析(统计 / 可视化) → data-analyst
  • 飞书 / 在线文档 → feishu 或对应渠道 Skill

工作流(按用户表达分流)

用户表达 路径
生成 Word 优先 {skill_scripts_dir}/md2docx.pycode + python-docx
生成 Excel {skill_scripts_dir}/xlsx_tools.py from-csvcode + openpyxl
生成 PPT / 幻灯片 / 演示文稿 code + python-pptx
Markdown / HTML / DOCX / PDF 互转 shell.exec + pandoc
PDF 文本提取 {skill_scripts_dir}/pdf_tools.py extract-textpdftotext
HTML → PDF shell.exec + wkhtmltopdf / pandoc
多 PDF 合并 / 拆分 {skill_scripts_dir}/pdf_tools.py merge/split
批量转换 先单文件验证,再 shell.exec 循环或写临时脚本

各路径决策点(本 Skill 独有)

  • 先探测依赖:第一次使用库 / CLI 前先跑 python -c "import ..."pandoc --version。依赖缺失时说明安装命令;只有用户明确允许时才安装。
  • 先生成中间格式:复杂 Word/PDF 优先产出 Markdown/HTML/CSV 中间文件,确认内容结构后再转目标格式。
  • 结果必须验证:生成后用 file.read 抽样确认文本内容;对二进制 Office/PDF,可用脚本提取文本或列 sheet/页数。
  • 批量先单后批:批量转换前先跑 1 个样本,确认样式、编码、字体和路径规则后再循环。
  • 加密 PDF:让用户提供密码,或用 qpdf --decrypt 预处理;不要尝试绕过权限。
  • 不要走 Java document 工具:当前文档生成/转换不依赖 document.create / document.edit,应使用本 Skill 的脚本、Python 库或 CLI。

输出约定

  • 产物路径优先放在用户指定目录;没有指定时放到当前 workspace 下可读写路径。
  • 生成多个文件时同时输出一个简短清单,列文件名、格式、来源和验证结果。
  • 若转换存在格式损失(分页、脚注、复杂表格、批注、宏、图表),在结果里明确说明。

详细参考

  • 转换路径、命令模板、脚本清单:{skill_dir}/references/doc-conversion.md
  • 依赖探测与安装建议:{skill_dir}/references/dependency-setup.md
  • Office/PDF 处理配方:{skill_dir}/references/office-recipes.md
  • 常见错误处理表:{skill_dir}/references/troubleshooting.md

Read the full file on GitHub · 77 lines

Files

What ships with it

7 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. 2d ago First seen · 77 lines · 54 tokens per session scan A 7f575773ac3f

Subscribe to this mod's changes

doc-processor is a skill published in the GitHub repository ntygod/ZhiWei (137 stars, last pushed 21d ago), licensed MIT. It adds 54 tokens to every session and 1,066 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.