← 返回 Skills 市场
byteuser1977

文档整理技能 (document-organizer)

作者 byteuser1977 · GitHub ↗ · v1.0.4 · MIT-0
cross-platform ✓ 安全检测通过
439
总下载
1
收藏
3
当前安装
3
版本数
在 OpenClaw 中安装
/install document-organizer
功能描述
支持批量将旧版 Office 文档(.doc/.xls)高质量转换为 Markdown 并保持目录结构与格式完整。
使用说明 (SKILL.md)

文档整理技能 (document-organizer)\r

\r

概述\r

\r 专业的文档批量处理技能,支持旧版 Office 文档(.doc/.xls)高质量转换为 Markdown,保持格式结构完整。\r \r ---\r \r

核心能力\r

\r

✅ 格式转换\r

  • Word 文档: .doc.md(LibreOffice 直接转换)\r
  • Word 文档: .docx.md(LibreOffice 直接转换)\r
  • Excel 表格: .xls.xlsx.md(保留表格结构)\r
  • PowerPoint: .ppt.pptx.md(可选支持)\r
  • 现代格式: .xlsx/.pptx.md(MarkItDown 直接处理)\r \r

✅ 批量处理\r

  • 支持按目录批量转换\r
  • 自动保持原目录结构\r
  • 分类处理不同类型文件\r
  • 错误自动记录,不中断流程\r \r

✅ 质量保证\r

  • 完美保留标题层级(H1-H6)\r
  • 表格结构完整(Markdown 表格)\r
  • 加粗/斜体样式保留\r
  • 列表有序/无序完整\r
  • 中文无乱码(UTF-8 编码)\r \r ---\r \r

快速开始\r

\r

1. 环境准备\r

\r

# 安装 LibreOffice(系统级)\r
# 下载: https://zh-cn.libreoffice.org/\r
\r
# 安装 Python 依赖\r
pip install markitdown[docx,xlsx]\r
```\r
\r
### 2. 使用方法\r
\r
```bash\r
# 交互模式(推荐)\r
npx skills run document-organizer\r
\r
# 命令行参数\r
npx skills run document-organizer --source "源目录" --output "输出目录" --type doc,xls\r
```\r
\r
### 3. 配置\r
\r
首次运行会检测 LibreOffice 路径,默认:\r
- Windows: `D:\Program Files\LibreOffice\program\soffice.exe`\r
- Linux: `/usr/bin/soffice`\r
- macOS: `/Applications/LibreOffice.app/Contents/MacOS/soffice`\r
\r
---\r
\r
## 详细功能\r
\r
### 文档类型处理\r
\r
| 源格式 | 转换流程 | 输出格式 | 质量 |\r
|--------|---------|---------|------|\r
| `.doc` | LibreOffice → Markdown | `.md` | ✅ 完美 |\r
| `.docx` | LibreOffice → Markdown | `.md` | ✅ 完美 |\r
| `.xls` | LibreOffice → .xlsx → MarkItDown → .md | `.md` | ✅ 完美 |\r
| `.xlsx` | MarkItDown → .md | `.md` | ✅ 完美 |\r
| `.ppt` | LibreOffice → .pptx → MarkItDown → .md | `.md` | ✅ 良好 |\r
| `.pptx` | MarkItDown → .md | `.md` | ✅ 良好 |\r
| `.pdf` | MarkItDown → .md | `.md` | ✅ 优秀(文本+表格)|\r
\r
### 批量处理策略\r
\r
**方案一:分类批量(推荐)**\r
```\r
批量转换所有 .doc 文件:\r
  soffice --convert-to md *.doc\r
\r
批量转换所有 .docx 文件:\r
  soffice --convert-to md *.docx\r
\r
批量转换所有 .xls 文件:\r
  soffice --convert-to xlsx *.xls  →  markitdown *.xlsx\r
\r
批量转换所有 .ppt 文件:\r
  soffice --convert-to pptx *.ppt  →  markitdown *.pptx\r
```\r
\r
**方案二:递归处理**\r
```\r
扫描目录树,按文件类型分组\r
分别批量转换每个子目录\r
保持完整目录结构输出\r
```\r
\r
---\r
\r
## 使用示例\r
\r
### 示例 1: 转换单个目录\r
\r
```bash\r
# 扫描源目录\r
npx skills run document-organizer --source "G:\历史文档" --output "d:\知识库"\r
```\r
\r
输出结构:\r
```\r
知识库/\r
├── 项目A/\r
│   ├── 需求文档.md\r
│   └── 设计文档.md\r
└── 项目B/\r
    └── 会议记录.md\r
```\r
\r
### 示例 2: 仅处理 Word 文档\r
\r
```bash\r
npx skills run document-organizer --source "G:\docs" --output "d:\md" --filter .doc,.docx\r
```\r
\r
### 示例 3: 处理 PDF 文档\r
\r
```bash\r
npx skills run document-organizer --source "G:\pdfs" --type pdf --output "d:\pdf_md"\r
```\r
\r
### 示例 4: 先扫描统计\r
\r
```bash\r
npx skills run document-organizer --scan-only "G:\docs"\r
# 输出: 文件统计,不执行转换\r
```\r
\r
---\r
\r
## 配置选项\r
\r
| 参数 | 类型 | 默认值 | 说明 |\r
|------|------|--------|------|\r
| `--source` | string | 必需 | 源目录路径 |\r
| `--output` | string | `./output` | 输出目录 |\r
| `--type` | string | `doc,xls,docx,xlsx,ppt,pptx,pdf` | 处理的文件类型(逗号分隔) |\r
| `--soffice-path` | string | 自动检测 | LibreOffice soffice.exe 路径 |\r
| `--log-file` | string | `conversion.log` | 日志文件路径 |\r
| `--dry-run` | bool | `false` | 仅模拟,不实际转换 |\r
\r
---\r
\r
## 性能参考\r
\r
**测试环境**: i5 CPU, 16GB RAM, SSD\r
\r
| 操作 | 数量 | 耗时 | 吞吐 |\r
|------|------|------|------|\r
| .doc → .md (LibreOffice) | 1,000 | ~30 秒 | 33 个/秒 |\r
| .xls → .xlsx (LibreOffice) | 2,000 | ~1.5 分钟 | 22 个/秒 |\r
| .xlsx → .md (MarkItDown) | 2,000 | ~2 分钟 | 17 个/秒 |\r
| .ppt → .pptx (LibreOffice) | 500 | ~30 秒 | 17 个/秒 |\r
| .pptx → .md (MarkItDown) | 500 | ~1 分钟 | 8 个/秒 |\r
| .pdf → .md (MarkItDown) | 500 | ~2 分钟 | 4 个/秒 |\r
| **总计** (3,000文件) | 3,000 | **~10-12 分钟** | - |\r
\r
---\r
\r
## 常见问题\r
\r
### Q: LibreOffice 找不到?\r
A: 确保安装并添加到 PATH,或通过 `--soffice-path` 指定:\r
\r
```bash\r
npx skills run document-organizer --soffice-path "C:\Program Files\LibreOffice\program\soffice.exe"\r
```\r
\r
### Q: 转换失败怎么办?\r
A: 检查错误日志,常见原因:\r
- 源文件损坏\r
- 临时文件(`~$` 开头)自动跳过\r
- 权限不足(以管理员运行)\r
\r
### Q: 可以预览而不转换吗?\r
A: 使用 `--dry-run` 参数:\r
\r
```bash\r
npx skills run document-organizer --source "docs" --dry-run\r
# 输出: 将转换 X 个文件,Y 个目录,跳过 Z 个\r
```\r
\r
### Q: 如何只转换特定子目录?\r
A: 结合 `--filter` 和路径模式:\r
\r
```bash\r
npx skills run document-organizer --source "docs" --filter "00_模板/*.doc"\r
```\r
\r
---\r
\r
## 技术架构\r
\r
```\r
┌─────────────────┐\r
│   用户命令       │\r
│  npx skills ... │\r
└────────┬────────┘\r
         │\r
         ▼\r
┌─────────────────────────────────────────────┐\r
│         文档整理技能 (Python)              │\r
│  • 扫描目录树                               │\r
│  • 按类型分组 (doc/xls/docx/xlsx)         │\r
│  • 调用 LibreOffice 批量转换                │\r
│  • 调用 MarkItDown 结构化转换               │\r
│  • 保持目录结构 + 重命名                    │\r
│  • 错误处理 + 日志记录                      │\r
└─────────────────────────────────────────────┘\r
         │\r
         ▼\r
┌─────────────────┐    ┌──────────────────┐\r
│  LibreOffice    │    │   MarkItDown     │\r
│  (格式转换)      │    │  (结构化输出)     │\r
└─────────────────┘    └──────────────────┘\r
         │                       │\r
         └───────────┬───────────┘\r
                     ▼\r
              ┌─────────────┐\r
              │   .md 文件   │\r
              │  (可搜索)    │\r
              └─────────────┘\r
```\r
\r
---\r
\r
## 依赖清单\r
\r
| 工具 | 版本要求 | 用途 |\r
|------|---------|------|\r
| LibreOffice | 7.0+ | .doc → .docx / .xls → .xlsx |\r
| Python | 3.10+ | 脚本运行 |\r
| markitdown | 0.1.5+ | .docx/.xlsx → .md |\r
| pywin32 | (可选) | Windows COM 自动化(备用)|\r
\r
---\r
\r
## 脚本文件\r
\r
本技能包含以下脚本:\r
\r
| 文件 | 说明 |\r
|------|------|\r
| `scripts/batch_convert.py` | 主脚本 - 批量文档转换(支持 .doc/.xls/.docx/.xlsx/.ppt/.pptx/.pdf)|\r
\r
---\r
\r
## 使用建议\r
\r
### ✅ 推荐场景\r
- 批量转换旧版 Office 文档(.doc/.xls)\r
- 构建可搜索的知识库\r
- 文档数字化归档\r
- 保留原始格式和结构\r
\r
### ❌ 不推荐场景\r
- 仅需提取纯文本(用 `strings` 命令即可)\r
- 扫描图片型 PDF(需 OCR 专用工具)\r
- 在线实时转换(需启动办公软件)\r
\r
---\r
\r
## 版本历史\r
\r
- **v1.0.4** (2026-03-12)\r
  - 修复:移除对不存在的外部 convert-markdown 目录和脚本的依赖\r
  - 修复:移除对特定路径虚拟环境的依赖\r
  - 优化:直接使用 markitdown 命令行工具进行转换\r
  - 优化:增加 markitdown 命令的自动检测逻辑\r
\r
- **v1.0.3** (2026-03-12)\r
  - 修复:移除不存在的 `--temp-dir` 参数\r
  - 更新:完善所有支持的文件类型说明\r
  - 优化:文档与实际脚本保持一致\r
\r
- **v1.0.2** (2026-03-11)\r
  - 优化:移除临时目录,直接生成 .md 文件\r
  - 新增:.docx 文件 LibreOffice 直接转换\r
  - 优化:convert_modern 支持参数调用\r
  - 优化:批量转换逻辑,提高速度\r
  - 优化:--dry-run 模式跳过 LibreOffice 检查\r
\r
- **v1.0.0** (2026-03-11)\r
  - 初始版本\r
  - 支持 .doc/.xls 批量转换\r
  - 优化:LibreOffice 直接转 Markdown\r
  - 分类处理,保持目录结构\r
\r
---\r
\r
**最后更新**: 2026-03-12  \r
**适用平台**: Windows/Linux/macOS (需 LibreOffice)  \r
**许可证**: MIT\r
安全使用建议
This skill appears to do what it says: it scans a directory and converts Office/PDF files to Markdown using your local LibreOffice and markitdown. Before running: 1) Verify you have LibreOffice (soffice) installed and Python 3.10+ with markitdown installed. 2) Run a dry-run or test on a small subset to confirm output quality. 3) Specify a temp directory on a fast disk and ensure you have read access to the source and write access to the output; the script copies files to a temp folder and deletes the temp files after processing. 4) Back up irreplaceable source files before large batch runs. 5) Note the minor metadata inconsistency: the registry header claimed "no required binaries" but the skill requires LibreOffice/Python—treat that as an authoring oversight, not malicious behavior. If you need network isolation or want to audit behavior first, run the script in a sandbox/container and inspect conversion.log and stdout/stderr during a small test run.
功能分析
Type: OpenClaw Skill Name: document-organizer Version: 1.0.4 The document-organizer skill is a legitimate utility designed for batch converting various Office document formats (.doc, .xls, .ppt, etc.) and PDFs into Markdown. The core logic in scripts/batch_convert.py uses subprocess to call LibreOffice and the markitdown library, following safe execution patterns (using argument lists rather than shell strings). The documentation is extensive and aligns perfectly with the code's functionality, with no evidence of malicious intent, data exfiltration, or harmful prompt injection.
能力评估
Purpose & Capability
The skill's name/description (document conversion) matches the included script and docs: it scans directories, calls LibreOffice and markitdown, and writes .md output. Minor inconsistency: the top-level registry metadata in the prompt lists "Required binaries: none", but manifest.json, SKILL.md and the script clearly require LibreOffice and Python + markitdown. This is an administrative metadata mismatch (not a functionality mismatch).
Instruction Scope
SKILL.md and scripts limit actions to scanning a user-specified source directory, copying files to a temporary directory, invoking local conversion tools (soffice, markitdown), writing outputs and logs, and cleaning up. There are no instructions to read unrelated system files, collect secrets, or transmit data to external endpoints.
Install Mechanism
This is an instruction-only skill with a Python script (no packaged install spec). Dependencies are expected to be installed by the user (LibreOffice system install and pip install markitdown). No downloads from untrusted URLs or extract/install steps are present in the package. The recommended pip package and LibreOffice are standard; the manifest's external tool URL points to LibreOffice's official site.
Credentials
The skill does not request credentials or sensitive environment variables. Documented environment variables (SOFFICE_PATH, DO_* etc.) are configuration-only and proportional to the task. There is no request for cloud keys or unrelated secrets.
Persistence & Privilege
The skill is not always-enabled and does not request elevated platform privileges. It operates on user-specified directories and uses a temp directory; it does not attempt to modify other skills' configs or persist beyond its own outputs/logs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install document-organizer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /document-organizer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.4
- 修复:移除对不存在的外部 convert-markdown 目录和脚本的依赖 - 修复:移除对特定路径虚拟环境的依赖 - 优化:直接使用 markitdown 命令行工具进行转换 - 优化:增加 markitdown 命令的自动检测逻辑
v1.0.3
- Added detailed API, configuration, examples, formats, performance, and troubleshooting documentation under the `references/` directory. - Added `package.json` for dependency and metadata management. - Added compiled script file `batch_convert.cpython-314.pyc` to `scripts/__pycache__/`. - SKILL.md updated for improved accuracy of supported formats, updated batch conversion documentation, and alignment with the actual script. - Updated documentation to clarify and expand file type support and options.
v1.0.0
document-organizer v1.0.0 - 首次发布,支持批量将旧版 Office(.doc/.xls)文档高质量转换为 Markdown,完整保留格式结构。 - 支持多种文档格式(.doc, .xls, .docx, .xlsx, .ppt, .pptx, .pdf)自动分类处理。 - 保持源目录结构输出,自动记录转换错误不中断流程。 - 提供命令行与交互两种使用方式,支持按需扫描、过滤和预览。 - 支持 Windows、Linux、macOS(三平台,需 LibreOffice)。
元数据
Slug document-organizer
版本 1.0.4
许可证 MIT-0
累计安装 3
当前安装数 3
历史版本数 3
常见问题

文档整理技能 (document-organizer) 是什么?

支持批量将旧版 Office 文档(.doc/.xls)高质量转换为 Markdown 并保持目录结构与格式完整。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 439 次。

如何安装 文档整理技能 (document-organizer)?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install document-organizer」即可一键安装,无需额外配置。

文档整理技能 (document-organizer) 是免费的吗?

是的,文档整理技能 (document-organizer) 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

文档整理技能 (document-organizer) 支持哪些平台?

文档整理技能 (document-organizer) 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 文档整理技能 (document-organizer)?

由 byteuser1977(@byteuser1977)开发并维护,当前版本 v1.0.4。

💬 留言讨论