Jido.AI.Skill.Loader (Jido AI v2.2.0)

Copy Markdown View Source

Parses SKILL.md files into Jido.AI.Skill.Spec structs.

Supports the agentskills.io format with YAML frontmatter.

Lenient Parsing Mode

When lenient: true is passed to load functions:

  • Non-fatal warnings are collected instead of causing failures
  • Parent directory name mismatches generate warnings
  • Cosmetic naming violations are noted
  • Returns both the spec and diagnostics

Diagnostics

All parse operations can track diagnostics via the :diagnostics option or by using load_with_diagnostics/2:

{:ok, spec, diagnostics} = Loader.load_with_diagnostics(path)

Summary

Functions

Loads a skill from a SKILL.md file path.

Loads a skill from a SKILL.md file path, raising on error.

Loads a skill with full diagnostics tracking.

Parses SKILL.md content string into a spec.

Functions

load(path, opts \\ [])

@spec load(
  String.t(),
  keyword()
) :: {:ok, Jido.AI.Skill.Spec.t()} | {:error, term()}

Loads a skill from a SKILL.md file path.

Returns {:ok, spec} or {:error, reason}.

Options

  • :lenient - When true, non-fatal issues become warnings instead of errors (default: false)
  • :diagnostics - Pass an existing Diagnostics struct to accumulate warnings

load!(path, opts \\ [])

@spec load!(
  String.t(),
  keyword()
) :: Jido.AI.Skill.Spec.t()

Loads a skill from a SKILL.md file path, raising on error.

load_with_diagnostics(path, opts \\ [])

@spec load_with_diagnostics(
  String.t(),
  keyword()
) ::
  {:ok, Jido.AI.Skill.Spec.t(), Jido.AI.Skill.Diagnostics.t()}
  | {:error, term(), Jido.AI.Skill.Diagnostics.t()}

Loads a skill with full diagnostics tracking.

Returns {:ok, spec, diagnostics} or {:error, reason, diagnostics}. Always returns diagnostics even on failure, allowing inspection of warnings.

Examples

{:ok, spec, diagnostics} = Loader.load_with_diagnostics(path)
Enum.each(diagnostics.warnings, &IO.puts/1)

parse(content, source_path \\ "inline", opts \\ [])

@spec parse(String.t(), String.t(), keyword()) ::
  {:ok, Jido.AI.Skill.Spec.t()} | {:error, term()}

Parses SKILL.md content string into a spec.

Options

  • :lenient - When true, non-fatal issues become warnings instead of errors
  • :diagnostics - Pass an existing Diagnostics struct to accumulate warnings