Workflow 是一个文档转换工具包,内置 Agent Skill document-conversion,可在 Cursor、Trae、Claude Code、Codex 等 AI 编程助手中自动或手动触发,完成 PDF/Office/图片 ↔ Markdown、Markdown → Word、图表 → draw.io 等任务。
Workflow is a document conversion toolkit with a built-in Agent Skill document-conversion. It works across Cursor, Trae, Claude Code, and Codex to convert PDF/Office/images to Markdown, Markdown to Word, and charts to draw.io—either automatically or on demand.
- Python 3.11+(与技能
compatibility字段一致 / matches skill metadata) - Git(克隆仓库 / clone the repo)
- 网络(仅
pip install时需要 / only needed forpip install)
python -m venv .venv激活 / Activate:
| 平台 Platform | 命令 Command |
|---|---|
| Windows (PowerShell) | .venv\Scripts\Activate.ps1 |
| Windows (cmd) | .venv\Scripts\activate.bat |
| macOS / Linux | source .venv/bin/activate |
pip install -r requirements.txt本地转换无需 API Key 或 .env 文件。Local conversion requires no API keys or .env file.
仓库内 Resources/ 已包含示例文件。任选其一运行:
The repo includes sample files under Resources/. Run any supported example:
# Mermaid → draw.io
python Scripts/convert.py --input Resources/sample-flow.mmd --output output/
# Markdown → Word
python Scripts/convert.py --input Resources/sample-report.md --output output/退出码 / Exit codes:0 成功 · 1 参数错误 · 2 IO/API 失败
| 属性 Property | 值 Value |
|---|---|
| 名称 Name | document-conversion |
| 路径 Path | 见下方各平台目录 / see platform paths below |
能力 / Capabilities:
- PDF、Word、Excel、PPT、图片 → Markdown
- Markdown → Word(套用
template/default.docx) - JSON / Mermaid → draw.io(可在 diagrams.net 打开)
自动触发 / Auto-trigger: Agent 读取技能 frontmatter 中的 description,当任务涉及文档转换、生成 Markdown、创建 draw.io 图表或运行 Workflow 脚本时自动加载完整 SKILL.md。
Agents load the full SKILL.md when your task matches the skill description (document conversion, Markdown generation, draw.io diagrams, or Workflow scripts).
详细工作流见各平台目录下的 SKILL.md、workflows.md、examples.md。
For detailed workflows, see SKILL.md, workflows.md, and examples.md in each platform skill directory.
技能已随仓库提交,克隆或打开项目即可使用,无需额外安装步骤。
Skills are checked into the repo—clone or open the project and they are ready. No extra install step.
| 平台 Platform | 项目技能路径 Project skill path | 全局技能路径 Global skill path |
|---|---|---|
| Cursor | .cursor/skills/document-conversion/SKILL.md |
~/.cursor/skills/ |
| Trae | .trae/skills/document-conversion/SKILL.md |
~/.trae/skills/(国际版)或 ~/.trae-cn/skills/(国内版) |
| Claude Code | .claude/skills/document-conversion/SKILL.md |
~/.claude/skills/ |
| Codex | .agents/skills/document-conversion/SKILL.md |
~/.agents/skills/ |
- 用 Cursor 打开 Workflow 项目根目录。Open the Workflow project root in Cursor.
- Agent 会话启动时会索引
.cursor/skills/下所有技能的name与description。On session start, Cursor indexes skill names and descriptions under.cursor/skills/. - 在 Agent 对话中用自然语言描述任务即可,例如:In Agent chat, describe the task in natural language, for example:
- 「把
Resources/sample-report.md转成 Word」 - “Convert
Resources/sample-flow.mmdto a draw.io diagram”
- 「把
- Agent 匹配到
document-conversion后会读取SKILL.md并按其中流程执行Scripts/convert.py。
说明 / Notes: 项目级技能位于 .cursor/skills/;个人全局技能放在 ~/.cursor/skills/,对所有项目生效。Project skills live in .cursor/skills/; personal skills in ~/.cursor/skills/ apply to all projects.
- 用 Trae 打开 Workflow 项目。Open Workflow in Trae.
- Trae 自动加载
.trae/skills/下的技能索引;任务匹配时注入完整SKILL.md。Trae auto-loads the skill index; the fullSKILL.mdis injected when the task matches. - 显式调用 / Explicit invoke: 在聊天中输入
/document-conversion将技能加入当前对话上下文。Type/document-conversionin chat to add the skill to context. - 自然语言示例 / Example prompts:
- 「批量转换 Resources 目录下的文档」
- “Convert this PDF to Markdown and check the output”
说明 / Notes:
- 国际版 Trae(trae.ai)全局技能目录为
~/.trae/skills/;国内版(trae.cn)为~/.trae-cn/skills/。 - 可在 Trae Skills 面板浏览、安装或上传本地技能;本仓库技能已内置,无需再装。
- 在项目根目录启动 Claude Code(
claudeCLI 或 IDE 集成)。Start Claude Code from the project root. - Claude 从
.claude/skills/向上遍历至仓库根目录发现项目技能。Claude discovers project skills from.claude/skills/up to the repo root. - 显式调用 / Explicit invoke:
/document-conversion - 自然语言示例 / Example prompts:
- 「运行 convert.py 把 report.pdf 转成 Markdown」
- “Generate Word from the converted Markdown using the default template”
说明 / Notes:
- 首次加载含
.claude/skills/的项目时,可能需要接受 workspace trust 对话框。 - 个人全局技能:
~/.claude/skills/。
- 在 Workflow 仓库内启动 Codex CLI 或 IDE 扩展。Start Codex CLI or the IDE extension inside the Workflow repo.
- Codex 从当前工作目录向上扫描至仓库根,读取
.agents/skills/中的技能。Codex scans from the cwd up to the repo root for skills in.agents/skills/. - 显式调用 / Explicit invoke:
- CLI/IDE 中输入
$document-conversion或通过/skills选择 - Type
$document-conversionor pick the skill via/skills
- CLI/IDE 中输入
- 自然语言示例 / Example prompts:
- 「用 Workflow 把 Excel 转成 Markdown」
- “Convert images in Resources to Markdown with verbose logging”
说明 / Notes:
- 个人全局技能:
~/.agents/skills/(或 Codex 文档中的$HOME/.agents/skills)。 - 可选:在技能目录添加
agents/openai.yaml,设置policy.allow_implicit_invocation: false可限制为仅手动$skill调用(本仓库未包含该文件)。Optionally addagents/openai.yamlwithpolicy.allow_implicit_invocation: falseto require explicit$skillinvocation (not included in this repo).
默认本地转换不需要任何环境变量。Default local conversion needs no environment variables.
若需更高精度的 PDF 布局分析或 OCR,可在 shell 或 CI 中设置(也可写入项目根 .env,脚本会自动加载):
For higher-fidelity PDF layout or OCR, set in your shell or CI (or in a root .env, loaded automatically):
| 变量 Variable | 说明 Description |
|---|---|
DOCUMENT_LAYOUT_ENDPOINT |
云端布局 API 端点 / cloud layout API endpoint |
DOCUMENT_LAYOUT_API_KEY |
API 密钥 / API key |
详见 .env.example 与各技能目录中的 reference.md。
See .env.example and reference.md in any skill directory.
修改技能内容时,请同步更新以下 4 个目录(文件应保持一致):
When editing skill content, update all 4 directories (files must stay identical):
.cursor/skills/document-conversion/
.trae/skills/document-conversion/
.claude/skills/document-conversion/
.agents/skills/document-conversion/
每个目录包含 / Each directory contains:
SKILL.md— 主指令 / main instructionsreference.md— 可选 API、格式映射、平台路径 / optional API, format mapping, platform pathsworkflows.md— 分格式工作流 / per-format workflowsexamples.md— 命令示例 / command examples
- 技能主文档 / Skill docs:
.cursor/skills/document-conversion/SKILL.md(四平台副本相同 / same in all four locations) - 环境变量示例 / Env example:
.env.example - Agent Skills 规范 / Agent Skills spec: agentskills/agentskills