Skip to content

loader

diapason.skills.loader

Skill loader — load and verify skill manifests from TOML files.

discover_skills(directory)

Scan a directory for skill definitions and load them.

Handles three layouts: - Flat *.toml files directly inside directory. - Skill directories: <directory>/<name>/{skill.toml,SKILL.md}. - Sourced layout: <directory>/<source>/<name>/{skill.toml,SKILL.md}.

load_skill(path, *, verify_signature=False, public_key=None, scan_for_injection=False)

Load a skill manifest from a TOML file.

Expected format:

[skill]
name = "research_and_summarize"
version = "0.1.0"
description = "Search web and summarize results"
author = "diapason"
required_capabilities = ["network:fetch"]
signature = ""

[[skill.steps]]
tool_name = "web_search"
arguments_template = '{"query": "{query}"}'
output_key = "search_results"

[[skill.steps]]
tool_name = "think"
arguments_template = '{"thought": "Summarize: {search_results}"}'
output_key = "summary"

load_skill_directory(path)

Load a skill from a directory containing skill.toml and/or SKILL.md.

  • If only skill.toml is present the manifest is loaded from TOML.
  • If only SKILL.md is present the manifest is loaded from markdown.
  • If both are present the TOML manifest takes precedence for structured fields and markdown_content is merged in from the markdown file.
  • If neither is present a FileNotFoundError is raised.

load_skill_markdown(path)

Load a skill manifest from a SKILL.md file via SkillParser.

Parses YAML frontmatter (between --- delimiters) and the markdown body, then runs them through :class:SkillParser for strict validation and tolerant field mapping.