Toolnexus.Skill (toolnexus v0.9.4)

Copy Markdown View Source

Dynamic agent-skill source (SPEC §3). Mirrors js/src/skill.ts: discover **/SKILL.md, parse frontmatter, and expose ONE skill tool that loads a skill's instructions + sampled resources on demand (progressive disclosure).

Beyond on-disk discovery the source also accepts skills supplied as data (S1) and/or a lazy provider. Directory-sourced skills keep the exact file:// base + on-disk sibling sampling (byte-identical); data-sourced skills use a logical skill://name/ base + a supplied resource list and never touch disk (S4).

Summary

Functions

Discover + validate skills from the same sources load/1 accepts, returning parsed skills plus typed skip reasons — no toolkit wired (SPEC §3, S3). The inventory is UNFILTERED (it exists to author/validate the allowlist).

Discover skills (dirs and/or data/provider) and build the skill loader tool.

The skill loader tool description (verbatim from opencode's skill.txt).

Instruction preamble prepended to the skills prompt when ≥1 described skill exists.

Functions

list(input)

@spec list(String.t() | [String.t()] | keyword() | map()) :: %{
  skills: [Toolnexus.Skill.Info.t()],
  skipped: [%{location: String.t(), reason: String.t()}]
}

Discover + validate skills from the same sources load/1 accepts, returning parsed skills plus typed skip reasons — no toolkit wired (SPEC §3, S3). The inventory is UNFILTERED (it exists to author/validate the allowlist).

Skip reasons: "missing-name" | "malformed-frontmatter" | "duplicate-name" | "unreadable".

load(input)

@spec load(String.t() | [String.t()] | keyword() | map()) ::
  Toolnexus.Skill.Source.t()

Discover skills (dirs and/or data/provider) and build the skill loader tool.

Options (keyword list or map):

  • :dirs — a skill root or list of roots to glob for **/SKILL.md
  • :skills — skills supplied as data maps: %{name:, description:, content:, resources:, base:} (S1)
  • :provider — 0-arity fun returning a skill-data list, resolved once; a failing provider is isolated with a warning (S1)
  • :filtername => bool allowlist/droplist, nil/empty ⇒ all (S2)
  • :sample_limit — sibling-file cap: 0 ⇒ default 10, n > 0 ⇒ cap, -1 ⇒ omit <skill_files> (S5)

A bare binary or list of binaries is shorthand for dirs: ....

skill_tool_description()

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

The skill loader tool description (verbatim from opencode's skill.txt).

skills_prompt_preamble()

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

Instruction preamble prepended to the skills prompt when ≥1 described skill exists.