My Skill Template
Core Idea
A skill is a lazy-loaded operating manual. Do not treat frontmatter as decoration.
Skill loading has three layers:
- Frontmatter — loaded for all skills at startup. It is the trigger contract and should be compact.
- SKILL.md body — loaded only when the model decides the skill should be used. Keep it concise, ideally under 100 lines and never over 500 lines.
- Bundled resources —
references/, templates/, scripts/, and assets/ are used only when they serve the task.
This keeps many installed skills from blowing up context: many small frontmatters stay cheap, one relevant SKILL.md loads on demand, and detailed files load only when needed.
When to Use
Use this skill before changing any Codex personal skill, including creating a new skill, editing an existing skill, rewriting, splitting, refactoring, reviewing, or improving one.
Also use it when deciding whether a new skill needs only SKILL.md or a fuller directory with resources.
Do not use it for merely listing, reading, or summarizing existing skills without changing them.
Frontmatter Is the Trigger
Every skill description must answer three questions:
- 做什么 — what the skill does.
- 什么情况下触发 — when the skill should be loaded.
- 不做什么 — what the skill must not handle, including escalation cases.
Bad frontmatter wastes the whole lazy-loading mechanism. If the trigger is vague, the model either loads the skill too often or misses it when needed.
Preferred description shape:
description: "Use when <trigger>. Helps <do what>. Do not use when <boundary>; escalate when <risk case>."
Size Rules
- Frontmatter: compact, trigger-focused, around 100 tokens when possible.
SKILL.md: ideally under 100 lines; hard maximum 500 lines.
- Move detailed policies, examples, FAQs, classification rules, tone guides, and red lines into
references/.
- Move reusable reply/report/output formats into
templates/.
- Put deterministic, repeated, or fragile operations into
scripts/.
- Put output resources such as images, fonts, and starter files into
assets/.
Path Decision
Default to global user skills for this user's personal workflows:
~/.codex/skills/<skill-name>/
Use project or repository-local instructions only when the user explicitly asks for repo-specific behavior. In that case, discuss the target path before writing; do not invent repo skill directories.
<project-specific path chosen after discussion>
Resource Decision
Choose the smallest shape that works:
SKILL.md only: simple rules, short workflow, no reusable files.
references/: long policies, examples, schemas, API notes, or framework variants.
templates/: reusable output formats, report shells, prompt bodies, document skeletons.
scripts/: deterministic helpers, repeated code, fragile commands, validators.
assets/: files copied into outputs, images, fonts, examples, starter projects.
agents/openai.yaml: optional UI metadata for public or polished reusable skills; skip for quick personal-only skills unless the user asks.
Freedom Level
Match instruction strictness to task risk:
- High freedom: judgment-heavy tasks; write principles and decision rules.
- Medium freedom: common workflow with variation; write steps plus templates.
- Low freedom: fragile or compliance-critical work; provide scripts and exact validation.
Directory Pattern
Simple skill:
skill-name/
└── SKILL.md
Workflow skill:
skill-name/
├── SKILL.md
├── references/
└── templates/
Tool or asset skill:
skill-name/
├── SKILL.md
├── scripts/
└── assets/
Only create supporting files that have a real purpose. Avoid empty placeholders.
Creation Workflow
- If the request is unclear, discuss the skill name, trigger, boundaries, path, and needed files first.
- Write frontmatter as the trigger contract before writing the body.
- Choose the resource shape and freedom level before creating files.
- Keep
SKILL.md short: role, when to use, workflow, red lines, output format, verification.
- Put details into targeted
references/ files and reusable formats into templates/.
- Put deterministic helpers into
scripts/ and output resources into assets/ only when needed.
- Validate file layout and line count.
- For overloaded existing skills, see
references/refactoring-overloaded-skills.md: back up the main file, preserve details in class-level references/templates, and avoid changing live automations while cleaning up skills.
- Tell the user exactly what was created or changed.
Verification Checklist
1---2name: my-skill-template3description: Use before creating, editing, rewriting, splitting, refactoring, reviewing, or improving any Codex personal skill. Enforces trigger contracts, boundaries, file layout, concise SKILL.md bodies, lazy-loaded resources, and official-compatible skill structure. Do not use for merely listing or summarizing skills without changing them.4license: MIT5---67# My Skill Template89## Core Idea1011A skill is a lazy-loaded operating manual. Do not treat frontmatter as decoration.1213Skill loading has three layers:14151. **Frontmatter** — loaded for all skills at startup. It is the trigger contract and should be compact.162. **SKILL.md body** — loaded only when the model decides the skill should be used. Keep it concise, ideally under 100 lines and never over 500 lines.173. **Bundled resources** — `references/`, `templates/`, `scripts/`, and `assets/` are used only when they serve the task.1819This keeps many installed skills from blowing up context: many small frontmatters stay cheap, one relevant `SKILL.md` loads on demand, and detailed files load only when needed.2021## When to Use2223Use this skill before changing any Codex personal skill, including creating a new skill, editing an existing skill, rewriting, splitting, refactoring, reviewing, or improving one.2425Also use it when deciding whether a new skill needs only `SKILL.md` or a fuller directory with resources.2627Do not use it for merely listing, reading, or summarizing existing skills without changing them.2829## Frontmatter Is the Trigger3031Every skill description must answer three questions:32331. **做什么** — what the skill does.342. **什么情况下触发** — when the skill should be loaded.353. **不做什么** — what the skill must not handle, including escalation cases.3637Bad frontmatter wastes the whole lazy-loading mechanism. If the trigger is vague, the model either loads the skill too often or misses it when needed.3839Preferred description shape:4041```yaml42description: "Use when <trigger>. Helps <do what>. Do not use when <boundary>; escalate when <risk case>."43```4445## Size Rules4647- Frontmatter: compact, trigger-focused, around 100 tokens when possible.48- `SKILL.md`: ideally under 100 lines; hard maximum 500 lines.49- Move detailed policies, examples, FAQs, classification rules, tone guides, and red lines into `references/`.50- Move reusable reply/report/output formats into `templates/`.51- Put deterministic, repeated, or fragile operations into `scripts/`.52- Put output resources such as images, fonts, and starter files into `assets/`.5354## Path Decision5556Default to global user skills for this user's personal workflows:5758```text59~/.codex/skills/<skill-name>/60```6162Use project or repository-local instructions only when the user explicitly asks for repo-specific behavior. In that case, discuss the target path before writing; do not invent repo skill directories.6364```text65<project-specific path chosen after discussion>66```6768## Resource Decision6970Choose the smallest shape that works:7172- `SKILL.md` only: simple rules, short workflow, no reusable files.73- `references/`: long policies, examples, schemas, API notes, or framework variants.74- `templates/`: reusable output formats, report shells, prompt bodies, document skeletons.75- `scripts/`: deterministic helpers, repeated code, fragile commands, validators.76- `assets/`: files copied into outputs, images, fonts, examples, starter projects.77- `agents/openai.yaml`: optional UI metadata for public or polished reusable skills; skip for quick personal-only skills unless the user asks.7879## Freedom Level8081Match instruction strictness to task risk:8283- High freedom: judgment-heavy tasks; write principles and decision rules.84- Medium freedom: common workflow with variation; write steps plus templates.85- Low freedom: fragile or compliance-critical work; provide scripts and exact validation.8687## Directory Pattern8889Simple skill:9091```text92skill-name/93└── SKILL.md94```9596Workflow skill:9798```text99skill-name/100├── SKILL.md101├── references/102└── templates/103```104105Tool or asset skill:106107```text108skill-name/109├── SKILL.md110├── scripts/111└── assets/112```113114Only create supporting files that have a real purpose. Avoid empty placeholders.115116## Creation Workflow1171181. If the request is unclear, discuss the skill name, trigger, boundaries, path, and needed files first.1192. Write frontmatter as the trigger contract before writing the body.1203. Choose the resource shape and freedom level before creating files.1214. Keep `SKILL.md` short: role, when to use, workflow, red lines, output format, verification.1225. Put details into targeted `references/` files and reusable formats into `templates/`.1236. Put deterministic helpers into `scripts/` and output resources into `assets/` only when needed.1247. Validate file layout and line count.1258. For overloaded existing skills, see `references/refactoring-overloaded-skills.md`: back up the main file, preserve details in class-level references/templates, and avoid changing live automations while cleaning up skills.1269. Tell the user exactly what was created or changed.127128## Verification Checklist129130- [ ] Frontmatter says what the skill does, when to trigger, and what not to handle131- [ ] `SKILL.md` is under 100 lines if possible and under 500 lines always132- [ ] Details are split into `references/` instead of bloating `SKILL.md`133- [ ] Reusable formats are in `templates/`134- [ ] Scripts/assets exist only when they serve repeated, deterministic, or output-file needs135- [ ] Optional UI metadata is deliberate, not automatic136- [ ] Freedom level matches task fragility137- [ ] Global vs project path was chosen deliberately138- [ ] No secrets or temporary task progress were stored