Class: Pikuri::Skill::Catalog::Skill
- Inherits:
-
Data
- Object
- Data
- Pikuri::Skill::Catalog::Skill
- Defined in:
- lib/pikuri/skill/catalog.rb
Overview
A loaded skill record. Bodies are eager-loaded at scan time; SKILL.md files are small and the tool's hot path stays IO-free.
Instance Attribute Summary collapse
-
#body ⇒ String
readonly
Everything after the frontmatter.
-
#description ⇒ String
readonly
What it does, and (often) when to use it.
-
#location ⇒ String
readonly
Absolute path of the SKILL.md.
-
#name ⇒ String
readonly
The name the model loads it by.
-
#paths ⇒ Array<String>
readonly
Normalized
paths:patterns; empty means advertised unconditionally — see PathMatcher before reading an empty one as "matches nothing". -
#when_to_use ⇒ String?
readonly
The
when-to-use:trigger sentence,nilwhen the frontmatter carried none.
Instance Method Summary collapse
-
#gated? ⇒ Boolean
True when this skill stays withheld until a tool touches a file matching #paths.
- #initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) ⇒ Skill constructor
Constructor Details
#initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) ⇒ Skill
50 51 52 53 |
# File 'lib/pikuri/skill/catalog.rb', line 50 def initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) super end |
Instance Attribute Details
#body ⇒ String (readonly)
Returns everything after the frontmatter.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pikuri/skill/catalog.rb', line 48 Skill = Data.define(:name, :description, :location, :body, :paths, :when_to_use) do # @return [Skill] def initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) super end # @return [Boolean] true when this skill stays withheld until a tool # touches a file matching {#paths} def gated? = !paths.empty? end |
#description ⇒ String (readonly)
Returns what it does, and (often) when to use it.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pikuri/skill/catalog.rb', line 48 Skill = Data.define(:name, :description, :location, :body, :paths, :when_to_use) do # @return [Skill] def initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) super end # @return [Boolean] true when this skill stays withheld until a tool # touches a file matching {#paths} def gated? = !paths.empty? end |
#location ⇒ String (readonly)
Returns absolute path of the SKILL.md.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pikuri/skill/catalog.rb', line 48 Skill = Data.define(:name, :description, :location, :body, :paths, :when_to_use) do # @return [Skill] def initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) super end # @return [Boolean] true when this skill stays withheld until a tool # touches a file matching {#paths} def gated? = !paths.empty? end |
#name ⇒ String (readonly)
Returns the name the model loads it by.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pikuri/skill/catalog.rb', line 48 Skill = Data.define(:name, :description, :location, :body, :paths, :when_to_use) do # @return [Skill] def initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) super end # @return [Boolean] true when this skill stays withheld until a tool # touches a file matching {#paths} def gated? = !paths.empty? end |
#paths ⇒ Array<String> (readonly)
Returns normalized paths: patterns; empty means
advertised unconditionally — see PathMatcher before reading an empty
one as "matches nothing".
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pikuri/skill/catalog.rb', line 48 Skill = Data.define(:name, :description, :location, :body, :paths, :when_to_use) do # @return [Skill] def initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) super end # @return [Boolean] true when this skill stays withheld until a tool # touches a file matching {#paths} def gated? = !paths.empty? end |
#when_to_use ⇒ String? (readonly)
Returns the when-to-use: trigger sentence, nil when
the frontmatter carried none. Answers is this the moment? where
#paths answers is this ecosystem in play?; they compose.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pikuri/skill/catalog.rb', line 48 Skill = Data.define(:name, :description, :location, :body, :paths, :when_to_use) do # @return [Skill] def initialize(name:, description:, location:, body:, paths: PathMatcher::UNCONDITIONAL, when_to_use: nil) super end # @return [Boolean] true when this skill stays withheld until a tool # touches a file matching {#paths} def gated? = !paths.empty? end |
Instance Method Details
#gated? ⇒ Boolean
Returns true when this skill stays withheld until a tool touches a file matching #paths.
57 |
# File 'lib/pikuri/skill/catalog.rb', line 57 def gated? = !paths.empty? |