Raxol.Agent.Skill (Raxol Agent v2.6.0)

Copy Markdown View Source

A procedural-memory skill: an agentskills.io SKILL.md parsed into a struct.

A skill is YAML frontmatter (the leading --- ... --- block) plus a markdown body. This module is pure: parse a SKILL.md string into a %Skill{}, render a %Skill{} back to SKILL.md text, and load one from disk. It owns no process and touches no global state.

Modeled frontmatter keys are name (required), description, version, category, and created_by. Every other frontmatter key is preserved under :metadata, so a skill authored by another tool keeps its extra fields across a round trip. parse(render(skill)) returns an equal struct for the shapes real skills use (scalars, lists of scalars, and a one-level metadata map).

created_by is decoded to :agent, :user, or nil; this is what the Curator uses to decide which skills it may age and rewrite. Unknown values decode to nil rather than calling String.to_atom/1 on file content.

Summary

Functions

Load and parse a SKILL.md from disk.

Parse a SKILL.md string into a %Skill{}.

Render a %Skill{} back to SKILL.md text.

Types

created_by()

@type created_by() :: :agent | :user | nil

t()

@type t() :: %Raxol.Agent.Skill{
  body: String.t(),
  category: String.t() | nil,
  created_by: created_by(),
  description: String.t() | nil,
  metadata: %{optional(String.t()) => term()},
  name: String.t(),
  version: String.t() | nil
}

Functions

from_file(path)

@spec from_file(Path.t()) :: {:ok, t()} | {:error, term()}

Load and parse a SKILL.md from disk.

parse(content)

@spec parse(String.t()) :: {:ok, t()} | {:error, term()}

Parse a SKILL.md string into a %Skill{}.

render(skill)

@spec render(t()) :: String.t()

Render a %Skill{} back to SKILL.md text.