Class: Skills::Definition
- Inherits:
-
Object
- Object
- Skills::Definition
- Defined in:
- lib/skills/definition.rb
Overview
A domain knowledge skill parsed from a Markdown definition file. YAML frontmatter holds metadata; the Markdown body is the knowledge content injected into the main agent’s system prompt when active.
Skills are passive knowledge — they describe WHAT you know, not WHAT to do. The analytical brain activates/deactivates them based on conversation context.
Constant Summary collapse
- NAME_FORMAT =
/\A[a-z0-9][a-z0-9_-]*\z/
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
Knowledge content (Markdown body) injected into system prompt.
-
#description ⇒ String
readonly
Description shown to the analytical brain for relevance matching.
-
#name ⇒ String
readonly
Unique skill identifier used in activate_skill(name: “…”).
-
#source_path ⇒ String
readonly
File path this definition was loaded from.
Class Method Summary collapse
-
.from_file(path) ⇒ Definition
Parses a Markdown file with YAML frontmatter into a Definition.
Instance Method Summary collapse
-
#initialize(name:, description:, content:, source_path: "") ⇒ Definition
constructor
A new instance of Definition.
Constructor Details
#initialize(name:, description:, content:, source_path: "") ⇒ Definition
Returns a new instance of Definition.
37 38 39 40 41 42 |
# File 'lib/skills/definition.rb', line 37 def initialize(name:, description:, content:, source_path: "") @name = name @description = description @content = content @source_path = source_path end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns knowledge content (Markdown body) injected into system prompt.
32 33 34 |
# File 'lib/skills/definition.rb', line 32 def content @content end |
#description ⇒ String (readonly)
Returns description shown to the analytical brain for relevance matching.
29 30 31 |
# File 'lib/skills/definition.rb', line 29 def description @description end |
#name ⇒ String (readonly)
Returns unique skill identifier used in activate_skill(name: “…”).
26 27 28 |
# File 'lib/skills/definition.rb', line 26 def name @name end |
#source_path ⇒ String (readonly)
Returns file path this definition was loaded from.
35 36 37 |
# File 'lib/skills/definition.rb', line 35 def source_path @source_path end |
Class Method Details
.from_file(path) ⇒ Definition
Parses a Markdown file with YAML frontmatter into a Definition.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/skills/definition.rb', line 49 def self.from_file(path) raw = File.read(path) frontmatter, body = parse_frontmatter(raw) validate_required_fields!(frontmatter, path) new( name: frontmatter["name"].to_s.strip, description: frontmatter["description"].to_s.strip, content: body.strip, source_path: path.to_s ) end |