# `A2UIAgent.Skill`
[🔗](https://github.com/a2ui-elixir/a2ui/blob/v0.1.1/umbrella/apps/a2ui_agent/lib/a2ui_agent/skill.ex#L1)

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.

# `t`
*since 0.1.0* 

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

# `export`
*since 0.1.0* 

```elixir
@spec export([t()], Path.t()) ::
  {:ok, %{optional(String.t()) =&gt; 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`
*since 0.1.0* 

```elixir
@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`
*since 0.1.0* 

```elixir
@spec to_markdown(t()) :: String.t()
```

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
