Module: Binpacker::Skills

Defined in:
lib/binpacker/skills.rb,
sig/binpacker/skills.rbs

Overview

Registry for the gem-shipped, user-facing agent skills. Skills live in the gem's top-level skills/ directory, each as skills//SKILL.md. See docs/adr/0003-agent-driven-install-and-skills.md.

Constant Summary collapse

ROOT =

Returns:

  • (String)
File.expand_path("../../skills", __dir__)

Class Method Summary collapse

Class Method Details

.body(name) ⇒ String

The SKILL.md body for a skill.

Parameters:

  • (Object)

Returns:

  • (String)

Raises:



30
31
32
33
34
# File 'lib/binpacker/skills.rb', line 30

def body(name)
  file = path(name)
  raise Error, "unknown skill: #{name}" unless file
  File.read(file)
end

.exist?(name) ⇒ Boolean

Parameters:

  • (Object)

Returns:

  • (Boolean)


19
20
21
# File 'lib/binpacker/skills.rb', line 19

def exist?(name)
  !path(name).nil?
end

.listArray[Hash[Symbol, String]]

[{ name:, path: }], sorted by name.

Returns:

  • (Array[Hash[Symbol, String]])


13
14
15
16
17
# File 'lib/binpacker/skills.rb', line 13

def list
  Dir.glob(File.join(ROOT, "*", "SKILL.md")).sort.map do |file|
    { name: File.basename(File.dirname(file)), path: file }
  end
end

.path(name) ⇒ String?

Absolute path of a skill's SKILL.md, or nil when unknown.

Parameters:

  • (Object)

Returns:

  • (String, nil)


24
25
26
27
# File 'lib/binpacker/skills.rb', line 24

def path(name)
  file = File.join(ROOT, name, "SKILL.md")
  File.file?(file) ? file : nil
end