← Back to Skills Marketplace
sinoslug

only for test

by sinoslug · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
58
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install slugtest
Description
提取 .docx/.xlsx/.pdf/图片 文档内容,转换为 Markdown 格式(支持 OCR 识别)。 这是**只读提取工具**,专注于将现有文档转换为 Markdown。 TRIGGER when: 用户要求提取文档内容、读取 Word/Excel/PDF 内容、提取图片文字、 OCR 识别、文档转 M...
README (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 识别手写笔记
代码截图 提取代码文本
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install slugtest
  3. After installation, invoke the skill by name or use /slugtest
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
test
Metadata
Slug slugtest
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is only for test?

提取 .docx/.xlsx/.pdf/图片 文档内容,转换为 Markdown 格式(支持 OCR 识别)。 这是**只读提取工具**,专注于将现有文档转换为 Markdown。 TRIGGER when: 用户要求提取文档内容、读取 Word/Excel/PDF 内容、提取图片文字、 OCR 识别、文档转 M... It is an AI Agent Skill for Claude Code / OpenClaw, with 58 downloads so far.

How do I install only for test?

Run "/install slugtest" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is only for test free?

Yes, only for test is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does only for test support?

only for test is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created only for test?

It is built and maintained by sinoslug (@sinoslug); the current version is v1.0.0.

💬 Comments