Conjure.Loader (Conjure v0.1.1-alpha)
View SourceHandles loading and parsing of skills from the filesystem.
The loader is responsible for:
- Scanning directories for SKILL.md files
- Parsing YAML frontmatter from skill files
- Loading skill metadata without loading full content (progressive disclosure)
- Extracting and loading .skill packages (ZIP format)
- Validating skill structure
Progressive Disclosure
By default, loading only parses the frontmatter (metadata). The body content is loaded on-demand when requested or when Claude reads the file via the view tool.
Example
# Scan and load skills from a directory
{:ok, skills} = Conjure.Loader.scan_and_load("/path/to/skills")
# Load a single skill
{:ok, skill} = Conjure.Loader.load_skill("/path/to/my-skill")
# Load body content for a skill
{:ok, skill_with_body} = Conjure.Loader.load_body(skill)
Summary
Functions
Extracts a .skill file (ZIP) to a temporary directory.
Loads the body content for a skill.
Loads a skill from a directory path.
Loads a .skill package file (ZIP format).
Parses YAML frontmatter from SKILL.md content.
Reads a resource file from a skill.
Scans a directory for skills and loads them.
Scans a directory for skill directories (those containing SKILL.md).
Validates a skill's structure and metadata.
Functions
@spec extract_skill_file(Path.t()) :: {:ok, Path.t()} | {:error, Conjure.Error.t()}
Extracts a .skill file (ZIP) to a temporary directory.
Returns the path to the extracted skill directory.
@spec load_body(Conjure.Skill.t()) :: {:ok, Conjure.Skill.t()} | {:error, Conjure.Error.t()}
Loads the body content for a skill.
Returns a new skill struct with body loaded.
@spec load_skill(Path.t()) :: {:ok, Conjure.Skill.t()} | {:error, Conjure.Error.t()}
Loads a skill from a directory path.
Returns the skill with metadata loaded but body not loaded.
@spec load_skill_file(Path.t()) :: {:ok, Conjure.Skill.t()} | {:error, Conjure.Error.t()}
Loads a .skill package file (ZIP format).
Extracts to a temporary directory and loads the skill.
@spec parse_frontmatter(String.t()) :: {:ok, Conjure.Frontmatter.t(), String.t()} | {:error, Conjure.Error.t()}
Parses YAML frontmatter from SKILL.md content.
Returns the parsed frontmatter and the remaining body.
@spec read_resource(Conjure.Skill.t(), Path.t()) :: {:ok, String.t()} | {:error, Conjure.Error.t()}
Reads a resource file from a skill.
@spec scan_and_load(Path.t()) :: {:ok, [Conjure.Skill.t()]} | {:error, Conjure.Error.t()}
Scans a directory for skills and loads them.
Returns a list of loaded skills with metadata only (bodies not loaded).
Scans a directory for skill directories (those containing SKILL.md).
Returns a list of paths to skill directories.
@spec validate(Conjure.Skill.t()) :: :ok | {:error, [String.t()]}
Validates a skill's structure and metadata.