Skywork Document by skyworkai/skywork-skills
npx skills add https://github.com/skyworkai/skywork-skills --skill 'Skywork Document'通过调用 Skywork Office Doc API 生成专业、格式精美的文档。
在使用此技能前,必须完成身份验证。请先运行身份验证脚本:
# 身份验证:检查环境变量令牌 / 缓存令牌 / 浏览器登录
python3 <skill-dir>/scripts/skywork_auth.py || exit 1
令牌优先级:
SKYBOT_TOKEN → 如果已设置,则直接使用~/.skywork_token → 通过 API 验证,如果有效则使用重要提示 - 登录 URL 处理:如果脚本输出包含以 [LOGIN_URL] 开头的行,你必须立即将该 URL 以可点击消息的形式发送给用户(例如,“请打开此链接登录:”)。用户可能处于浏览器无法自动打开的环境中,因此务必呈现登录 URL。
在调用任何脚本之前,分析用户的请求并确定:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
--language 参数:English、中文简体 等。Englishdocx,“PDF” → pdf,“HTML” → html,“Markdown” → mddocxdocx、pdf、html、md--content 参数类似于重写查询重要提示:
parse_file.py 一次处理一个文件。对于多个文件,请多次调用它。file_id。单个文件:
python3 <skill-dir>/scripts/parse_file.py /path/to/reference.pdf
多个文件(为每个文件调用一次脚本;可以并行运行以加快速度):
# 解析文件 1
python3 <skill-dir>/scripts/parse_file.py /path/to/file1.pdf
# 解析文件 2
python3 <skill-dir>/scripts/parse_file.py /path/to/file2.xlsx
# 解析文件 3
python3 <skill-dir>/scripts/parse_file.py "/path/to/file3 with blank in it.docx"
每次脚本调用输出:
[parse] File: reference.pdf (2,458,123 bytes)
...
[success] File parsed!
File ID: 2032146192467681280
...
PARSED_FILE: {"file_id":"2032146192467681280","filename":"reference.pdf","url":""}
提取所有 PARSED_FILE 输出并将其收集到一个 JSON 数组中:
[
{"file_id":"2032146192467681280","filename":"file1.pdf","url":""},
{"file_id":"2032146192467681281","filename":"file2.xlsx","url":""},
{"file_id":"2032146192467681282","filename":"file3.docx","url":""}
]
此数组将通过下面的 --files 参数传递给 create_doc.py。
无参考文件:
python3 <skill-dir>/scripts/create_doc.py \
--title "Document_Title" \
--content "Detailed content prompt based on user requirements..." \
--language English \
--format docx
有参考文件(使用从步骤 1 收集的 file_ids):
python3 <skill-dir>/scripts/create_doc.py \
--title "Analysis_Report" \
--content "Based on the uploaded reference files, create a comprehensive analysis report..." \
--files '[{"file_id":"id1","filename":"file1.pdf","url":""},{"file_id":"id2","filename":"file2.xlsx","url":""}]' \
--language English \
--format docx
title字段不应包含空格。
输出:
[doc] Creating document: "Analysis Report"
...
[success] Document created!
File ID: abc-123
Path: /output/doc/some_file.html
URL: https://...
Time: 15.2s
create_doc.py 完成后,解析最终的 JSON 输出。它包含两种用户访问文档的方式 — 始终同时提供两者:
file_url — 远程下载链接(云 URL)。将其作为可点击的超链接包含,以便用户可以在浏览器中打开或分享。file_path — 文件自动下载到用户机器上的绝对本地路径。明确提及此路径,以便用户可以立即找到文件,无需手动下载。回复示例(根据用户语言调整措辞):
文档已准备就绪!
- 下载链接:巴西电网行业及充电桩市场调研报告.docx
- 本地文件:
/Users/alice/Downloads/巴西电网行业及充电桩市场调研报告.docx
如果 file_path 为空(下载失败),仍提供 file_url 并告知用户可以手动下载。
file - 参考文件的路径(必需)--json - 以 JSON 格式输出完整结果(可选)关键输出:PARSED_FILE: <json> — 提取此内容用于步骤 2
--title - 文档标题(必需)--content - 内容提示,描述要写什么(必需)
--files - 来自 parse_file.py 的文件对象的 JSON 数组(可选)
[{"file_id":"xxx","filename":"yyy","url":""}]--language - 输出语言(可选,默认值:English)
English、中文简体、中文繁體、日本語、한국어、Français、Deutsch、Español、...--format - 输出格式(可选,默认值:docx)
docx、pdf、html、mdparse_file.py 输出 file_id → 通过 --files 传递给 create_doc.py。parsed_content;服务器使用 file_id 检索它。create_doc.py 使用 SSE(服务器发送事件)来维持长连接并接收实时进度更新。脚本将自动等待最多 3~10 分钟完成。无需手动轮询 — 只需等待脚本完成,它将输出结果。create_doc.py 后,输出 JSON 包含 file_url(远程下载链接)和 file_path(文件自动保存的本地路径)。你必须主动将两者返回给用户:可点击的 file_url 以便他们在线分享或打开,以及 file_path 以便他们立即在机器上找到它。如果 file_path 为空,请通知用户并提供 file_url 供手动下载。| 错误 | 解决方案 |
|---|---|
NO_TOKEN / INVALID_TOKEN | 运行身份验证流程 |
Cannot reach server | 检查网络连接 |
JSON parse error | 在 --files JSON 中使用双引号 |
| Insufficient benefit | 脚本或日志可能显示例如 Insufficient benefit. Please upgrade your account at {url} — 见下文 |
当你检测到上述情况时,请使用用户当前的语言回复 — 不要回显英文消息。使用以下模式:
[立即升级 →](url) 的链接或其对应语言的等效链接。at https://... 部分)。create_doc.py 可能会运行很长时间。当 SSE 事件到达时,向用户显示每个阶段。这可以在生成期间让他们保持知情。每周安装次数
–
代码仓库
GitHub 星标数
54
首次出现时间
–
安全审计
Generate professional, beautifully formatted documents by calling the Skywork Office Doc API.
Before using this skill, authentication must be completed. Run the auth script first:
# Authenticate: checks env token / cached token / browser login
python3 <skill-dir>/scripts/skywork_auth.py || exit 1
Token priority :
SKYBOT_TOKEN → if set, use directly~/.skywork_token → validate via API, if valid, use itIMPORTANT - Login URL handling : If script output contains a line starting with [LOGIN_URL], you MUST immediately send that URL to the user in a clickable message (e.g. "Please open this link to log in: "). The user may be in an environment where the browser cannot open automatically, so always surface the login URL.
Before calling any script, analyze the user's request and determine :
Does the user provide reference files, or imply that certain files are needed to proceed with the writing task?
What language should the output be in?
--language parameter: English, 中文简体, etc.EnglishWhat format does the user want?
docx, "PDF" → pdf, "HTML" → , "Markdown" → IMPORTANT :
parse_file.py processes one file at a time. For multiple files, call it multiple times.file_id.Single file :
python3 <skill-dir>/scripts/parse_file.py /path/to/reference.pdf
Multiple files (call the script once for each file; you can run these in parallel to speed things up):
# Parse file 1
python3 <skill-dir>/scripts/parse_file.py /path/to/file1.pdf
# Parse file 2
python3 <skill-dir>/scripts/parse_file.py /path/to/file2.xlsx
# Parse file 3
python3 <skill-dir>/scripts/parse_file.py "/path/to/file3 with blank in it.docx"
Each script call outputs :
[parse] File: reference.pdf (2,458,123 bytes)
...
[success] File parsed!
File ID: 2032146192467681280
...
PARSED_FILE: {"file_id":"2032146192467681280","filename":"reference.pdf","url":""}
Extract allPARSED_FILE outputs and collect them into a JSON array:
[
{"file_id":"2032146192467681280","filename":"file1.pdf","url":""},
{"file_id":"2032146192467681281","filename":"file2.xlsx","url":""},
{"file_id":"2032146192467681282","filename":"file3.docx","url":""}
]
This array will be passed to create_doc.py via the --files parameter below.
Without reference files :
python3 <skill-dir>/scripts/create_doc.py \
--title "Document_Title" \
--content "Detailed content prompt based on user requirements..." \
--language English \
--format docx
With reference files (use the collected file_ids from Step 1):
python3 <skill-dir>/scripts/create_doc.py \
--title "Analysis_Report" \
--content "Based on the uploaded reference files, create a comprehensive analysis report..." \
--files '[{"file_id":"id1","filename":"file1.pdf","url":""},{"file_id":"id2","filename":"file2.xlsx","url":""}]' \
--language English \
--format docx
The
titlefield should not contain spaces.
Output :
[doc] Creating document: "Analysis Report"
...
[success] Document created!
File ID: abc-123
Path: /output/doc/some_file.html
URL: https://...
Time: 15.2s
After create_doc.py finishes, parse the final JSON output. It contains two ways for the user to access the document — always provide both :
file_url — the remote download link (cloud URL). Include it as a clickable hyperlink so the user can open it in a browser or share it.file_path — the absolute local path where the file was automatically downloaded on their machine. Mention this path explicitly so the user can find the file right away without manual downloading.Example reply (adapt wording to user's language):
The document is ready!
- Download link : 巴西电网行业及充电桩市场调研报告.docx
- Local file :
/Users/alice/Downloads/巴西电网行业及充电桩市场调研报告.docx
If file_path is empty (download failed), still provide file_url and inform the user they can download manually.
file - Path to the reference file (required)--json - Output full result as JSON (optional)Key Output : PARSED_FILE: <json> — extract this for Step 2
--title - Document title (required)--content - Content prompt describing what to write (required)
--files - JSON array of file objects from parse_file.py (optional)
[{"file_id":"xxx","filename":"yyy","url":""}]--language - Output language (optional, default: English)
English, 中文简体, , , , , , , ...parse_file.py outputs file_id → pass to create_doc.py via --files.parsed_content manually; the server retrieves it using file_id.| Error | Solution |
|---|---|
NO_TOKEN / INVALID_TOKEN | Run auth workflow |
Cannot reach server | Check network connection |
JSON parse error | Use double quotes in --files JSON |
| Insufficient benefit | Script or log may show e.g. Insufficient benefit. Please upgrade your account at {url} — see below |
When you detect the above, reply in the user's current language — do not echo the English message. Use this pattern:
[Upgrade now →](url) or the equivalent in their language.at https://... part).create_doc.py may run for a long time. As SSE events arrive, display each stage to the user. This keeps them informed during the generation.Weekly Installs
–
Repository
GitHub Stars
54
First Seen
–
Security Audits
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
43,500 周安装
htmlmddocxdocx, pdf, html, mdHow to write the content prompt?
--content parameter is like a rewrite query中文繁體日本語한국어FrançaisDeutschEspañol--format - Output format (optional, default: docx)
docx, pdf, html, mdcreate_doc.pycreate_doc.py, the output JSON contains both file_url (remote download link) and file_path (local path where the file was automatically saved). You MUST proactively return both to the user : the clickable file_url so they can share or open it online, and the file_path so they can locate it immediately on their machine. If file_path is empty, notify the user and provide file_url for manual download.