Unified skill abstraction for Jido agents.
Skills can be defined two ways:
- Compile-time modules using
use Jido.AI.Skill - Runtime-loaded SKILL.md files following the agentskills.io format
Both present the same API to agents and strategies.
Module-based Skills
defmodule MyApp.Skills.WeatherAdvisor do
use Jido.AI.Skill,
name: "weather-advisor",
description: "Provides weather-aware travel and activity advice.",
license: "MIT",
allowed_tools: ~w(weather_geocode weather_forecast),
actions: [MyApp.Actions.Weather.Forecast],
body: """
# Weather Advisor
## Workflow
1. Determine location
2. Fetch weather data
3. Provide contextual advice
"""
endRuntime Skills
Load SKILL.md files at runtime:
{:ok, spec} = Jido.AI.Skill.Loader.load("priv/skills/code-review/SKILL.md")
Jido.AI.Skill.Registry.register(spec)Unified API
Both types support the same interface:
Jido.AI.Skill.manifest(skill) # Returns the Spec struct
Jido.AI.Skill.body(skill) # Returns the skill body text
Jido.AI.Skill.allowed_tools(skill) # Returns list of allowed tool names
Jido.AI.Skill.actions(skill) # Returns list of action modules
Summary
Functions
Returns the actions for a skill.
Returns the allowed tools for a skill.
Returns the body text for a skill.
Returns the manifest (Spec) for a skill.
Returns the plugins for a skill.
Resolves a skill reference to a Spec.
Callbacks
@callback actions() :: [module()]
@callback allowed_tools() :: [String.t()]
@callback body() :: String.t()
@callback manifest() :: Jido.AI.Skill.Spec.t()
@callback plugins() :: [module()]
Functions
@spec actions(module() | Jido.AI.Skill.Spec.t() | String.t()) :: [module()]
Returns the actions for a skill.
@spec allowed_tools(module() | Jido.AI.Skill.Spec.t() | String.t()) :: [String.t()]
Returns the allowed tools for a skill.
@spec body(module() | Jido.AI.Skill.Spec.t() | String.t()) :: String.t()
Returns the body text for a skill.
@spec manifest(module() | Jido.AI.Skill.Spec.t() | String.t()) :: Jido.AI.Skill.Spec.t()
Returns the manifest (Spec) for a skill.
Works with both module references and Spec structs.
@spec plugins(module() | Jido.AI.Skill.Spec.t() | String.t()) :: [module()]
Returns the plugins for a skill.
@spec resolve(module() | Jido.AI.Skill.Spec.t() | String.t()) :: {:ok, Jido.AI.Skill.Spec.t()} | {:error, term()}
Resolves a skill reference to a Spec.
Accepts:
- Module atoms (compile-time skills)
- Spec structs (already resolved)
- String names (runtime registry lookup)