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

Tracks parsing and loading warnings for skill diagnostics.

Diagnostics capture non-fatal issues encountered during skill loading,
including:
- Parent directory name mismatches
- Cosmetic naming violations
- Truncated fields
- Missing optional metadata

Diagnostics enable tooling to display warnings to users without
blocking skill functionality.

## Usage

    # Create fresh diagnostics
    diagnostics = Diagnostics.new()

    # Add a warning
    diagnostics = Diagnostics.add_warning(diagnostics, Diagnostics.Warning.new(:name_mismatch, "..."))

    # Check for issues
    Diagnostics.has_warnings?(diagnostics)
    Diagnostics.has_errors?(diagnostics)

    # Convert to map for storage
    Diagnostics.to_map(diagnostics)

# `t`

```elixir
@type t() :: %Jido.AI.Skill.Diagnostics{
  errors: [map()],
  timestamp: DateTime.t() | nil,
  warnings: [Jido.AI.Skill.Diagnostics.Warning.t()]
}
```

# `add_error`

```elixir
@spec add_error(t(), map()) :: t()
```

Adds an error to the diagnostics (non-fatal in lenient mode).

# `add_warning`

```elixir
@spec add_warning(t(), Jido.AI.Skill.Diagnostics.Warning.t()) :: t()
```

Adds a warning to the diagnostics.

# `error_count`

```elixir
@spec error_count(t()) :: non_neg_integer()
```

Returns the count of errors.

# `format`

```elixir
@spec format(t() | nil) :: String.t()
```

Formats diagnostics for display in logs or tooling.

# `has_errors?`

```elixir
@spec has_errors?(t()) :: boolean()
```

Returns true if there are any errors.

# `has_issues?`

```elixir
@spec has_issues?(t()) :: boolean()
```

Returns true if there are any warnings or errors.

# `has_warnings?`

```elixir
@spec has_warnings?(t()) :: boolean()
```

Returns true if there are any warnings.

# `new`

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

Creates a new empty diagnostics struct.

# `to_map`

```elixir
@spec to_map(t() | nil) :: map() | nil
```

Converts diagnostics to a plain map for storage in metadata.

# `warning_count`

```elixir
@spec warning_count(t()) :: non_neg_integer()
```

Returns the count of warnings.

---

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