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

Renders skills into prompt text for agent system prompts.

Provides utilities to format skill manifests and bodies into
structured text that can be prepended/appended to agent prompts.

# `collect_allowed_tools`

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

Collects all allowed tools from a list of skills.

Returns the union of all `allowed_tools` from the given skills.
This helper only reads advisory metadata. It does not grant tool approval.

# `filter_tools`

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

Filters a list of tool modules by the allowed tools from skills.

Returns only the tools whose names match the union of `allowed_tools`
from the given skills. If no skills specify allowed_tools, returns all tools.

Calling this helper is an explicit host policy. Automatic Agent Skills
activation does not apply this restrictive interpretation and does not treat
`allowed-tools` as permission to run a tool.

# `render`

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

Renders a list of skills into a formatted prompt section.

## Options

- `:include_body` - Include skill body content (default: false). Prefer
  `render_index/2` plus `Jido.AI.Actions.Skill.LoadSkill` for progressive disclosure.
- `:header` - Custom header text (default: "You have access to the following skills:")

## Example

    skills = [MyApp.Skills.Calculator, "code-review"]
    Skill.Prompt.render(skills)
    # => "You have access to the following skills:\n\n## calculator\n..."

# `render_index`

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

Renders a compact, model-facing skill index.

Unlike `render/2`, this function intentionally omits skill bodies so prompts
can advertise available skills without loading their full instructions. Pair
the rendered index with `Jido.AI.Actions.Skill.LoadSkill` so a model can load
the selected skill body on demand.

## Options

- `:tags` - String, atom, or list of tags used to filter skills.
- `:tag_match` - `:any` (default) or `:all` when multiple tags are provided.
- `:header` - Header text (default: `"## Skills"`). Set to `false` or `nil`
  to omit.
- `:load_instruction` - Instruction appended after the index. Set to `false`
  or `nil` to omit.
- `:include_allowed_tools` - Append allowed tool names to each entry.

# `render_one`

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

Renders a single skill into formatted prompt text.

# `render_registry_index`

```elixir
@spec render_registry_index(keyword()) :: String.t()
```

Renders a compact index for skills currently registered in the runtime registry.

This is the common entry point for lazy skill loading: register runtime skills,
render a filtered index into the agent system prompt, and expose the
`load_skill` action so the agent can retrieve the full body only when needed.

---

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