Class: Antigravity::Skill
Overview
Represents an Agent Skill loaded from a SKILL.md file or defined inline. Spec: https://agentskills.io/specification
A skill directory must contain a SKILL.md with YAML frontmatter:
name: my-skill description: What this skill does
Instructions in markdown...
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.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
-
.inline(name:, description:, instructions:) ⇒ Skill
Factory: create an inline skill (no file needed).
-
.load(path) ⇒ Object
Factory: load from directory path.
-
.skill_dir?(path) ⇒ Boolean
Check if a directory is a valid skill (contains SKILL.md).
Instance Method Summary collapse
-
#initialize(path) ⇒ Skill
constructor
Load a skill from a directory containing SKILL.md.
- #inspect ⇒ Object
- #to_s ⇒ Object
Methods inherited from Base
Methods included from Emojifiable
Constructor Details
#initialize(path) ⇒ Skill
Load a skill from a directory containing SKILL.md.
21 22 23 24 25 |
# File 'lib/antigravity/skill.rb', line 21 def initialize(path) @path = File.(path) @metadata = {} parse_skill_file end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
17 18 19 |
# File 'lib/antigravity/skill.rb', line 17 def description @description end |
#instructions ⇒ Object (readonly)
Returns the value of attribute instructions.
17 18 19 |
# File 'lib/antigravity/skill.rb', line 17 def instructions @instructions end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
17 18 19 |
# File 'lib/antigravity/skill.rb', line 17 def @metadata end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/antigravity/skill.rb', line 17 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
17 18 19 |
# File 'lib/antigravity/skill.rb', line 17 def path @path end |
Class Method Details
.inline(name:, description:, instructions:) ⇒ Skill
Factory: create an inline skill (no file needed).
37 38 39 40 41 |
# File 'lib/antigravity/skill.rb', line 37 def self.inline(name:, description:, instructions:) skill = allocate skill.send(:init_inline, name: name, description: description, instructions: instructions) skill end |
.load(path) ⇒ Object
Factory: load from directory path.
28 29 30 |
# File 'lib/antigravity/skill.rb', line 28 def self.load(path) new(path) end |
.skill_dir?(path) ⇒ Boolean
Check if a directory is a valid skill (contains SKILL.md).
46 47 48 |
# File 'lib/antigravity/skill.rb', line 46 def self.skill_dir?(path) SkillResolver.skill_dir?(path) end |
Instance Method Details
#inspect ⇒ Object
54 55 56 |
# File 'lib/antigravity/skill.rb', line 54 def inspect "#<Antigravity::Skill name=#{@name.inspect} description=#{@description.inspect} path=#{@path.inspect}>" end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/antigravity/skill.rb', line 50 def to_s "#<Skill name=#{@name.inspect} path=#{@path.inspect}>" end |