Overview
SkillsManager implements Agent Skills: SKILL.md files on disk, discovered and folded into an agent’s system prompt. It supports the tiered loading model — name/description metadata kept in memory for context-aware activation (Tier 1), and a skill’s full body pulled on demand (Tier 2).
Every Agent builds one automatically as agent.skills. It is also usable standalone.
Import
Design
The manager never mutates the agent. It returns prompt text and the caller decides what to do with it, which keeps prompt mutation in one visible place and makes the class testable on its own:Constructor
str
Directory containing skill folders, each holding a
SKILL.md file with YAML frontmatter. None disables skills entirely.float
default:"0.3"
Minimum task/skill similarity for a skill to be selected during dynamic loading.
Attributes
Optional[str]
The configured skills directory.
List[Dict[str, str]]
Metadata for the skills loaded so far.
bool
Read-only.
True when a directory is configured and exists on disk.Skill format
Each skill is a folder containing aSKILL.md with YAML frontmatter:
SKILL.md
name in its frontmatter falls back to its folder name.
Methods
prompt_for_task
str
When provided, only skills whose description is similar to the task are loaded (dynamic). When
None, every skill is loaded (static)."" when nothing loaded. Populates metadata as a side effect.
- Dynamic
- Static
DynamicSkillsLoader, which scores each skill’s description against the task by cosine similarity and keeps those above similarity_threshold. The loader is built lazily on first use and reused afterwards.load_metadata
name, description, path, and content. Defaults to the configured directory. Returns [] when the directory is missing. Entries are returned in sorted order for determinism.
build_prompt
"" for an empty list. The # Available Skills header is emitted exactly once, followed by each skill’s name, description, and body.
load_full_skill
metadata. Returns None when the skill is unknown or the file has since become unreadable.
set_skills_dir
metadata and the dynamic loader.
Agent integration
Skills load at
run() time, not construction, so an agent’s recorded system prompt at init does not yet include them.
Standalone use
Related
Agent Skills
Guide to authoring and using skills
Agent
The class that owns the manager