Class: Ask::Skills::Skill
- Inherits:
-
Data
- Object
- Data
- Ask::Skills::Skill
- Defined in:
- lib/ask/skills/skill.rb
Overview
A discovered skill with its metadata, instructions, and sibling files.
Skills live in directories following the SKILL.md convention:
rails_debug/
├── SKILL.md → name, description, tags, instructions
├── references/ → reference documents (loaded on demand)
├── scripts/ → executable helpers
└── assets/ → images, templates, other resources
The siblings hash maps category names to arrays of file paths,
relative to the skill's directory. Categories are inferred from
sibling directory names (references, scripts, assets) or files.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#instructions ⇒ Object
readonly
Returns the value of attribute instructions.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#siblings ⇒ Object
readonly
Returns the value of attribute siblings.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#assets ⇒ Array<String>
Asset files bundled with this skill.
-
#initialize(name:, description:, instructions:, source:, metadata: {}, siblings: {}) ⇒ Skill
constructor
A new instance of Skill.
-
#references ⇒ Array<String>
Reference documents bundled with this skill.
-
#scripts ⇒ Array<String>
Executable scripts bundled with this skill.
-
#tags ⇒ Array<String>
Comma-separated tags from frontmatter.
- #to_prompt_entry ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name:, description:, instructions:, source:, metadata: {}, siblings: {}) ⇒ Skill
Returns a new instance of Skill.
19 20 21 22 |
# File 'lib/ask/skills/skill.rb', line 19 def initialize(name:, description:, instructions:, source:, metadata: {}, siblings: {}) super(name: name, description: description, instructions: instructions, source: source, metadata: , siblings: siblings) end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description
18 19 20 |
# File 'lib/ask/skills/skill.rb', line 18 def description @description end |
#instructions ⇒ Object (readonly)
Returns the value of attribute instructions
18 19 20 |
# File 'lib/ask/skills/skill.rb', line 18 def instructions @instructions end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
18 19 20 |
# File 'lib/ask/skills/skill.rb', line 18 def @metadata end |
#name ⇒ Object (readonly)
Returns the value of attribute name
18 19 20 |
# File 'lib/ask/skills/skill.rb', line 18 def name @name end |
#siblings ⇒ Object (readonly)
Returns the value of attribute siblings
18 19 20 |
# File 'lib/ask/skills/skill.rb', line 18 def siblings @siblings end |
#source ⇒ Object (readonly)
Returns the value of attribute source
18 19 20 |
# File 'lib/ask/skills/skill.rb', line 18 def source @source end |
Instance Method Details
#assets ⇒ Array<String>
Asset files bundled with this skill.
47 48 49 |
# File 'lib/ask/skills/skill.rb', line 47 def assets siblings["assets"] || [] end |
#references ⇒ Array<String>
Reference documents bundled with this skill.
35 36 37 |
# File 'lib/ask/skills/skill.rb', line 35 def references siblings["references"] || [] end |
#scripts ⇒ Array<String>
Executable scripts bundled with this skill.
41 42 43 |
# File 'lib/ask/skills/skill.rb', line 41 def scripts siblings["scripts"] || [] end |
#tags ⇒ Array<String>
Comma-separated tags from frontmatter.
53 54 55 56 |
# File 'lib/ask/skills/skill.rb', line 53 def raw = ["tags"] || [:tags] || "" raw.split(",").map(&:strip).reject(&:empty?) end |
#to_prompt_entry ⇒ Object
28 29 30 31 |
# File 'lib/ask/skills/skill.rb', line 28 def to_prompt_entry line = "- **#{name}**: #{description}" line end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/ask/skills/skill.rb', line 24 def to_s "#{name}: #{description}" end |