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

A Jido.Action for lazily loading available skill instructions.

Pair this action with `Jido.AI.Skill.Prompt.render_registry_index/1` to expose
a compact skill index in an agent prompt. The model can call `load_skill` only
after selecting a relevant skill, keeping full skill bodies out of the prompt
until they are needed.

The action routes through `Jido.AI.Skill.Activation`, returning the skill root
and a bounded resource listing with the instructions. Filesystem listings
contain relative paths for later use with `Jido.AI.Actions.Skill.LoadResource`;
provider-backed runtime listings contain opaque resource IDs.
It scopes activation
from `session_id`, `agent_id`, or `request_id` in the runtime context and tags
the resulting tool message as durable for ReAct compaction.

Scoped Agent Skills catalogs may contain discovered filesystem specs or
host-supplied runtime specs. Runtime specs keep their inline bodies and, when
configured with `:resource_provider`, receive callback-backed resource
listings through `Jido.AI.Skill.ResourceProvider`.

## Parameters

* `name` (required) - Available skill name to load.
* `include_metadata` (optional) - Include skill metadata in the response
  (default: `true`).

## Examples

    {:ok, result} =
      Jido.Exec.run(Jido.AI.Actions.Skill.LoadSkill, %{name: "code-review"})

    result.instructions
    #=> "# Code Review..."

# `__action_metadata__`

Returns the Action metadata. Alias for to_json/0.

# `category`

Returns the category of the Action.

# `description`

Returns the description of the Action.

# `name`

Returns the name of the Action.

# `on_after_run`

Lifecycle hook called after Action execution.

# `on_after_validate_output`

Lifecycle hook called after output validation.

# `on_after_validate_params`

Lifecycle hook called after parameter validation.

# `on_before_validate_output`

Lifecycle hook called before output validation.

# `on_before_validate_params`

Lifecycle hook called before parameter validation.

# `on_error`

Lifecycle hook called when an error occurs.

# `output_schema`

Returns the output schema of the Action.

# `run`

Loads and activates the requested skill from the agent catalog or registry.

# `schema`

Returns the input schema of the Action.

# `tags`

Returns the tags associated with the Action.

# `to_json`

Returns the Action metadata as a JSON-serializable map.

# `to_tool`

Converts the Action to an LLM-compatible tool format.

# `validate_output`

```elixir
@spec validate_output(map()) :: {:ok, map()} | {:error, String.t()}
```

Validates the output result for the Action.

## Examples

    iex> defmodule ExampleAction do
    ...>   use Jido.Action,
    ...>     name: "example_action",
    ...>     output_schema: [
    ...>       result: [type: :string, required: true]
    ...>     ]
    ...> end
    ...> ExampleAction.validate_output(%{result: "test", extra: "ignored"})
    {:ok, %{result: "test", extra: "ignored"}}

    iex> ExampleAction.validate_output(%{extra: "ignored"})
    {:error, "Invalid output for Action: Required key :result not found"}

# `validate_params`

```elixir
@spec validate_params(map()) :: {:ok, map()} | {:error, String.t()}
```

Validates the input parameters for the Action.

## Examples

    iex> defmodule ExampleAction do
    ...>   use Jido.Action,
    ...>     name: "example_action",
    ...>     schema: [
    ...>       input: [type: :string, required: true]
    ...>     ]
    ...> end
    ...> ExampleAction.validate_params(%{input: "test"})
    {:ok, %{input: "test"}}

    iex> ExampleAction.validate_params(%{})
    {:error, "Invalid parameters for Action: Required key :input not found"}

# `vsn`

Returns the version of the Action.

---

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