Skip to main content

SkillToolkit

Toolkit for loading SKILL.md content. Skills are discovered from filesystem roots and loaded on-demand.

init

_build_description

_get_skills

clear_cache

Clear the cached skills to force rescanning on next access.

_scan_skills

Returns: Dict[str, Dict[str, str]]: Mapping of skill name to metadata.

_skill_roots

Returns: List[Tuple[str, Path]]: List of (scope, path) tuples.

_is_hidden_path

Check if a path contains hidden directories (starting with dot). Parameters:
  • path (Path): The path to check.
  • root (Path): The root directory to compute relative path from.
Returns: bool: True if the path contains hidden directories.

_parse_skill

Parse a SKILL.md file and extract metadata. Parameters:
  • path (Path): Path to the SKILL.md file.
Returns: Optional[Dict[str, str]]: Parsed skill data with name, description, and body. Returns None if parsing fails.

_split_frontmatter

Split YAML frontmatter from the body of a SKILL.md file. Parameters:
  • contents (str): The full contents of the file.
Returns: Tuple[Optional[str], str]: A tuple of (frontmatter, body). frontmatter is None if no valid frontmatter delimiter is found.

list_skills

Returns: List[Dict[str, str]]: Skill metadata entries including name, description, path, and scope.

list_skill_files

List files and directories in a skill folder. Parameters:
  • name (str): The skill identifier.
Returns: str: Formatted list of files/directories, or error message.

_load_single_skill

Load a single skill by name. Parameters:
  • name (str): The skill identifier.
Returns: str: The skill content, or error message if not found.

load_skill

Load one or more skills by name. Parameters:
  • name (Union[str, List[str]]): A single skill name or list of names.
Returns: str: The skill content(s), or error message if not found.

get_tools

Return the skill tools with injected available skills.