Class: Riffer::Skills::Adapter

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

Overview

Base class defining the interface for skill adapters.

A skill adapter encapsulates the provider-specific catalog rendering for skills — how the available-skills section appears in the system prompt.

Subclass and override render_catalog. The activation tool is set at construction time and is exposed via #skill_activate_tool for use in rendered output.

See Riffer::Skills::MarkdownAdapter for the default implementation. See Riffer::Skills::XmlAdapter for the Anthropic/Claude variant.

Direct Known Subclasses

MarkdownAdapter, XmlAdapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(skill_activate_tool:) ⇒ Adapter

Creates a new adapter.

skill_activate_tool

the activation tool class — referenced by name in the rendered catalog so the LLM knows which tool to call.

– : (skill_activate_tool: singleton(Riffer::Tool)) -> void



27
28
29
# File 'lib/riffer/skills/adapter.rb', line 27

def initialize(skill_activate_tool:)
  @skill_activate_tool = skill_activate_tool
end

Instance Attribute Details

#skill_activate_toolObject (readonly)

The activation tool class for this adapter.



17
18
19
# File 'lib/riffer/skills/adapter.rb', line 17

def skill_activate_tool
  @skill_activate_tool
end

Instance Method Details

#render_catalog(skills) ⇒ Object

Renders a skill catalog section for the system prompt.

skills

array of Frontmatter objects to render.

Raises NotImplementedError if not implemented by subclass.

– : (Array) -> String

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/riffer/skills/adapter.rb', line 39

def render_catalog(skills)
  raise NotImplementedError, "#{self.class} must implement #render_catalog"
end