Skill¶
Skill construct.
Skill
¶
A skill that can be discovered and activated by an LLM agent.
Attributes:
| Name | Type | Description |
|---|---|---|
frontmatter |
Parsed frontmatter metadata from the skill's SKILL.md file. |
|
location |
Absolute path to the skill's SKILL.md file on disk. |
|
scope |
The scope of the skill ( |
|
resources |
list[Path]
|
Relative paths of resource files found in the skill's
optional subdirectories ( |
Source code in src/llm_agents_from_scratch/skills/skill.py
resources
property
¶
Return relative paths of resource files in optional subdirectories.
Scans the directories listed in OPTIONAL_SUBDIRS (assets/,
scripts/, references/) under the skill directory and returns
the relative path of each file found. Returns an empty list if none
of those directories exist.
Only top-level files within each optional subdirectory are
returned. This conforms to the Agent Skills specification, which
advises keeping file references one level deep from SKILL.md
and avoiding deeply nested resource chains.
__init__
¶
Instantiate a Skill.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frontmatter
|
SkillFrontmatter
|
Parsed frontmatter metadata from the skill's SKILL.md file. |
required |
location
|
Path
|
Absolute path to the skill's SKILL.md file on disk. |
required |
scope
|
SkillScope
|
The scope of the skill ( |
required |
Source code in src/llm_agents_from_scratch/skills/skill.py
read_body
¶
Return body content as string.
Most error conditions are caught during discovery. These errors
can only be raised if the skill file is modified between discovery and activation.
Raises:
| Type | Description |
|---|---|
SkillValidationError
|
If the file cannot be read. |
InvalidFrontmatterError
|
If the frontmatter delimiters are missing or malformed. |
EmptySkillBodyError
|
If the body is empty or whitespace-only. |
Source code in src/llm_agents_from_scratch/skills/skill.py
catalog
¶
Returns XML structured string for cataloging skill.