Class: Pikuri::Skill::Catalog::Skill

Inherits:
Data
  • Object
show all
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

Instance Method Summary collapse

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

#bodyString (readonly)

Returns everything after the frontmatter.

Returns:

  • (String)

    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

#descriptionString (readonly)

Returns what it does, and (often) when to use it.

Returns:

  • (String)

    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

#locationString (readonly)

Returns absolute path of the SKILL.md.

Returns:

  • (String)

    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

#nameString (readonly)

Returns the name the model loads it by.

Returns:

  • (String)

    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

#pathsArray<String> (readonly)

Returns normalized paths: patterns; empty means advertised unconditionally — see PathMatcher before reading an empty one as "matches nothing".

Returns:

  • (Array<String>)

    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_useString? (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.

Returns:

  • (String, nil)

    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.

Returns:

  • (Boolean)

    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?