Class: Riffer::Skills::XmlAdapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/riffer/skills/xml_adapter.rb

Overview

Renders a skill catalog as XML for the system prompt, optimized for Anthropic/Claude.

Instance Attribute Summary

Attributes inherited from Adapter

#skill_activate_tool

Instance Method Summary collapse

Methods inherited from Adapter

#initialize

Constructor Details

This class inherits a constructor from Riffer::Skills::Adapter

Instance Method Details

#render_catalog(skills) ⇒ Object

Renders a skill catalog as XML. – : (Array) -> String



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/riffer/skills/xml_adapter.rb', line 12

def render_catalog(skills)
  lines = [] #: Array[String]
  lines << "When a user's request matches a skill description below, call the `#{skill_activate_tool.name}` tool with the skill name. After activation, follow the skill's instructions."
  lines << ""
  lines << "<available_skills>"
  skills.each do |skill|
    lines << "  <skill>"
    lines << "    <name>#{CGI.escapeHTML(skill.name)}</name>"
    lines << "    <description>#{CGI.escapeHTML(skill.description)}</description>"
    lines << "  </skill>"
  end
  lines << "</available_skills>"
  lines.join("\n")
end