# `Nous.Skill.Registry`
[🔗](https://github.com/nyo16/nous/blob/v0.17.1/lib/nous/skill/registry.ex#L1)

Discovery, management, and activation of skills.

The registry maintains skills indexed by name, group, tags, and scope.
It supports loading/unloading, activation/deactivation, group operations,
and input matching for auto-activation.

## Example

    registry = Nous.Skill.Registry.new()
    |> Nous.Skill.Registry.register(skill)
    |> Nous.Skill.Registry.activate("code_review", agent, ctx)

    active = Nous.Skill.Registry.active_skills(registry)

# `t`

```elixir
@type t() :: %Nous.Skill.Registry{
  active: term(),
  groups: %{optional(atom()) =&gt; [String.t()]},
  scopes: %{optional(Nous.Skill.scope()) =&gt; [String.t()]},
  skills: %{optional(String.t()) =&gt; Nous.Skill.t()},
  tags: %{optional(atom()) =&gt; [String.t()]}
}
```

# `activate`

```elixir
@spec activate(t(), String.t(), Nous.Agent.t(), Nous.Agent.Context.t()) ::
  {String.t() | nil, [Nous.Tool.t()], t()}
```

Activate a skill by name.

Loads the skill if not already loaded, marks it as active.
Returns `{instructions, tools, updated_registry}`.

# `activate_group`

```elixir
@spec activate_group(t(), atom(), Nous.Agent.t(), Nous.Agent.Context.t()) ::
  {[{String.t(), [Nous.Tool.t()]}], t()}
```

Activate all skills in a group.

# `active?`

```elixir
@spec active?(t(), String.t()) :: boolean()
```

Check if a skill is currently active.

# `active_skills`

```elixir
@spec active_skills(t()) :: [Nous.Skill.t()]
```

Get all currently active skills.

# `by_group`

```elixir
@spec by_group(t(), atom()) :: [Nous.Skill.t()]
```

Get all skills in a group.

# `by_tag`

```elixir
@spec by_tag(t(), atom()) :: [Nous.Skill.t()]
```

Get all skills with a tag.

# `deactivate`

```elixir
@spec deactivate(t(), String.t()) :: t()
```

Deactivate a skill by name.

# `deactivate_group`

```elixir
@spec deactivate_group(t(), atom()) :: t()
```

Deactivate all skills in a group.

# `get`

```elixir
@spec get(t(), String.t()) :: Nous.Skill.t() | nil
```

Get a skill by name.

# `list`

```elixir
@spec list(t()) :: [String.t()]
```

List all registered skill names.

# `match`

```elixir
@spec match(t(), String.t()) :: [Nous.Skill.t()]
```

Find skills matching user input.

Checks skills with `{:on_match, fn}` activation or falls back to
description keyword matching.

# `new`

```elixir
@spec new() :: t()
```

Create an empty registry.

# `register`

```elixir
@spec register(t(), Nous.Skill.t()) :: t()
```

Register a skill in the registry, indexing by name, group, tags, and scope.

# `register_all`

```elixir
@spec register_all(t(), [Nous.Skill.t()]) :: t()
```

Register multiple skills at once.

# `register_directories`

```elixir
@spec register_directories(t(), [String.t()]) :: t()
```

Register all skills from multiple directories.

## Example

    registry = Registry.new()
    |> Registry.register_directories(["priv/skills/", "~/.nous/skills/", ".nous/skills/"])

# `register_directory`

```elixir
@spec register_directory(t(), String.t()) :: t()
```

Register all skills found in a directory (recursively scans for `.md` files).

This is the primary API for loading file-based skills from a folder.

## Example

    registry = Registry.new()
    |> Registry.register_directory("priv/skills/")
    |> Registry.register_directory("~/.nous/skills/")

# `resolve`

```elixir
@spec resolve([module() | String.t() | Nous.Skill.t() | {:group, atom()}]) :: t()
```

Resolve a mixed list of skill specs into a populated registry.

Accepts:
- Modules implementing `Nous.Skill` behaviour
- Directory paths (strings ending with `/` or existing dirs)
- File paths (strings ending with `.md`)
- `Skill.t()` structs
- `{:group, atom()}` tuples (registers all built-in skills for that group)

## Example

    registry = Registry.resolve([
      MyApp.Skills.CodeReview,         # module
      "priv/skills/",                  # directory
      "priv/skills/custom.md",         # single file
      {:group, :testing},              # built-in group
      %Skill{name: "inline", ...}      # inline struct
    ])

---

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