Codex:SKILL 搭建教程
·
制作 Skill 的核心,就是:把可重复的工作规则写进
SKILL.md,把稳定的脚本放进scripts/,再安装到 Codex
的个人 Skills 目录。

1. 先确定适合做成 Skill 的任务
适合做成 Skill 的任务通常是:
- 每次步骤几乎相同;
- 有固定输入、固定输出;
- 有明确规则或映射表;
- 经常需要运行同一段脚本。
例如:WooCommerce CSV 清洗、SEO 标题生成、固定格式报价表、产品图片批量命名。
2. 给 Skill 起名字
名称只使用小写英文、数字和连字符,例如:
woocommerce-cr-export
product-seo-checker
image-renamer
3. 初始化 Skill 文件夹
在 PowerShell 中执行:
python "C:\Users\Administrator\.codex\skills\.system\skill-creator\scripts\init_skill.py" your-skill-name --path "C:\Users\Administrator\.codex\skills" --resources scripts
例如:
python "C:\Users\Administrator\.codex\skills\.system\skill-creator\scripts\init_skill.py" product-seo-checker --path "C:\Users\Administrator\.codex\skills" --resources scripts
会生成:
C:\Users\Administrator\.codex\skills\product-seo-checker\
├─ SKILL.md
└─ scripts\
4. 编辑 SKILL.md
这是 Skill 的“大脑”。最重要的是开头的 name 和 description:description 要明确写出 Skill 做什么、什么情况下触发。
模板:
---
name: product-seo-checker
description: Check and improve product SEO data. Use when the user asks to audit product titles, meta descriptions, Yoast fields, WooCommerce product exports, or generate SEO recommendations from a CSV or Excel file.
---
# Product SEO Checker
Use the bundled scripts for repeatable processing.
## Workflow
1. Inspect the user-provided CSV or Excel file.
2. Confirm required columns are present.
3. Run the appropriate script in `scripts/`.
4. Save results as a new output file; do not overwrite the source unless requested.
5. Verify row counts, required columns, and formatting before delivery.
## Output requirements
- Preserve original data.
- Clearly label all added columns.
- Report validation results to the user.
5. 放入脚本、模板或参考资料
根据任务类型添加:
your-skill-name/
├─ SKILL.md # 必需:规则和流程
├─ scripts/ # 可选:Python、JS、Shell 脚本
├─ references/ # 可选:映射表、业务规则、接口说明
└─ assets/ # 可选:Excel 模板、图片、文档模板
例如 Python 脚本放在:
C:\Users\Administrator\.codex\skills\your-skill-name\scripts\process.py
然后在 SKILL.md 中写明如何调用它。
6. 验证 Skill
执行:
python "C:\Users\Administrator\.codex\skills\.system\skill-creator\scripts\quick_validate.py" "C:\Users\Administrator\.codex\skills\your-skill-name"
如果提示缺少 yaml,先安装一次:
python -m pip install pyyaml
再重新运行验证命令。
7. 重启或新开任务后使用
显式调用最可靠:
使用 $your-skill-name 处理我上传的文件。
例如:
使用 $woocommerce-cr-export 整理我上传的 WooCommerce 产品 CSV。
也可以自然描述任务;只要描述与 description 匹配,Codex 通常会自动选用这个 Skill。
一句话原则:SKILL.md 写“怎么做”,scripts/ 放“重复执行的代码”,description 写“什么时候用”。
更多推荐




所有评论(0)