← 返回 Skills 市场
sinoslug

only for test

作者 sinoslug · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
58
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install slugtest
功能描述
提取 .docx/.xlsx/.pdf/图片 文档内容,转换为 Markdown 格式(支持 OCR 识别)。 这是**只读提取工具**,专注于将现有文档转换为 Markdown。 TRIGGER when: 用户要求提取文档内容、读取 Word/Excel/PDF 内容、提取图片文字、 OCR 识别、文档转 M...
使用说明 (SKILL.md)

Extract Doc

提取 .docx/.xlsx/.pdf/图片 文档内容,转换为 Markdown 格式。

触发

/extract-doc \x3Cfile_path>

参数:

  • file_path: 文档路径(支持 .docx/.xlsx/.pdf/.png/.jpg/.bmp)

支持格式

格式 扩展名 提取方法 特殊处理
Word .docx python-docx 段落、表格、列表
Excel .xlsx openpyxl 多 Sheet、表格
PDF .pdf pymupdf + MCP OCR 文本型/扫描型
图片 .png/.jpg/.bmp MCP OCR 中文/英文/代码

OCR 规则

必须使用 MCP OCR,禁止安装本地 OCR 库 (pytesseract 等)。

工具: mcp__zai-mcp-server__extract_text_from_screenshot

参数:
  image_source: 图片路径或 URL
  prompt: 提取指令 (如 "提取所有文本内容,保持原有排版")
  programming_language: 代码语言 (可选,如 "python")

依赖安装

首次使用前执行

pip install python-docx openpyxl pymupdf
版本 用途
python-docx >=0.8.11 Word 解析
openpyxl >=3.1.0 Excel 解析
pymupdf >=1.23.0 PDF 解析

执行流程

Step 1: 按类型提取

验证文件存在后,根据扩展名选择提取方法。

.docx 文件

from docx import Document
doc = Document(path)

# 段落: 识别标题层级
for para in doc.paragraphs:
    if para.style.name.startswith('Heading'):
        level = para.style.name.split()[-1]
        # 输出: {'#' * int(level)} {para.text}
    else:
        # 输出: para.text

# 表格: 转 Markdown 表格
for table in doc.tables:
    # 第1行为表头, 其余为数据行

.xlsx 文件

from openpyxl import load_workbook
wb = load_workbook(path)

for sheet_name in wb.sheetnames:
    sheet = wb[sheet_name]
    # 第1行检测表头, 第2行起为数据, 转为 Markdown 表格

.pdf 文件

import fitz  # pymupdf
doc = fitz.open(path)

for i, page in enumerate(doc, 1):
    text = page.get_text().strip()
    if text:
        # 文本型 PDF - 直接提取
    else:
        # 扫描型 PDF - 渲染为图片 + MCP OCR
        pix = page.get_pixmap(dpi=150)
        pix.save(f"/tmp/pdf_page_{i}.png")
        # 调用 mcp__zai-mcp-server__extract_text_from_screenshot(...)

图片文件 (MCP OCR)

直接调用:
mcp__zai-mcp-server__extract_text_from_screenshot(
    image_source="D:/docs/scan.png",
    prompt="提取图片中的所有文字,保持原有排版和表格结构"
)

Step 2: 格式化输出

转换为 Markdown,保持原有结构。


输出格式

# 文档名称

## 元信息
- 类型: [Word/Excel/PDF/图片]
- 页数/工作表: [N]
- OCR: [是/否]

## 内容

[提取的文本内容,保持原始结构]

### 表格 1

| 列1 | 列2 | 列3 |
|-----|-----|-----|
| ... | ... | ... |

错误处理

错误 处理
文件不存在 验证路径,搜索相似文件名
库未安装 显示 pip install 命令
大文件 (>10MB) 警告并建议分段提取
编码问题 尝试 UTF-8/GBK 解码
PDF 加密 提示需要密码
OCR 失败 检查图片清晰度,建议 DPI >= 150
不支持的格式 列出支持的格式列表

B6x 项目典型用例

文档类型 用例
需求文档 (.docx) 提取功能需求转 Markdown
规格书 (.pdf) 提取芯片规格、寄存器描述
测试用例 (.xlsx) 提取测试项转为可读格式
扫描件 (.png) OCR 识别手写笔记
代码截图 提取代码文本
安全使用建议
This skill appears safe for ordinary document extraction. Before installing, be aware that it may install Python libraries and that OCR for images or scanned PDFs depends on an MCP OCR service; do not use that OCR path for sensitive documents unless you trust the service.
功能分析
Type: OpenClaw Skill Name: slugtest Version: 1.0.0 The 'extract-doc' skill (SKILL.md) is classified as suspicious because it requires high-risk permissions, specifically 'Bash' and 'Write', to install Python dependencies and execute extraction scripts. The logic involves passing user-provided file paths into shell commands, which poses a risk of shell injection if the agent does not properly sanitize inputs. While the functionality is consistent with its stated goal of document processing, the use of broad system access and an external MCP OCR tool (mcp__zai-mcp-server__extract_text_from_screenshot) constitutes a significant attack surface.
能力评估
Purpose & Capability
The stated purpose is consistent: extract existing Word, Excel, PDF, and image content into Markdown, and the instructions explicitly avoid creating or editing source documents.
Instruction Scope
The workflow is scoped to user-provided document paths, but the skill allows Bash and Write in addition to read/search tools, so those capabilities should stay limited to dependency setup and temporary extraction artifacts.
Install Mechanism
There is no formal install spec, but SKILL.md tells users to run a pip install command for parsing libraries; this is purpose-aligned but not pinned in the install metadata.
Credentials
Reading local documents is expected for this purpose, but OCR of images or scanned PDFs uses an MCP OCR tool, so sensitive document images may be processed by that service.
Persistence & Privilege
No credentials, background workers, or ongoing persistence are requested; the only file-writing behavior shown is dependency installation and temporary PDF page images for OCR.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install slugtest
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /slugtest 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
test
元数据
Slug slugtest
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

only for test 是什么?

提取 .docx/.xlsx/.pdf/图片 文档内容,转换为 Markdown 格式(支持 OCR 识别)。 这是**只读提取工具**,专注于将现有文档转换为 Markdown。 TRIGGER when: 用户要求提取文档内容、读取 Word/Excel/PDF 内容、提取图片文字、 OCR 识别、文档转 M... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 58 次。

如何安装 only for test?

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

only for test 是免费的吗?

是的,only for test 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

only for test 支持哪些平台?

only for test 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 only for test?

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

💬 留言讨论