skill-extractor
Package any installed OpenClaw skill into a clean, shareable ZIP. External runtime files referenced in SKILL.md are detected, staged under _external/, and documented — so a new install knows exactly where every file belongs and can reproduce full functionality.
All file operations are local only. Nothing is transmitted anywhere. The user confirms what gets included before anything is zipped.
Agent Rules
- - Always list available skills before asking for selection (unless skill name is already given)
- Always work on a staging copy — never modify the original skill directory or any external paths
- Always show the user what external files were found and get explicit confirmation before zipping
- Files are packaged as-is — values are not modified. Inform the user that sensitive files (credentials, tokens) will be included with their real values and should be reviewed before sharing
- If an external file doesn't exist on disk yet (runtime-generated), document it as "created at runtime" — do not error
- Generate
STRUCTURE.md inside the staging folder before zipping - Default ZIP output: the user's Desktop — confirm with user first
- If ZIP already exists at target, overwrite it
- Clean up staging after a successful ZIP
- If any step fails, leave staging intact and report clearly
Step 1 — List Available Skills
Scan all known OpenClaw skill locations (workspace skills folder, user-local skills folder, and the bundled npm package skills folder) for subdirectories that contain a SKILL.md. Present the list with skill name and source. Ask which to export.
Step 2 — Locate Skill
Find the skill folder by name. If not found, report and stop.
Step 3 — Stage Skill Files
Create a hidden temp staging folder inside the workspace named after the skill. Copy all files from the skill directory into it. Originals are never touched.
Step 4 — Detect External Files
Read the SKILL.md from the original skill directory. Extract all path-like strings that begin with a user home or app-data prefix (home dir shorthands and platform app-data equivalents). Resolve each to an absolute path.
For each path:
- - If it is a file that exists: add it to the external files list.
- If it is a directory that exists: add all files inside it recursively to the list.
- If it doesn't exist yet: record it as a "created at runtime" entry.
Do not copy anything yet. Build the list first — it goes to the user for review in the next step.
Step 5 — Confirm with User
Present the user with everything that will be included in the ZIP:
- 1. All files from the skill directory
- The full list of detected external files with their resolved paths
Clearly warn: "These files will be packaged with their real values — including any credentials, tokens, or sensitive config. Review before sharing the ZIP."
Ask: "Proceed with packaging these files?"
- - If yes: stage the external files into
_external/, mirroring the directory structure relative to the user's home, then continue. - If no: abort and clean up staging. Do not create a ZIP.
Step 6 — Generate STRUCTURE.md
Write STRUCTURE.md into the staging dir with these sections in order:
Header — skill name, generation timestamp, one-line purpose statement.
Folder Layout — ASCII tree of the staging dir. Directories before files at each level, both sorted alphabetically. Use standard tree connectors (├──, └──, │). Directory names end with /.
File Descriptions table — two columns: relative file path and one-line purpose. Describe each file by what it does rather than its type. Well-known skill files have fixed descriptions:
| File | Description |
|---|
| INLINECODE9 | Main skill instructions. The LLM agent reads this to understand purpose, setup, and usage. |
| INLINECODE10 |
ClawhHub registry metadata: version, owner, credential paths, persistence info. |
|
STRUCTURE.md | This file. Auto-generated folder map and install guide. |
| Any other file | Infer purpose from filename, location, and content — describe what it does in plain English. |
External Files table — only if external files were detected. Three columns: file path inside the ZIP | target install path on the machine | notes. Determine the notes value by this logic:
| Condition | Notes |
|---|
| Path suggests credentials or config | Packaged with real values — review before sharing. |
| Path suggests a worker or background script |
Extracted from SKILL.md at runtime — included here for reference. |
| Path suggests a log, pid, or state file | Runtime-generated. Recreated automatically on first run. |
| File did not exist at export time | Not present at export — created automatically when the skill runs. |
| Anything else | External runtime file. Review SKILL.md for usage. |
Follow the table with a brief note on how to place _external/ files at their target paths on both Windows and Unix systems.
Install Instructions — three options:
- - Option A: install via ClawhHub if the skill is published
- Option B: manual — copy the skill folder into the workspace skills directory, place any
_external/ files at their target paths, confirm with INLINECODE14 - Option C: local clawhub install, then handle
_external/ files manually
Footer — credit line linking to the skill on ClawhHub.
Step 7 — Zip and Deliver
Confirm the output path with the user (default: the user's Desktop). Remove any existing ZIP at that path first. Compress the staging dir. Report the saved path and file size. Delete the staging folder.
Error Reference
| Problem | Cause | Fix |
|---|
| Skill not found | Name mismatch | Check spelling; run INLINECODE16 |
| Access denied on copy |
File ownership issue | Run as admin or check permissions |
| ZIP creation fails | Disk full or missing compression support | Free space or update runtime |
| Staging not cleaned | ZIP step failed | Delete the staging folder inside the workspace manually |
| External file missing | Runtime-generated, not yet created | Safe to skip — document as "created at runtime" |
| User declined confirmation | Sensitive files flagged by user | Abort — no ZIP created, staging cleaned up |
skill-extractor
将任何已安装的OpenClaw技能打包成一个干净、可分享的ZIP文件。SKILL.md中引用的外部运行时文件会被检测到,存放在_external/目录下并进行文档记录——这样新安装者就能确切知道每个文件属于哪里,并能复现完整功能。
所有文件操作仅在本地进行。不会向任何地方传输任何内容。在压缩前,用户需确认包含哪些文件。
代理规则
- - 在要求选择之前,始终先列出可用技能(除非技能名称已给出)
- 始终在暂存副本上操作——绝不修改原始技能目录或任何外部路径
- 在压缩之前,始终向用户展示找到的外部文件,并获得明确确认
- 文件按原样打包——不修改其中的值。告知用户敏感文件(凭证、令牌)将以其真实值包含在内,应在分享前进行审查
- 如果外部文件在磁盘上尚不存在(运行时生成),则将其记录为运行时创建——不要报错
- 在压缩前,在暂存文件夹内生成STRUCTURE.md
- 默认ZIP输出位置:用户的桌面——先与用户确认
- 如果目标位置已存在ZIP文件,则覆盖它
- 成功创建ZIP后,清理暂存文件夹
- 如果任何步骤失败,保留暂存文件夹不变并清晰报告
步骤1 — 列出可用技能
扫描所有已知的OpenClaw技能位置(工作区技能文件夹、用户本地技能文件夹以及捆绑的npm包技能文件夹),查找包含SKILL.md的子目录。以技能名称和来源的形式呈现列表。询问要导出哪个。
步骤2 — 定位技能
按名称查找技能文件夹。如果未找到,报告并停止。
步骤3 — 暂存技能文件
在工作区内创建一个以技能命名的隐藏临时暂存文件夹。将技能目录中的所有文件复制到其中。原始文件绝不触碰。
步骤4 — 检测外部文件
从原始技能目录中读取SKILL.md。提取所有以用户主目录或应用数据前缀开头的路径类字符串(主目录简写和平台应用数据等效项)。将每个路径解析为绝对路径。
对于每个路径:
- - 如果是存在的文件:将其添加到外部文件列表。
- 如果是存在的目录:递归地将其中的所有文件添加到列表。
- 如果尚不存在:将其记录为运行时创建条目。
此时不要复制任何内容。 先构建列表——该列表将在下一步交给用户审查。
步骤5 — 与用户确认
向用户展示将包含在ZIP中的所有内容:
- 1. 技能目录中的所有文件
- 检测到的外部文件的完整列表及其解析后的路径
清晰警告:这些文件将以其真实值打包——包括任何凭证、令牌或敏感配置。在分享ZIP文件前请进行审查。
询问:是否继续打包这些文件?
- - 如果是:将外部文件暂存到_external/中,相对于用户主目录镜像目录结构,然后继续。
- 如果否:中止并清理暂存文件夹。不创建ZIP文件。
步骤6 — 生成STRUCTURE.md
将STRUCTURE.md写入暂存目录,按顺序包含以下部分:
标题 — 技能名称、生成时间戳、一行目的说明。
文件夹布局 — 暂存目录的ASCII树。每级目录在前,文件在后,均按字母顺序排列。使用标准树形连接符(├──、└──、│)。目录名称以/结尾。
文件描述表 — 两列:相对文件路径和一行目的说明。根据文件的功能而非类型来描述每个文件。已知技能文件有固定描述:
| 文件 | 描述 |
|---|
| SKILL.md | 主要技能指令。LLM代理读取此文件以了解目的、设置和用法。 |
| _meta.json |
ClawhHub注册表元数据:版本、所有者、凭证路径、持久化信息。 |
| STRUCTURE.md | 本文件。自动生成的文件夹映射和安装指南。 |
| 任何其他文件 | 从文件名、位置和内容推断用途——用通俗易懂的英文描述其功能。 |
外部文件表 — 仅在检测到外部文件时包含。三列:ZIP内的文件路径 | 机器上的目标安装路径 | 备注。按以下逻辑确定备注值:
| 条件 | 备注 |
|---|
| 路径暗示凭证或配置 | 以真实值打包——分享前请审查。 |
| 路径暗示工作进程或后台脚本 |
运行时从SKILL.md中提取——此处包含以供参考。 |
| 路径暗示日志、PID或状态文件 | 运行时生成。首次运行时自动重新创建。 |
| 导出时文件不存在 | 导出时不存在——技能运行时自动创建。 |
| 其他情况 | 外部运行时文件。请查看SKILL.md了解用法。 |
在表格后附上关于如何在Windows和Unix系统上将_external/文件放置到其目标路径的简要说明。
安装说明 — 三个选项:
- - 选项A:如果技能已发布,通过ClawhHub安装
- 选项B:手动——将技能文件夹复制到工作区技能目录,将任何external/文件放置到其目标路径,使用openclaw skills list确认
- 选项C:本地clawhub安装,然后手动处理external/文件
页脚 — 指向ClawhHub上该技能的信用链接。
步骤7 — 压缩并交付
与用户确认输出路径(默认:用户的桌面)。首先移除该路径下任何现有的ZIP文件。压缩暂存目录。报告保存的路径和文件大小。删除暂存文件夹。
错误参考
| 问题 | 原因 | 修复 |
|---|
| 未找到技能 | 名称不匹配 | 检查拼写;运行 openclaw skills list |
| 复制时访问被拒绝 |
文件所有权问题 | 以管理员身份运行或检查权限 |
| ZIP创建失败 | 磁盘已满或缺少压缩支持 | 释放空间或更新运行时 |
| 暂存未清理 | ZIP步骤失败 | 手动删除工作区内的暂存文件夹 |
| 外部文件缺失 | 运行时生成,尚未创建 | 可以安全跳过——记录为运行时创建 |
| 用户拒绝确认 | 用户标记了敏感文件 | 中止——不创建ZIP,清理暂存文件夹 |