Class: Pikuri::Skill::Catalog

Inherits:
Object
  • Object
show all
Defined in:
lib/pikuri/skill/catalog.rb

Overview

Discovery + validation of skills — Markdown files with YAML frontmatter that the agent loads on demand via SkillTool.

A skill is a directory containing a SKILL.md whose frontmatter declares name and description. Sibling files (scripts, references, templates) are sidecar content the LLM pulls in via the regular read tool against File.dirname(location). Pikuri implements the Agent Skills standard leniently — only a missing description is fatal.

Two concrete subclasses ship: Empty (the EMPTY singleton) and Bundled (the on-disk scanner). Hosts that read skills from something other than the filesystem (virtual FS, hardcoded registry) subclass directly.

Defined Under Namespace

Classes: Bundled, Empty, Skill

Constant Summary collapse

MAX_NAME_LENGTH =

Frontmatter name cap per the Agent Skills standard.

64
MAX_DESCRIPTION_LENGTH =

Frontmatter description cap per the Agent Skills standard.

1024
EMPTY =

Shared singleton for the no-skills case.

Empty.new.freeze

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns true when #list is empty; an empty catalog contributes no tool and no prompt block.

Returns:

  • (Boolean)

    true when #list is empty; an empty catalog contributes no tool and no prompt block.



85
86
87
# File 'lib/pikuri/skill/catalog.rb', line 85

def empty?
  list.empty?
end

#get(name) ⇒ Skill?

Parameters:

  • name (String)

Returns:

Raises:

  • (NotImplementedError)

    in the abstract base



79
80
81
# File 'lib/pikuri/skill/catalog.rb', line 79

def get(name)
  raise NotImplementedError, "#{self.class}#get must be implemented"
end

#listArray<Skill>

Returns skills in discovery order (which equals precedence order).

Returns:

  • (Array<Skill>)

    skills in discovery order (which equals precedence order).

Raises:

  • (NotImplementedError)

    in the abstract base



72
73
74
# File 'lib/pikuri/skill/catalog.rb', line 72

def list
  raise NotImplementedError, "#{self.class}#list must be implemented"
end

#rootsArray<String>

Absolute paths of the skill directories this catalog covers. Hosts wire these into +Pikuri::Workspace::Filesystem+'s readable: list so the LLM can read sidecar files.

Returns:

  • (Array<String>)

Raises:

  • (NotImplementedError)

    in the abstract base



95
96
97
# File 'lib/pikuri/skill/catalog.rb', line 95

def roots
  raise NotImplementedError, "#{self.class}#roots must be implemented"
end

#untrusted_levelSymbol

The untrusted trifecta leg SkillTool declares.

:hard in the base class: a subclass loading skills from somewhere this class cannot see makes no claim about their provenance, and silence buys the pessimistic value.

Returns:

  • (Symbol)

    :none or :hard



67
# File 'lib/pikuri/skill/catalog.rb', line 67

def untrusted_level = :hard