nodestep.middleware.skills ¶
Skills: SKILL.md files that FilesystemSkills offers the model to load.
See Built-in middleware.
| Name | What it is |
|---|---|
| Middleware | |
BaseSkills | Base class for middleware that offers skills to the model. |
FilesystemSkills | List the skills in the requests of the named model nodes and offer load_skill. |
| Skills | |
SkillCatalog | Skills read from SKILL.md files when the catalog is built. |
Skill | A skill loaded from a SKILL.md file. |
LoadedSkill | Result of the load_skill tool. |
| Errors | |
SkillNotFoundError | Raised when a skill name is unknown. |
SkillConflictError | Raised when two skill folders share a name. |
SkillFormatError | Raised when a SKILL.md file is not UTF-8 or has no valid frontmatter. |
Middleware¶
BaseSkills¶
Base class for middleware that offers skills to the model.
Subclass of Middleware.
FilesystemSkills¶
FilesystemSkills(roots, *, nodes)
List the skills in the requests of the named model nodes and offer load_skill.
Subclass of BaseSkills.
The list is a SystemMessage inserted after the request's leading
system messages; it is never stored.
roots | Iterable[str | Path] | SkillCatalog |
Roots as for |
nodes | Collection[str] |
|
TypeError |
If |
ValueError |
If |
FileNotFoundError |
If a root does not exist or holds no |
SkillFormatError |
If a |
SkillConflictError |
If two different files define the same skill name. |
Methods
get(name)¶
Return a skill by name.
get(name)¶before_model(ctx)¶
Add the skill catalog to the requests of the listed nodes.
before_model(ctx)¶before_model(ctx) -> Replacement | None
Replacement or None |
The request with the catalog, or |
Skills¶
SkillCatalog¶
SkillCatalog(roots)
Skills read from SKILL.md files when the catalog is built.
A SKILL.md starts with key: value lines between two --- lines:
name and description are required, other keys are ignored, values
may be quoted. Files are read as UTF-8, with or without a byte order mark.
roots | Iterable[str | Path] |
Directories searched recursively for |
FileNotFoundError |
If a root does not exist or holds no |
ValueError |
If a root is a file other than |
SkillFormatError |
If a |
SkillConflictError |
If two different files define the same skill name. |
Methods
get(name)¶
Return a skill by name.
get(name)¶Skill¶
Skill(*, name, description, path, root_path, content)
A skill loaded from a SKILL.md file.
name | str |
The frontmatter |
description | str |
The frontmatter |
path | Path |
The |
root_path | Path |
The folder that holds it. |
content | str |
The whole file, frontmatter included. |
LoadedSkill¶
LoadedSkill(*, name, description, content, path, primary_file)
Result of the load_skill tool.
name | str | |
description | str | |
content | str |
The whole |
path | str |
The skill's folder. |
primary_file | str |
Its |
Errors¶
SkillNotFoundError¶
Raised when a skill name is unknown.
Subclass of NodestepError and LookupError.
SkillConflictError¶
Raised when two skill folders share a name.
Subclass of NodestepError.
SkillFormatError¶
Raised when a SKILL.md file is not UTF-8 or has no valid frontmatter.
Subclass of NodestepError.