Skills¶
Agent skills framework for structured tool definitions. See the Agent Skills guide for usage examples.
Core¶
Skill
dataclass
¶
Full skill definition including instructions body.
read_reference ¶
Read a reference file by name.
Raises:
| Type | Description |
|---|---|
ValueError
|
If filename contains path traversal characters. |
FileNotFoundError
|
If the reference file does not exist. |
SkillMetadata
dataclass
¶
SkillMetadata(name, description, license=None, compatibility=None, allowed_tools=None, extra_metadata=dict())
Lightweight metadata parsed from SKILL.md frontmatter.
gated_tool_names
property
¶
Parse allowed_tools into a list of tool names.
The allowed_tools field is a comma-separated string. Returns an
empty list when the field is None or blank.
ScriptResult ¶
Bases: BaseModel
Result of executing a skill script.
SkillRegistry ¶
Discover, load, and manage Agent Skills.
Lightweight metadata is parsed on discover/register. Full skill
instructions are loaded lazily on first get_skill() call and
cached for subsequent access.
discover ¶
Scan directories for subdirectories containing SKILL.md.
Returns the number of newly discovered skills. Invalid skills are warned and skipped.
register ¶
Register a single skill directory.
Parses frontmatter only (lightweight). Replaces any existing skill with the same name.
Raises:
| Type | Description |
|---|---|
SkillParseError
|
If SKILL.md cannot be found or parsed. |
SkillValidationError
|
If metadata fails validation. |
to_prompt_xml ¶
Generate spec-compliant
Content is HTML-escaped to prevent injection.
ScriptExecutor ¶
Bases: ABC
Execute skill scripts with integrator-defined policy.
No default implementation is provided — the execution policy (sandboxing, timeouts, allowed interpreters) is always the integrator's responsibility.
execute
abstractmethod
async
¶
Run a script from a skill's scripts/ directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skill
|
Skill
|
The skill that owns the script. |
required |
script_name
|
str
|
Filename of the script to run. |
required |
arguments
|
dict[str, str] | None
|
Optional key-value arguments to pass. |
None
|
Returns:
| Type | Description |
|---|---|
ScriptResult
|
Result of the script execution. |
Exceptions¶
SkillParseError ¶
Bases: Exception
Failed to parse SKILL.md content.
SkillValidationError ¶
Bases: Exception
SKILL.md metadata failed validation.