Skip to main content

Module skills

Module skills 

Source
Available on crate feature skills only.
Expand description

Agent Skills in the tool loop, without running their scripts (ADR 0035; feature skills).

Agent Skills is a format for reusable procedures: a directory with a SKILL.md (YAML frontmatter with a name and a description, then Markdown instructions) and optionally scripts/, references/ and assets/. A client tells the model each skill’s name and description, and loads a skill’s instructions, then its files, only when the task calls for them. It is not A2A’s AgentSkill, which an agent card advertises to other agents; the two meet in SkillCatalog::agent_skills.

 skills directory ──discover──→ SkillCatalog ──┬─ prompt()  ─→ system prompt (names, descriptions)
 (SKILL.md files)               + diagnostics  ├─ activate_skill ─→ the instructions
                                               └─ read_skill_file ─→ references/, assets/ (confined)
                                                  scripts/ are listed as present, never run

§Use

use a2a_protocol_server::skills::{SkillCatalog, SkillSource, SkillsConfig};
use a2a_protocol_server::tool_loop::{OpenAiChatModel, ToolLoop, ToolLoopExecutor, ToolSet};

let catalog = SkillCatalog::discover(
    &SkillsConfig::new().with_source(SkillSource::operator("/etc/my-agent/skills")),
);
for problem in catalog.diagnostics() {
    eprintln!("{problem}");
}
let model = OpenAiChatModel::new("http://127.0.0.1:8080/v1", "qwen3:1.7b")?;
let executor = ToolLoopExecutor::new(ToolLoop::new(model, ToolSet::new()))
    .with_skills(&catalog)?;

§What it does and does not do

  • Discovery never fails. SkillCatalog::discover returns a catalog and a list of SkillDiagnostics. A SKILL.md that is malformed, or whose name is not its directory’s, is reported and, where it can be used safely, still used; one that cannot is skipped, with the reason. Nothing panics and start-up is not refused.
  • Bounded. At most DEFAULT_MAX_SKILLS skills, a description of at most DEFAULT_MAX_DESCRIPTION_CHARS characters in the prompt, a body of at most DEFAULT_MAX_BODY_BYTES and a file of at most DEFAULT_MAX_RESOURCE_BYTES returned; each is set on SkillsConfig. The frontmatter’s size is checked before it is read as YAML.
  • No script is run. scripts/ is listed to the model as present and read_skill_file does not return it. Running them needs a sandbox this SDK does not have, and a skills directory is an injection channel (docs/injection-containment.md).
  • No skill widens the tool set. allowed-tools is recorded and never acted on.
  • Trust by scope. An operator directory (SkillSource::operator) is the operator’s own text. A project directory (SkillSource::project) is not read until the operator marks it trusted, and its skills never take the name of an operator’s.
  • A snapshot. Skills are read at discover and not again: the prompt and the tools’ schemas stay what the model was told. Discover again, and build a new executor, to pick up a change.

§The specification

Agent Skills has no versioned releases, so this module follows the specification text as read on SPEC_SNAPSHOT, and names that date in the diagnostics about fields it does not know. The YAML frontmatter is read by a reader of the subset the specification’s reference parser accepts (all scalars are strings; no anchors, aliases, tags or flow collections), in this crate, because that is a small job and adds no dependency (ADR 0035, decision 9).

Structs§

ActivateSkillTool
activate_skill: returns a skill’s instructions and lists its files.
ReadSkillFileTool
read_skill_file: returns the text of a file under a skill’s references/ or assets/, through the confined reader.
Skill
One skill: a directory with a SKILL.md, read at discovery.
SkillCatalog
The skills found in the configured directories, and what was noticed on the way.
SkillDiagnostic
One thing discovery noticed. See SkillCatalog::diagnostics.
SkillSource
One directory whose subdirectories are skills.
SkillsConfig
What SkillCatalog::discover scans and the bounds it keeps to.

Enums§

DiagnosticKind
What a diagnostic is about, stable enough to match on. The message says the particulars.
Severity
How much a diagnostic matters.
SkillScope
Where a skills directory comes from, which decides how far it is trusted.

Constants§

ACTIVATE_SKILL_TOOL
The name of the tool that loads a skill’s instructions.
AGENT_SKILL_TAG
The tag on the AgentSkill a skill is advertised as.
DEFAULT_MAX_BODY_BYTES
The largest SKILL.md body kept when no other bound is set: 64 KiB.
DEFAULT_MAX_DESCRIPTION_CHARS
The most characters of a description the prompt’s catalog shows when no other bound is set.
DEFAULT_MAX_RESOURCE_BYTES
The largest file read_skill_file returns when no other bound is set: 64 KiB. A larger file is refused, not truncated.
DEFAULT_MAX_SKILLS
The most skills a catalog holds when no other bound is set.
READ_SKILL_FILE_TOOL
The name of the tool that reads a file a skill bundles.
SPEC_SNAPSHOT
The date the specification text this module follows was read, as YYYY-MM-DD. Named in the diagnostics about fields this module does not understand, because the specification may have changed since.