skill-creator quick_validate.py still fails without undeclared PyYAML dependency
Summary
skill-creator/scripts/quick_validate.py still fails in a clean Python environment because it imports yaml at module load time, while the bundled skill-creator does not include a requirements.txt, pyproject.toml, or another dependency bootstrap mechanism.
This is related to #11990, but the fix in #12080 only lazy-loaded PyYAML in generate_openai_yaml.py so that init_skill.py can run without PyYAML. It did not update quick_validate.py.
Reproduction
- Use a Python environment without PyYAML installed.
- Run:
python3 ~/.codex/skills/.system/skill-creator/scripts/quick_validate.py /path/to/a/skill
- The script exits before validating the skill:
Traceback (most recent call last):
...
ModuleNotFoundError: No module named 'yaml'
Expected
The bundled Skill validator should either:
- run without undeclared third-party dependencies, or
- provide and document a deterministic way to install/run its Python dependencies.
Actual
quick_validate.py imports yaml unconditionally:
import yaml
The bundled skill-creator directory does not include a Python dependency manifest, so the validation step documented by the Skill fails on a clean Python installation.
Current source
The same unconditional import is present on main:
codex-rs/skills/src/assets/samples/skill-creator/scripts/quick_validate.py
Environment
- Codex CLI: 0.135.0
- OS: macOS Apple Silicon
- Python environment: clean environment without PyYAML
Suggested fixes
Any of the following would resolve the issue:
- Make the validator self-contained.
- Bundle a dependency manifest and invoke it through a managed environment.
- Add a PEP 723 inline dependency declaration and a documented runner.
- At minimum, catch the missing dependency and print an actionable installation command instead of a traceback.
A local workaround is to run the validator in an isolated environment, for example:
uv run --isolated --no-project --with PyYAML python \
~/.codex/skills/.system/skill-creator/scripts/quick_validate.py \
/path/to/a/skill
3 Comments
Ran into this one too. The root cause is small:
quick_validate.pyimports PyYAML at the top of the module, whereas its siblinggenerate_openai_yaml.pywas already switched to a lazy import back in #12080 — this script just got missed in that sweep. So on a clean environment the documented validation step dies with a bareModuleNotFoundError: No module named 'yaml'before it can tell you anything useful.Since the validator genuinely needs a YAML parser, the cleanest fix (one of the options you listed) is to import it lazily and turn a missing dependency into an actionable message instead of a traceback — dropping the top-level
import yamland doing this right before it's needed invalidate_skill:It slots in cleanly because
validate_skillalready returns(bool, message)and__main__just prints the message and exits non-zero.I checked both paths: in a fresh venv without PyYAML it now prints that message and exits 1 (no traceback), and with PyYAML installed it validates exactly as before.
One aside — the same top-level
import yamlalso lives inplugin-creator/scripts/validate_plugin.py, so it'd hit the same wall; might be worth folding into the same fix. Happy to put a PR together if that's helpful.Confirmed this still reproduces on a newer macOS desktop/runtime bundle.
Environment:
26.715.3125126.715.121430.144.426.5.2(25F84), Apple Silicon3.14.43.12.13Both the default Homebrew Python and Codex's bundled Python fail before validation starts:
So the documented validator still cannot run with either Python environment supplied/available to Codex without an ad hoc dependency installation or substitute validator.
I reproduced this with the Codex Desktop bundled Python on Windows 11.
importlib.util.find_spec("yaml")returnsNone:and because
import yamlruns at module level,quick_validate.pyexits before it evaluates the skill when PyYAML is unavailable.This is the same failure reported in #24195 and #30935, and the unconditional import remains in current
main.The
uv run --with PyYAMLworkaround validates the skill, but it relies on a user-managed environment; installing into the Codex runtime is not durable because runtime and bundle updates replace it.Could a maintainer confirm the intended resolution and invite an external PR? I would keep the change narrow: make the validator's dependency contract deterministic (the team-preferred option of declared/bundled PyYAML or a supported self-contained fallback).