cherryhq/cherry-studio

office-transform

Extract or edit a selection from xlsx, docx, pdf, or pptx into a new file; the source is never modified.

  • SKILL.md 已保存
  • 英文来源资料
  • 安装与运行未实测
先判断是否解决你的问题

office-transform 是什么?

Extract or edit a selection from xlsx, docx, pdf, or pptx into a new file; the source is never modified.

以上为来源原文,中文用途说明尚待整理。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 office-transform,然后告诉 Agent 你的任务和实际输入,让它先核对触发条件。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 office-transform

请在 Codex 的当前工作环境中安装并检查 office-transform 这个 Skill。

项目身份:cherryhq/cherry-studio / office-transform
来源:https://github.com/cherryhq/cherry-studio/blob/253bd3d400e40a9cb9afdd7a4f97ecd5bc5f9d63/resources/skills/office-transform/SKILL.md
已定位的源文件:resources/skills/office-transform/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-22T03:34:45.756Z
中文使用说明
尚待整理,保留英文来源内容
安装与任务测试
本站未执行安装或任务测试
来源复核
已保留来源记录;当前完整用法未逐项人工复核
展开 SKILL.md 原文、章节与历史收录资料

resources/skills/office-transform/SKILL.md · 抓取时间 2026-11-22T03:34:45.756Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

Extract or edit a selection from xlsx, docx, pdf, or pptx into a new file; the source is never modified.

查看源文件章节 / Source sections
  • 原文:Office Transform
  • 原文:When to use which tool
  • 原文:Input: selection references
  • 原文:Operations
  • 原文:Extract — pull the anchored region into a new file
  • 原文:Patch-copy — derive an edited copy, standard library only
  • 原文:Generate — write ad-hoc library code for new documents
  • 原文:Edit docx — edit runs, never `Paragraph.text`
  • 原文:Edit pptx — use python-pptx, saving to a new path
  • 原文:Output conventions
  • 原文:Verify before reporting success
  • 原文:Limits
原文:Office Transform

Turn a structural selection of an Office/PDF document into a new derived file. Two invariants hold for every operation: 1. **The source file is read-only.** Every result is a new file; both scripts refuse to write to the source path or overwrite an existing file. Never work around this with ad-hoc shell edits to the original. 2. **Anchors are structural.** Selections address the document's own coordinates — worksheet + A1 range, body-level paragraph ordinal, one-based page number — never screen or DOM positions.

原文:When to use which tool

- Only need to *read* a document to summarize or answer questions → use `mcp__cherry-tools__to_markdown` instead (see the cherry-tool-guide skill); it is lossy but built for reading. - The user wants a *file* out — an extracted range, a converted fragment, an edited copy → this skill.

原文:Input: selection references

Chat surfaces may hand you a fenced `selection-ref` block: ```selection-ref {"path": "/abs/report.xlsx", "anchor": {"format": "xlsx", "sheet": "Sheet1", "range": "A1:C10"}, "excerpt": "…", "fileStamp": {"size": 1024, "mtimeMs": 1700000000000}} ``` The `anchor` object is exactly what the scripts take via `--anchor`. A block may also carry `comment`: what the user wants done at that location, in their own words. Treat it as the user's instruction for that anchor. It is not part of the anchor, so never pass it to a script. **Freshness check.** `fileStamp.mtimeMs` is milliseconds since the Unix epoch, floored to whole milliseconds. Do not compare it to `stat`'s default output: `stat -f %m` (macOS) and `stat -c %Y` (GNU) give whole *seconds*, so multiplying by 1000 loses the sub-second part and never matches. Read whole milliseconds the way the app wrote them: ```bash uv run python -c "import os,sys;st=os.stat(sys.argv[1]);print(st.st_size, st.st_mtime_ns//1_000_000)" '/abs/report.xlsx' ``` Treat the file as changed when the size differs, or when the mtimes differ by more than 2 ms. The tolerance is small on purpose: both sides floor the same nanosecond timestamp to milliseconds, so they agree exactly, and the couple of milliseconds only covers the rounding of a `double` that can no longer represent current epoch milliseconds exactly. A wider window would hide real edits — a same-size change made within it would read as unchanged, which is why the anchor check below is not optional. On a change, tell the user the file changed since they selected and ask them to re-select — never silently re-anchor.

本段为节选,完整内容见源文件。

原文:Operations

Scripts live in this skill's `scripts/` directory; resolve paths relative to this skill folder. The library-edit recipes routed to below live in `references/` beside them. Python dependencies are per-format and provided at invocation time via `uv run --with <pkg>` (the bundled-shell idiom — do not `pip install` globally). Which route an edit takes follows from the library that can write the format: `openpyxl` drops charts and drawings on a round-trip, which is why xlsx edits go through patch-copy, while `python-pptx` keeps XML it does not understand, which is why pptx edits go through the library.

原文:Extract — pull the anchored region into a new file

Always single-quote paths — real documents have spaces in their names (`Q1 report.xlsx`). If a path itself contains a single quote, close and reopen the quoting around it: `'/abs/Bob'\''s deck.pptx'`. ```bash uv run --with openpyxl python scripts/office_extract.py \ --file '/abs/report.xlsx' \ --anchor '{"format":"xlsx","sheet":"Sheet1","range":"A1:C10"}' \ --out '/abs/report-q1-range.csv' ``` The output format is inferred from `--out`'s extension: | Source | Dependency (`--with`) | Output formats | | --- | --- | --- | | xlsx | `openpyxl` | `xlsx`, `csv`, `md` | | docx | `'python-docx>=1.1,<2'` | `docx`, `txt`, `md` | | pdf | `pypdf` | `pdf` (page copy), `txt`, `md` | | pptx | `python-pptx` | `txt`, `md` (slide, shape, paragraph, or table-cell text) | The docx pin is not optional. Patch-copy's `expectText` gate compares a paragraph read with python-docx against the same paragraph read by the script's own `paragraph_text`, which reproduces python-docx's `Paragraph.text` element for element. That equivalence was checked against 1.x; a release that changes what `.text` spells would make the gate refuse paragraphs nobody edited. Quote the specifier — `>` and `<` are redirects to a shell. xlsx extraction reads computed values (`data_only`), so formula cells yield their last saved result. docx extraction to `docx` carries text only, not run styling.

原文:Patch-copy — derive an edited copy, standard library only

```bash uv run python scripts/office_patch_copy.py \ --file '/abs/report.xlsx' \ --edits '{"format":"xlsx","sheet":"Sheet1","cells":{"B2":42,"C3":"hello"}}' \ --out '/abs/report-updated.xlsx' ``` OOXML packages are ZIPs of XML parts. Patch-copy copies every part byte-for-byte and re-serializes only what an edit reaches — the target worksheet or `word/document.xml`, plus the workbook bookkeeping noted below for xlsx — so styles, charts, images, and macros in untouched parts survive exactly. Edit shapes: - `{"format":"xlsx","sheet":"S","cells":{"B2":42,"C3":"text","D4":true}}` — numbers, strings, and booleans; an existing formula in an edited cell is replaced by the value. Patch-copy does not recalculate, so a formula reading an edited cell keeps the value it last cached; every write sets `fullCalcOnLoad` in `xl/workbook.xml` so Excel recomputes those on open. Replacing a formula also drops `xl/calcChain.xml` (a recalculation cache Excel rebuilds), along with the content-type and relationship entries that would otherwise point at a part no longer there; keeping a chain entry for a cell that no longer has a formula makes Excel report the derived file as damaged. Cells in a **shared, array, or data-table formula group are refused** — the expression lives in one member and the others only reference it, so overwriting a member would strip the formula from cells you never named. Rewrite such a range with `openpyxl`. Coordinates outside the worksheet grid (past XFD or row 1048576) are refused too. - `{"format":"docx","replacements":[{"paragraph":3,"text":"new text","paraId":"502E8D33","expectText":"old text"}]}` — the paragraph keeps its paragraph style and the first run's character style; extra run-level styling within that one paragraph is flattened into the new text. **`text` must be the complete new paragraph.** The whole body paragraph is replaced, and `charRange` does not narrow that — feeding back a `charRange` slice as `text` silently discards the rest of the sentence. The output is exactly `w:p > [w:pPr] + w:r > [w:rPr] + w:t`, so a paragraph holding anything that shape cannot carry is **refused**, not silently stripp

本段为节选,完整内容见源文件。

文件 SHA256:37cf43d7feddbd75341f11bd93cce42dd71485581618e28583440a68fd0fda2c

仓库许可证记录:AGPL-3.0;repository-license-recorded-scope-unverified,查看来源。

SKILL.md原文description · 2026-11-22T03:34:45.756Z

Extract or edit a selection from xlsx, docx, pdf, or pptx into a new file; the source is never modified.

查看历史简介来源

历史收录数据

来源仓库cherryhq/cherry-studio
Skill源路径resources/skills/office-transform/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源