Class: Ask::Skills::LoadSkillTool

Inherits:
Tool
  • Object
show all
Defined in:
lib/ask/skills/load_skill_tool.rb

Overview

Tool that lets the LLM load a discovered skill's full instructions on demand. Skills are listed by name and description via progressive disclosure — the LLM decides which to load.

Usage by the LLM: call load_skill with the skill name.

Instance Method Summary collapse

Constructor Details

#initialize(registry:) ⇒ LoadSkillTool

Returns a new instance of LoadSkillTool.



18
19
20
21
# File 'lib/ask/skills/load_skill_tool.rb', line 18

def initialize(registry:)
  @registry = registry
  super()
end

Instance Method Details

#execute(name:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ask/skills/load_skill_tool.rb', line 23

def execute(name:)
  skill = @registry&.[](name)
  unless skill
    available = @registry&.names&.join(", ") || "none"
    return Ask::Result.failure("Skill '#{name}' not found. Available skills: #{available}")
  end

  # Return the full skill content so it can be injected into conversation
  content = "## Skill: #{skill.name}\n#{skill.description}\n\n#{skill.instructions}"
  Ask::Result.ok(data: { name: skill.name, content: content })
end

#nameObject



35
36
37
# File 'lib/ask/skills/load_skill_tool.rb', line 35

def name
  "load_skill"
end