Skip to content

Skills

ox-core discovers SKILL.md skill files from ordered search roots and exposes them through progressive disclosure, deterministic auto-loading, and agent role metadata.

SkillRegistry::default_roots scans directories in precedence order, so project-local skills override global skills on name collision:

  1. <cwd>/.agents/skills
  2. <cwd>/.ox/skills
  3. $XDG_CONFIG_HOME/ox/skills
  4. ~/.config/ox/skills

SkillRegistry::discover_with_defaults appends any caller-supplied extra roots after the default roots, including <package_root>/skills directories from configured package_roots (see Package Roots). Missing roots, unreadable directories, and malformed SKILL.md files are skipped without aborting discovery.

Each skill lives in <root>/<dir>/SKILL.md and begins with a --- YAML frontmatter block defining name, description, and optional activation, matcher, and role fields:

---
name: rust-review
description: Check Rust changes for idioms, error handling, and test coverage.
activation: on_demand
on_files: *.rs, Cargo.toml
on_tools: edit, write
model: claude-sonnet-5-5
tools: read, grep, glob
---
# Rust Review
Run `cargo clippy --all-targets -- -D warnings` before approving changes.
Field Type Default Description
name string Required Unique skill identifier (single-line, quoted / unquoted)
description string Required Short summary rendered in the system prompt index
activation string on_demand on_demand or always (auto-injected into the system prompt at start)
on_files string None Comma-separated file globs matched against path / file_path tool arg
on_tools string None Comma-separated tool name globs matched before tool execution
model string None Optional model / profile hint for agent roles
tools string None Optional comma-separated tool allowlist for agent roles
user_invocable boolean true for on_demand, else false Whether the TUI exposes the skill as a /<name> slash command

Unknown frontmatter keys and # comment lines are ignored. Invalid activation or user_invocable values fail parsing.

  • Prompt index: SkillRegistry::prompt_index returns None when no skills are registered, or a deterministic - <name>: <description> list for system prompt injection without embedding full skill bodies.
  • On-demand loading: LoadSkillTool implements Tool under the name load_skill with schema { "name": string }. Calling it reads the matching SKILL.md file from disk, strips its frontmatter, and returns the Markdown body. Unknown skill names return a tool error.
  • Session-start injection: When a SkillRegistry is attached via Agent::with_skills, all skills with activation: always are injected into the system prompt at session start and marked loaded.
  • Matcher-driven injection: Before each tool executes, Agent evaluates on_files against the tool call’s path / file_path argument and on_tools against the tool name. Matching skills not yet loaded are injected into the tool context and marked loaded so each skill is injected at most once per session.
  • User-invocable slash commands: Calling CommandRegistry::register_skills or App::with_skills in ox-tui registers every skill with user_invocable: true as /<name> with its frontmatter description, skipping names that collide with existing commands or aliases. Dispatching /<name> [args] loads the skill body, wraps it in <skill name="...">...</skill> with any trailing user arguments, and returns CommandEffect::SubmitPrompt.