A2UIAgent.Skill (A2UIAgent v0.1.1)

Copy Markdown View Source

A skill package: a markdown document with YAML frontmatter (name, description and optional metadata) that teaches an agent to write A2UI, stored as <name>/SKILL.md.

iex> skill = A2UIAgent.Skill.new("a2ui-core", "Core rules.", "# Rules\n")
iex> skill.filename
"a2ui-core/SKILL.md"
iex> A2UIAgent.Skill.to_markdown(skill)
"---\nname: a2ui-core\ndescription: Core rules.\n---\n\n# Rules\n"

The frontmatter is written as PyYAML's yaml.dump writes it, so that skills match the reference's byte for byte: plain scalars where YAML allows them, folded at 80 columns, and quoted scalars otherwise. A2UIAgent.SkillGenerator builds skills from an inference format.

Summary

Functions

Writes skills into directory, each at its filename, and returns the markdown written by filename.

A skill. Options: :metadata (pairs or a map, written in order or by sorted key) and :filename (default "<name>/SKILL.md").

The skill as markdown: the frontmatter, a blank line, then the content.

Types

t()

(since 0.1.0)
@type t() :: %A2UIAgent.Skill{
  content: String.t(),
  description: String.t(),
  filename: String.t(),
  metadata: [{String.t(), term()}] | map(),
  name: String.t()
}

Functions

export(skills, directory)

(since 0.1.0)
@spec export([t()], Path.t()) ::
  {:ok, %{optional(String.t()) => String.t()}} | {:error, term()}

Writes skills into directory, each at its filename, and returns the markdown written by filename.

Each skill's own top-level directory (such as a2ui-core/) is removed first, so that nothing from an earlier export stays behind; other entries of directory are left alone.

new(name, description, content, options \\ [])

(since 0.1.0)
@spec new(String.t(), String.t(), String.t(), keyword()) :: t()

A skill. Options: :metadata (pairs or a map, written in order or by sorted key) and :filename (default "<name>/SKILL.md").

to_markdown(skill)

(since 0.1.0)
@spec to_markdown(t()) :: String.t()

The skill as markdown: the frontmatter, a blank line, then the content.