Creates a new skill in any project's ~/.codex/skills/ directory. Use when the user wants to create a skill for their project, add Codex capabilities, or says /skill.
Creates a new skill in the current project's ~/.codex/skills/ directory with proper structure, frontmatter, and content adapted to the skill's purpose.
Ask the user one question at a time:
run-tests, review-api, db-migrations). Let the user confirm or change.description field. Examples:
| Skill type |
|---|
Suggested allowed-tools |
|---|
| Read-only analysis | Read, Glob, Grep |
| File modifications | Read, Glob, Grep, Write, Edit |
| Shell commands needed | Read, Glob, Grep, Bash |
| Full access | Omit allowed-tools entirely |
Let the user confirm or adjust.
Before generating the skill, scan the project:
AGENTS.md (if exists) — Understand conventions, stack, naming patterns.~/.codex/skills/ (if exists) — List existing skills. Warn if a similar skill already exists.package.json, pom.xml, etc.) to understand the project's technology.Use this context to make the skill's content relevant to the project.
Based on the objective, determine which structure best fits. Do NOT force a category — adapt the structure to what the skill needs to accomplish.
Best for skills that define a process or procedure (e.g., TDD, deployment, code review).
## Overview
<one-line summary>
## Steps
1. <step>
2. <step>
...
## Rules
- <constraint>
- <constraint>
## Validation Checklist
- [ ] <check>
- [ ] <check>
Best for skills that provide architectural context or documentation (e.g., system overview, API patterns).
## System Overview
<what the system does>
## Architecture
<components, layers, data flow>
## Patterns & Conventions
<how code is organized, naming, structure>
## Troubleshooting
| Problem | Cause | Solution |
|---------|-------|----------|
Best for skills that integrate with external tools or services (e.g., deploy, database, API calls).
## Configuration
<setup, prerequisites, credentials>
## Usage
<how to use, with examples>
## Reference
<API endpoints, commands, field mappings>
## Common Errors
| Error | Cause | Fix |
|-------|-------|-----|
Best for skills that define autonomous behavior (e.g., code review bot, test runner, linter).
## Objective
<what the agent accomplishes>
## Scope
<boundaries — what to do and what NOT to do>
## Available Tools
<which tools to use and when>
## Execution Loop
1. <check/analyze>
2. <decide>
3. <act>
4. <verify>
5. <stop when...>
## Success Criteria
- <criterion>
## Failure Handling
- <what to do when blocked>
If none of the above fit well, create a structure tailored to the objective. The key principles:
Create the file with:
name, description (with trigger context), and optionally allowed-tools# <Skill Name> (human-readable, not kebab-case)Writing guidelines:
Show the full SKILL.md content to the user:
Here's the skill I've generated:
<full content>Does this look good, or would you like changes?
Apply any requested changes before saving.
After approval:
~/.codex/skills/<name>/SKILL.md~/.codex/skills/ with proper SKILL.md frontmatter are auto-discovered by Codex. No manual registration is needed..claude/settings.json:
{
"skills": {
"<name>": {
"path": "~/.codex/skills/<name>/SKILL.md"
}
}
}
Before finishing, verify:
name, description)name is kebab-case and matches the directory namedescription includes trigger context (when to invoke)~/.codex/skills/<name>/