Class: Rubino::Skills::SkillTool
- Inherits:
-
Tools::Base
- Object
- Tools::Base
- Rubino::Skills::SkillTool
- Defined in:
- lib/rubino/skills/skill_tool.rb
Overview
Tool that allows the agent to load a skill on demand, and (Variant A —reference-style affordance) to CREATE a new skill inline during the turn.
The agent sees skill names/descriptions in the system prompt and can invoke this tool to load the full skill instructions into context, or — after a complex, repeatable task — to distil what it just did into a new skill with action: “create” (0 extra LLM calls; the create happens inline on the tool-call the model already emitted).
Instance Attribute Summary
Attributes inherited from Tools::Base
#cancel_token, #read_tracker, #stream_chunk, #stream_kind
Instance Method Summary collapse
-
#call(arguments) ⇒ Object
action: “load” (default) — three-level progressive disclosure: skill(name) -> Level 2: SKILL.md body skill(name, file_path: “ref.md”) -> Level 3: one bundled file action: “create” — write a new <name>/SKILL.md inline (Variant A).
- #description ⇒ Object
-
#initialize(registry: nil) ⇒ SkillTool
constructor
A new instance of SkillTool.
- #input_schema ⇒ Object
- #name ⇒ Object
- #risk_level ⇒ Object
Methods inherited from Tools::Base
#cancellation_requested?, #config_key, #display_name, #emit_chunk, #mcp?, #risky?, #to_tool_definition, workspace_root, workspace_roots
Constructor Details
Instance Method Details
#call(arguments) ⇒ Object
action: “load” (default) — three-level progressive disclosure:
skill(name) -> Level 2: SKILL.md body
skill(name, file_path: "ref.md") -> Level 3: one bundled file
action: “create” — write a new <name>/SKILL.md inline (Variant A).
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/rubino/skills/skill_tool.rb', line 79 def call(arguments) action = (arguments["action"] || arguments[:action] || "load").to_s return create(arguments) if action == "create" skill_name = arguments["name"] || arguments[:name] file_path = arguments["file_path"] || arguments[:file_path] skill = @registry.find(skill_name) return not_found(skill_name) unless skill return disabled(skill_name) unless @registry.enabled?(skill_name) return load_bundled_file(skill, skill_name, file_path) if file_path && !file_path.to_s.empty? load_body(skill, skill_name) end |
#description ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/rubino/skills/skill_tool.rb', line 24 def description "Load a specialized skill's instructions into context, or create a new " \ "skill. action defaults to \"load\": use it when a task matches one of " \ "the available skills listed under \"## Skills\" in the system prompt " \ "(pass file_path to load a bundled file). After finishing a complex, " \ "multi-step task (typically 5+ tool calls) that is likely to recur and " \ "isn't already covered, call action: \"create\" with name, description, " \ "and body to save it as a reusable skill." end |
#input_schema ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rubino/skills/skill_tool.rb', line 34 def input_schema { type: "object", properties: { action: { type: "string", enum: %w[load create], description: "\"load\" (default) loads an existing skill; " \ "\"create\" writes a new skill from name/description/body." }, name: { type: "string", description: "The skill name. For load: the skill to load. " \ "For create: a kebab-case name (<=64 chars)." }, file_path: { type: "string", description: "Optional (load only). Relative path of a bundled file within the " \ "skill (e.g. 'references/api.md', 'scripts/run.py') to load " \ "its contents. Use the linked_files listed when the skill " \ "body is first loaded." }, description: { type: "string", description: "Required for create. One line: what the skill is for and WHEN " \ "it applies (the only text future runs see before loading it)." }, body: { type: "string", description: "Required for create. The markdown body: proven step-by-step " \ "instructions, commands, and pitfalls. Be specific and prescriptive." } }, required: %w[name] } end |
#name ⇒ Object
20 21 22 |
# File 'lib/rubino/skills/skill_tool.rb', line 20 def name "skill" end |
#risk_level ⇒ Object
71 72 73 |
# File 'lib/rubino/skills/skill_tool.rb', line 71 def risk_level :low end |