How do you write your own Codex skills workflow? The simplest answer: take the instructions you repeatedly paste into Codex and turn them into a discoverable, maintainable SKILL.md.
If a task is one-off, just write the prompt. A skill is worth creating only when the workflow repeats, has stable steps, reads similar files, runs similar commands, or produces similar output.
Quick Answer
A useful Codex skill usually has four traits:
descriptionsays when to use it, not just what it is.SKILL.mddescribes workflow, boundaries, inputs, outputs, and verification.- Long references go in
references/; repeatable commands go inscripts/; templates go inassets/. - After every change, test it with a real task to confirm it triggers when it should and stays quiet when it should not.
Good skill candidates include:
|
|
The right unit for a skill is not a knowledge topic. It is a repeatable way of working.
Skill, AGENTS.md, Hooks, and MCP
Before writing a skill, put the rule in the right place.
| Need | Better place |
|---|---|
| One-off task requirement | Current prompt |
| Repository conventions, test commands, commit rules | AGENTS.md |
| Reusable task workflow | Skill |
| Mechanical rule before or after tool use | Hook |
| External systems, databases, private services | MCP server or app connector |
| Scheduled checks or reports | Automation |
| Installable bundle of multiple capabilities | Plugin |
For example, “always format after editing” is more like a hook. “Review PRs by checking security, edge cases, and test gaps” is more like a skill. “This repo uses pnpm, not npm” belongs in AGENTS.md.
Minimal Directory Structure
A minimal skill can be one file:
|
|
A larger one can be:
|
|
Common roles:
SKILL.md: entry instructions, when to use, how to run, how to verify.references/: long background, examples, rubrics, terminology tables.scripts/: stable mechanical commands.assets/: templates, sample files, prompt fragments, report formats.
Do not create folders just to look professional. Start small.
Basic SKILL.md Template
|
|
You do not need every heading, but the skill should answer these questions.
The Description Is the Key Line
Weak:
|
|
Better:
|
|
The description should include trigger, input, output, and boundary. If natural-language tasks do not trigger the skill, the description is probably too vague.
Turn Prompts into Workflow
A prompt is often a one-off instruction:
|
|
A skill should be a procedure:
|
|
Procedures are easier to execute and easier to audit.
When to Split References
Move long material to references/ when it includes:
- long style guides;
- many output examples;
- terminology tables;
- API field descriptions;
- scoring rubrics;
- translation maps;
- domain rules;
- background not needed every time.
Keep SKILL.md as the router:
|
|
This reduces context waste.
When to Add Scripts
Script a step if it is stable, mechanical, and easy to get wrong.
Good script candidates:
- scanning files and generating an inventory;
- validating front matter;
- converting JSON to Markdown tables;
- downloading fixed-source data;
- running fixed build commands;
- batch image conversion;
- checking links, slugs, dates, or language files.
Keep judgment in Codex. Put mechanical execution in scripts.
Example: Weekly Report Skill
|
|
SKILL.md:
|
|
The value is the fixed process, not just “write a report.”
Example: Code Review Skill
|
|
This keeps review posture consistent.
Example: Blog Publishing Skill
|
|
This prevents expensive mistakes such as writing to the wrong directory or changing a public URL.
Test Your Skill
After writing a skill, test three things.
First, can it be selected?
|
|
Also test natural language:
|
|
Second, are the steps clear after selection? Watch whether Codex reads the right files, runs the right scripts, and follows the constraints.
Third, does it avoid false triggers? If ordinary Q&A triggers the skill, narrow the description.
Common Mistakes
Turning a Skill into an Encyclopedia
A skill is not a knowledge base. Put background in references/; keep the entry file focused on doing the work.
Vague Description
Keywords like “Codex, workflow, automation” are not enough. Codex needs to know when to use it, what input it handles, and what output it produces.
No Completion Criteria
Without verification, Codex may say it is done too early. Write how to check files, commands, format, or results.
Dangerous Scripts
Do not default to deleting, overwriting, publishing, paid API calls, or mass renames. High-risk actions need confirmation.
One Giant Skill
“My universal workflow” is hard to maintain. Split into small skills: writing, translation, deployment, SEO, review, weekly report.
Maintenance
Change one small thing after each failure:
- missed trigger -> improve
description; - triggered but unstable -> improve
Workflow; - output format drifts -> improve
Reportingor templates; - repeated command -> move it to
scripts/; SKILL.mdtoo long -> move background toreferences/.
Treat skills like code: small, testable, and maintained.
References
Summary
Codex skills are not just saved prompts. They turn repeatable workflows into discoverable, executable, verifiable project assets.
Start small. Write a specific description, define inputs and outputs, list the workflow, document constraints, script mechanical steps, and test both triggering and non-triggering cases.