Skill Scripts and Packaging skill for Codex
Helper scripts and files that earn their place. Codex decides which parts of a skill belong in SKILL.md, references, scripts or assets, writes standard-library helper scripts with clear exit codes that work offline under the sandbox, and links each file from SKILL.md with the exact command and when to use it. It adds agents/openai.yaml for invocation policy and MCP dependencies, then shares the skill by repo, user folder, installer or plugin.
curl -fsSL codexskills.dev/install.sh \ | sh -s -- skill-scripts-packaging Installs to ~/.agents/skills/skill-scripts-packaging/ for every project on this machine.
curl -fsSL codexskills.dev/cli.mjs -o codex-skills.mjsnode codex-skills.mjs install skill-scripts-packaging The CLI also searches, updates and removes skills. Run it with no arguments to pick from a list. Needs Node 20.12+.
curl -fsSL codexskills.dev/install.sh \ | sh -s -- --project skill-scripts-packaging Installs to .agents/skills/skill-scripts-packaging/ in the current repository. Commit it and everyone who runs Codex there gets it.
curl -fsSLO codexskills.dev/downloads/skill-scripts-packaging.zipunzip -o skill-scripts-packaging.zip -d ~/.agents/skills/ The archive holds the skill folder with its generated agents/openai.yaml. Unzip into .agents/skills/ to scope it to a repo.
& ([scriptblock]::Create((irm codexskills.dev/install.ps1))) skill-scripts-packaging PowerShell 5.1 or 7. Installs to %USERPROFILE%\.agents\skills\. Add -Project for the current repo.
104-line POSIX script. No sudo, no telemetry. Read install.sh
Use it in Codex
Start a prompt with $skill-scripts-packaging, or pick it from /skills.
You can also just describe the task: Codex reads the description below and loads the playbook when your request matches.
What Codex reads before loading it
Structures the supporting files of a Codex skill (scripts/, references/, assets/ and agents/openai.yaml with interface, policy and MCP tool dependencies), writes helper scripts that run under the sandbox with the standard library and clear exit codes, links references so they load only when needed, and shares skills through repo check-in, ~/.agents/skills, symlinks, $skill-installer or plugins. Use when a skill needs a helper script or reference docs, when a skill script fails in the sandbox, or when preparing a skill for teammates.
Use it when
- A skill needs a deterministic helper script
- SKILL.md is too long and needs references split out
- A skill should be on-demand only or depends on an MCP server
- Sharing a skill with a team or across machines
Use something else when
- You are still deciding what the skill should do: use skill-authoring
- You want to bundle several skills and MCP servers for distribution: use codex-plugin-packaging
How to check the result
Each script passes its fixtures with the expected exit codes and runs under codex sandbox; every bundled file is referenced from SKILL.md, and a fresh install in ~/.agents/skills loads and runs the skill.
The mistake it prevents
Bundling scripts that assume network access, the skill folder as cwd, or third-party packages, so they fail when Codex runs them in the sandbox.
Supporting files are worth adding only when they make Codex faster or more correct than prose would. A well-packaged skill keeps SKILL.md as the procedure, pushes rarely needed depth into references the body points to conditionally, uses scripts for deterministic work that runs offline in the sandbox, and installs by copying one folder.
Layout
my-skill/
├── SKILL.md # required: frontmatter + procedure
├── scripts/ # deterministic helpers Codex runs
├── references/ # depth Codex reads only in some branches
├── assets/ # templates, schemas, fixtures used to build output
└── agents/
└── openai.yaml # optional: UI metadata, invocation policy, tool dependencies
Every file must be mentioned in SKILL.md with when and how to use it; an unmentioned file is invisible to the agent.
Decide what goes where
| Content | Put it in | Signal |
|---|---|---|
| Steps, decisions, gotchas used on every run | SKILL.md | Needed > 50% of the time |
| Long catalogs, API tables, edge-case playbooks | references/<topic>.md | Needed in one branch; would push SKILL.md past ~300 lines |
| Parsing, validation, measuring, file generation | scripts/ | Same input should always give the same output |
| Output templates, JSON Schemas, config skeletons | assets/ | Copied or filled, not read for guidance |
| Display name, icon, implicit-invocation switch, MCP dependency | agents/openai.yaml | Product surface or policy, not instructions |
Prefer instructions over scripts unless the task needs determinism or the agent keeps getting a mechanical step wrong.
Workflow
- [ ] 1. Identify the deterministic steps worth scripting
- [ ] 2. Write each script to the contract below
- [ ] 3. Test scripts with fixtures, offline, in the sandbox
- [ ] 4. Link scripts and references from SKILL.md with exact commands and conditions
- [ ] 5. Add agents/openai.yaml if policy or dependencies require it
- [ ] 6. Package and share
2. Script contract
- Standard library only (Python 3.10+, POSIX sh, or Node 20+). If a dependency is truly required, check for it and print the install command instead of failing obscurely.
- Shebang line,
--help, arguments instead of hard-coded paths. - Paths in SKILL.md are relative to the skill folder; scripts must not assume the cwd
is the skill folder. Resolve their own location when they need sibling files:
HERE = Path(__file__).resolve().parent template = (HERE.parent / "assets" / "report.md").read_text() - Output: a short human summary on stdout, details on demand (
--json); errors to stderr. - Exit 0 on success, 1 on a failed check, 2 on usage errors. Codex reads exit codes.
- Read-only by default; write only to paths passed as arguments; never delete outside them.
- No network unless the skill says so, because Codex usually runs with network off. If a script needs network, say “needs network; ask the user to approve or run it” in SKILL.md.
- Idempotent: running twice gives the same result.
- Bounded output: truncate long listings with a count, so the result does not flood context.
3. Test
python3 scripts/check_thing.py --help
python3 scripts/check_thing.py tests/fixtures/good.json; echo "exit=$?" # expect 0
python3 scripts/check_thing.py tests/fixtures/bad.json; echo "exit=$?" # expect 1
codex sandbox macos -- python3 scripts/check_thing.py tests/fixtures/good.json # or: codex sandbox linux
The last line runs it under the same sandbox Codex uses, catching scripts that write to
$HOME, open sockets or rely on tools outside the sandbox. Test with the oldest
interpreter version you claim to support.
4. Link from SKILL.md
## Validate the manifest
Run `python3 scripts/check_manifest.py <path>`. Exit 1 lists each violation; fix them
and rerun until it exits 0.
Read [references/manifest-fields.md](references/manifest-fields.md) only when the
check reports an unknown field.
Give the exact command, what success looks like, and what to do on failure. Keep references one level deep: SKILL.md links to references, references do not chain to more references.
5. agents/openai.yaml
interface:
display_name: "Release Notes"
short_description: "Draft release notes from merged PRs"
icon_small: "./assets/icon-small.svg"
icon_large: "./assets/icon-large.png"
brand_color: "#3B82F6"
default_prompt: "Draft release notes since the last tag"
policy:
allow_implicit_invocation: false # only via $release-notes or /skills
dependencies:
tools:
- type: "mcp"
value: "openaiDeveloperDocs"
description: "OpenAI Docs MCP server"
transport: "streamable_http"
url: "https://developers.openai.com/mcp"
allow_implicit_invocation defaults to true. Set it to false for skills with side
effects (deploys, data changes) so they only run on request. Declared MCP dependencies
let Codex offer to install a missing server (feature skill_mcp_dependency_install, on
by default).
6. Share
| Audience | Method |
|---|---|
| Everyone working in one repo | Commit to .agents/skills/<name>/; review changes like code |
| Just you, all repos | Copy or symlink into ~/.agents/skills/<name>/ (symlinks are followed) |
| A machine or container image | /etc/codex/skills/<name>/ |
| Curated public skills | $skill-installer <name> installs from the curated catalog or a repo you point it at |
| Other teams, with versioning, or bundled with MCP servers | Package as a plugin (see codex-plugin-packaging) |
Before sharing: remove secrets, internal hostnames and personal paths; make scripts
executable (chmod +x scripts/*); lint the folder (the skill-authoring skill ships a
checker); note runtime requirements in SKILL.md.
Gotchas
- Skill scripts can raise their own approval prompts; with a granular approval policy,
skill_approval = falseauto-rejects them, so the script step silently fails in that setup. Document a manual fallback. $skill-installerand plugin installs bring third-party instructions and code onto the machine. Read SKILL.md and every script before first use.- A script that prints thousands of lines costs more context than the prose it replaced.
- Repo skills travel to Codex Cloud tasks; scripts there run in the cloud environment, so their tool requirements must be met by that environment’s setup.
- Binary assets bloat the repo and the zip; keep icons small and avoid large fixtures.
Output contract
**Skill:** release-notes
**Added:** scripts/collect_prs.py (stdlib, exit 0/1/2, tested on 3 fixtures and under codex sandbox), references/conventional-commits.md (linked conditionally), agents/openai.yaml (implicit invocation off)
**Shared via:** .agents/skills in repo (PR #412) What the zip contains
SKILL.md plus the interface file below. Nothing runs on install.
agents/openai.yaml
Gives the Codex app a display name, a one-line description and a starter prompt for this skill.
interface:
display_name: "Skill Scripts and Packaging"
short_description: "Helper scripts and files that earn their place"
default_prompt: "$skill-scripts-packaging Add a validation script to this skill and make sure it works in the Codex sandbox" About this skill
Written and maintained by the Codex Skills editors to the same editorial standard as every skill here: a selective description, a real workflow, known pitfalls and a way to verify the work. First published , last updated . MIT licensed. Something wrong or out of date? Tell us.