闲社服务运行正常AI智能体自动化平台
o

办公文档编辑

技能标识:office-editor

Create or modify Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files. Use when the user mentions Office, Word, Excel, PowerPoint, docx, xlsx, pptx, spreadsheets, presentations, or document export. Check dependencies first, and if a core library is missing, report it directly instead of installing anything automatically.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.1
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

办公文档编辑

Office文档处理

使用此技能处理 .docx、.xlsx 和 .pptx 文件。首先识别文件类型,然后检查所需的依赖项,最后决定是创建新文件还是修改现有文件。

首先遵循以下规则

  1. 1. 首先确认目标格式:Word 使用 python-docx,Excel 使用 openpyxl,PowerPoint 使用 python-pptx。
  2. 检查所需依赖项是否可以导入。如果缺少某些内容,请明确告知用户需要哪个包。不要自动运行 pip、pip3、python -m pip、sudo 或类似的安装命令。
  3. 编辑现有文件时,默认保留原始文件,并将结果保存为新文件。仅当用户明确要求时,才覆盖原始文件。
  4. 先进行结构性编辑,再进行视觉微调。避免预先编写大量低价值的格式代码。
  5. 仅在需要高级 API 时,才打开 references/ 中匹配的文档。不要一次性将所有参考文件加载到上下文中。

依赖项层级

核心依赖项

  • - python-docx:用于 Word 文档。
  • openpyxl:用于 Excel 工作簿。
  • python-pptx:用于 PowerPoint 演示文稿。

可选依赖项

  • - pandas:仅在 DataFrame 与 Excel 之间转换时需要。
  • pillow:仅在向 Excel 插入图片时需要。

检查依赖项

使用如下只读导入检查。如果检查失败,停止实现并直接报告缺失的包。

python
import importlib

PACKAGE_MAP = {
docx: python-docx,
openpyxl: openpyxl,
pptx: python-pptx,
pandas: pandas,
PIL: pillow,
}

missing = []
for modulename, packagename in PACKAGE_MAP.items():
try:
importlib.importmodule(modulename)
except ModuleNotFoundError:
missing.append(package_name)

print(missing)

根据任务选择要检查的内容:

  • - .docx 任务:检查 docx
  • .xlsx 任务:检查 openpyxl
  • .pptx 任务:检查 pptx
  • 涉及 DataFrame 的 Excel 任务:同时检查 pandas
  • Excel 图片任务:同时检查 PIL

处理 Word 文档

使用 python-docx 处理 .docx 文件。

创建新文件

python
from docx import Document

document = Document()
document.add_heading(文档标题, level=1)
document.add_paragraph(这是一个段落。)
document.save(new_doc.docx)

修改现有文件

python
from docx import Document

document = Document(existing_doc.docx)
document.add_paragraph(追加的内容)
document.save(updated_doc.docx)

首先阅读这些资源

  • - 核心 API 摘要:{baseDir}/references/docxapisummary.md
  • 创建示例:{baseDir}/scripts/createbasicdoc.py
  • 编辑示例:{baseDir}/scripts/editexistingdoc.py

处理 Excel 工作簿

使用 openpyxl 处理 .xlsx 文件。

创建新文件

python
from openpyxl import Workbook

wb = Workbook()
ws = wb.active
ws.title = 数据
ws[A1] = 你好
ws.append([数据1, 数据2, 数据3])
wb.save(new_workbook.xlsx)

修改现有文件

python
from openpyxl import load_workbook

wb = loadworkbook(existingworkbook.xlsx)
ws = wb[Sheet1]
ws[A1] = 已更新的值
wb.save(updated_workbook.xlsx)

首先阅读这些资源

  • - 创建示例:{baseDir}/scripts/createbasicworkbook.py
  • 图表:{baseDir}/references/xlsxcharts.md
  • 高级功能:{baseDir}/references/xlsxfeatures.md
  • DataFrame 集成:{baseDir}/references/xlsx_pandas.md

处理 PowerPoint 演示文稿

使用 python-pptx 处理 .pptx 文件。

创建新文件

python
from pptx import Presentation

prs = Presentation()
slide = prs.slides.addslide(prs.slidelayouts[1])
slide.shapes.title.text = 幻灯片标题
slide.placeholders[1].text = 这是内容占位符。
prs.save(new_presentation.pptx)

修改现有文件

python
from pptx import Presentation

prs = Presentation(existing_presentation.pptx)
slide = prs.slides.addslide(prs.slidelayouts[1])
slide.shapes.title.text = 新幻灯片
slide.placeholders[1].text = 附加内容
prs.save(updated_presentation.pptx)

首先阅读这些资源

  • - API 快速参考:{baseDir}/references/pptxapireference.md
  • 图表指南:{baseDir}/references/pptxchartguide.md
  • 完整示例:{baseDir}/scripts/create_presentation.py

资源选择规则

  • - 仅创建基本 Word 文件:从 {baseDir}/scripts/createbasicdoc.py 开始
  • 修改现有 Word 文件:从 {baseDir}/scripts/editexistingdoc.py 开始
  • 仅创建基本 Excel 文件:从 {baseDir}/scripts/createbasicworkbook.py 开始
  • Excel 图表或条件格式:先阅读 {baseDir}/references/xlsxcharts.md 或 {baseDir}/references/xlsxfeatures.md
  • DataFrame、CSV 转 Excel 或工作表分析:确认 pandas 可用,然后阅读 {baseDir}/references/xlsxpandas.md
  • 仅生成基本 PowerPoint:从 {baseDir}/scripts/createpresentation.py 开始
  • PowerPoint 图表:先阅读 {baseDir}/references/pptxchartguide.md

输出规则

  • - 始终保存到具体的目标文件名。不要仅将更改保留在内存中。
  • 如果用户未提供文件名,请使用明确的默认名称,例如 report.docx、budget.xlsx 或 deck.pptx。
  • 对于现有文件的编辑,默认使用 updated_*.ext 以避免意外覆盖。

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 office-editor-1776120035 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 office-editor-1776120035 技能

通过命令行安装

skillhub install office-editor-1776120035

下载

⬇ 下载 office-editor v1.0.1(免费)

文件大小: 17.87 KB | 发布时间: 2026-4-15 13:40

v1.0.1 最新 2026-4-15 13:40
- Updated documentation (SKILL.md) to use clear and concise English throughout, replacing previous Chinese instructions.
- Improved structure and rules for handling Word, Excel, and PowerPoint files, including better guidance on dependency checks and output naming.
- Clarified dependency checking logic and described core vs. optional package requirements.
- Expanded resource references for both basic and advanced use cases with clear selection rules.
- No functional code changes, scripts and references remain the same; this update is documentation-focused for broader accessibility.
返回顶部