# `PtcRunner.SubAgent.Signature.Renderer`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/sub_agent/signature/renderer.ex#L1)

Renders signatures back to string representation.

Converts internal signature format to human-readable syntax for use in
prompts and debugging.

# `render`

```elixir
@spec render({:signature, list(), term()}) :: String.t()
```

Render a signature to its string representation.

## Examples

    iex> sig = {:signature, [{"id", :int}], :string}
    iex> PtcRunner.SubAgent.Signature.Renderer.render(sig)
    "(id :int) -> :string"

    iex> sig = {:signature, [], {:map, [{"count", :int}]}}
    iex> PtcRunner.SubAgent.Signature.Renderer.render(sig)
    "-> {count :int}"

# `render_type`

```elixir
@spec render_type(
  term(),
  keyword()
) :: String.t()
```

Render a type spec to its string representation.

Converts type tuples and atoms to their PTC-Lisp syntax representation
(e.g., `:string`, `[int]`, `{key :string}`).

Accepts an optional `key_style` option:
- `:lisp_prompt` — converts map field names to kebab-case for LLM-facing prompts

## Examples

    iex> PtcRunner.SubAgent.Signature.Renderer.render_type(:string)
    ":string"

    iex> PtcRunner.SubAgent.Signature.Renderer.render_type({:optional, :int})
    ":int?"

    iex> PtcRunner.SubAgent.Signature.Renderer.render_type({:list, :string})
    "[:string]"

# `to_lisp_key`

```elixir
@spec to_lisp_key(String.t()) :: String.t()
```

Convert a snake_case field name to kebab-case for LLM-facing prompts.

Strips leading `_`, replaces remaining `_` with `-`, prepends `_` back.

## Examples

    iex> PtcRunner.SubAgent.Signature.Renderer.to_lisp_key("q1_total")
    "q1-total"

    iex> PtcRunner.SubAgent.Signature.Renderer.to_lisp_key("_email_ids")
    "_email-ids"

    iex> PtcRunner.SubAgent.Signature.Renderer.to_lisp_key("name")
    "name"

---

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