# `Jido.AI.Skill`
[🔗](https://github.com/agentjido/jido_ai/blob/v2.4.0/lib/jido_ai/skill.ex#L1)

Unified skill abstraction for Jido agents.

Skills can be defined two ways:

1. **Compile-time modules** using `use Jido.AI.Skill`
2. **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
        """
    end

## Runtime 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

# `actions`

```elixir
@callback actions() :: [module()]
```

# `allowed_tools`

```elixir
@callback allowed_tools() :: [String.t()]
```

# `body`

```elixir
@callback body() :: String.t()
```

# `manifest`

```elixir
@callback manifest() :: Jido.AI.Skill.Spec.t()
```

# `plugins`

```elixir
@callback plugins() :: [module()]
```

# `actions`

```elixir
@spec actions(module() | Jido.AI.Skill.Spec.t() | String.t()) :: [module()]
```

Returns the actions for a skill.

# `allowed_tools`

```elixir
@spec allowed_tools(module() | Jido.AI.Skill.Spec.t() | String.t()) :: [String.t()]
```

Returns the allowed tools for a skill.

For filesystem Agent Skills, `allowed-tools` is advisory metadata. Jido.AI
does not automatically approve, enable, or restrict tools from this field.
A host must apply its own explicit approval policy.

# `body`

```elixir
@spec body(module() | Jido.AI.Skill.Spec.t() | String.t()) :: String.t()
```

Returns the body text for a skill.

# `manifest`

```elixir
@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.

# `plugins`

```elixir
@spec plugins(module() | Jido.AI.Skill.Spec.t() | String.t()) :: [module()]
```

Returns the plugins for a skill.

# `resolve`

```elixir
@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)

---

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