Codex SkillHub package conversion
When to use
Use this when:
- The source bundle is a local skill export that is not directly installable by Codex.
- The user asks for "codex 可以安装的格式", a packaged
.skilloutput, or a direct install into~/.codex/skills/. - The bundle contains multiple specialist skills and benefits from a top-level router skill.
Do not use this when:
- The source is already a valid Codex skill directory with a clean
SKILL.md. - The task is only to explain what an existing installed skill does.
- The user wants a repo-local skill for one project rather than a converted external bundle.
Inputs / context to gather
- Confirm the source path from
$ARGUMENTSor the user request. - Inspect the bundle shape first:
manifest.jsonskillsets/*.md- zipped child skills
- existing
SKILL.md
- Decide the output mode:
install: validate, package if useful, and copy to~/.codex/skills/package-only: leave a converted bundle folder and optional.skillarchives
- Check whether the bundle should keep all child skills or only a focused subset.
Procedure
- Inventory the source bundle.
- Find
manifest.json,skillsets/, archives, and any existingSKILL.md. - Identify the natural router name and the child skill list.
- Find
- Expand to Codex directory shape.
- Create one directory per installed skill.
- Ensure each child skill has
SKILL.md. - Add
agents/openai.yamlonly when it improves discoverability or the bundle already uses that presentation layer.
- Normalize frontmatter before any packaging.
- Keep required top-level fields like
nameanddescription. - Move SkillHub-only presentation fields such as
label,homepage,category,version,model, orkeywordsundermetadataor remove them from top level. - Quote descriptions that contain YAML-breaking colons.
- Align each
namewith the directory name, using lowercase kebab-case where needed.
- Keep required top-level fields like
- Add a router skill when the bundle is multi-skill.
- The router should describe when to use the bundle and how to route to each child skill.
- Keep the router small and task-oriented.
- Validate early.
- Run
quick_validate.pyon the converted skills. - If the bundle contains Python resources, run a lightweight syntax pass such as
python3 -m compilealland then remove__pycache__.
- Run
- Package correctly.
- Run
python3 -m scripts.package_skillfrom theskill-creatorproject root, not as a loose script from an arbitrary directory. - Verify the archive layout is
skill-name/SKILL.md.
- Run
- Install only if requested.
- Copy validated skill directories into
~/.codex/skills/. - Keep the converted bundle folder separate so the user can delete it later if they want.
- Copy validated skill directories into
- Explain the result.
- Summarize what the router skill does.
- List the child skills and their main triggers in plain language.
Efficiency plan
- Start by fixing frontmatter and names; that catches most install failures early.
- Reuse one conversion pattern across sibling bundles instead of redesigning each one.
- Create the router once the child set is stable; do not rewrite it after every file tweak.
- Stop after validation plus the requested install/package output is proven.
Pitfalls and fixes
- Codex rejects the skill even though the body looks fine
- Likely cause: invalid frontmatter or non-Codex top-level keys.
- Fix: keep top-level frontmatter minimal and move extra metadata under
metadata.
package_skill.pycannot import its helpers- Likely cause: it was run from the wrong working directory.
- Fix: run
python3 -m scripts.package_skillfrom theskill-creatorroot.
- The converted bundle is bloated with unrelated generic skills
- Likely cause: the source export mixed core domain skills with broad extras.
- Fix: keep only the domain core plus the router when that matches the user’s goal.
- Python resource bundles look dirty after validation
- Likely cause:
compileallleft__pycache__. - Fix: delete
__pycache__before final packaging.
- Likely cause:
- The user still asks what the installed bundle can do
- Likely cause: the run stopped at file conversion.
- Fix: always end with a router-plus-children capability summary.
Verification checklist
- Every installed skill directory has a valid
SKILL.md. - Top-level frontmatter is Codex-compatible and names match folders.
- Multi-skill bundles have a clear router skill.
- Validation passed before packaging or install.
- If packaging was requested, the archives contain
skill-name/SKILL.md. - If install was requested, the validated skills exist under
~/.codex/skills/. - The final handoff explains what the router and child skills do.