How skills work
Injection
Skill names and descriptions are injected into the agent’s system prompt so it knows what skills are available.
Matching
When a user request matches a skill’s description, the agent reads the full skill instructions.
Enabling skills
Addskills: true to an agent config and include the filesystem toolset so the agent can read skill files:
SKILL.md format
Each skill is a directory containing aSKILL.md file with YAML frontmatter:
Frontmatter fields
| Field | Required | Description |
|---|---|---|
name | Yes | Unique skill identifier |
description | Yes | Short description shown to the agent for skill matching |
context | No | Set to fork to run the skill as an isolated sub-agent |
allowed-tools | No | List of tools the skill needs (YAML list or comma-separated string) |
license | No | License identifier (e.g., Apache-2.0) |
compatibility | No | Free-text compatibility notes |
metadata | No | Arbitrary key-value pairs (e.g., author, version) |
Running a skill as a sub-agent
By default, when an agent invokes a skill it reads the instructions inline into its own conversation. For complex, multi-step skills this can consume context and pollute the parent conversation. Setcontext: fork in the frontmatter to run the skill in an isolated sub-agent instead:
context: fork, the agent uses the run_skill tool instead of read_skill. This:
- Spawns a child session with the skill as the system prompt
- Isolates the context window — the sub-agent’s tool-call chains don’t affect the parent’s token budget
- Folds the result — only the sub-agent’s final answer is returned to the parent
- Inherits the parent’s model and tools
Invoking skills
Skills can be invoked in multiple ways:- Automatic — the agent detects when your request matches a skill and loads it automatically
- Explicit — reference the skill name in your prompt:
"Use the create-dockerfile skill to..." - Slash command — type
/{skill-name}in the TUI
Search paths
Skills are discovered from these locations (later overrides earlier):Global
| Path | Search type |
|---|---|
~/.codex/skills/ | Recursive |
~/.claude/skills/ | Flat (immediate children only) |
~/.agents/skills/ | Recursive |
Project (from git root toward current directory)
| Path | Search type |
|---|---|
.claude/skills/ | Flat |
.agents/skills/ | Flat (each directory from git root to cwd) |
Precedence
When multiple skills share the same name, global skills load first, then project skills from git root toward the current directory. Skills closer to the current directory win.Creating a skill
skills: true.