SkillRegistry: SkillRegistry Class

SkillRegistryR Documentation

SkillRegistry Class

Description

R6 class that manages a collection of skills. Provides methods to:

  • Scan directories for SKILL.md files

  • Cache skill metadata (Level 1)

  • Retrieve skills by name

  • Generate prompt sections for LLM context

Methods

Public methods


Method new()

Create a new SkillRegistry, optionally scanning a directory.

Usage
SkillRegistry$new(path = NULL, recursive = FALSE)
Arguments
path

Optional path to scan for skills on creation.

recursive

Whether to scan subdirectories when path is provided.

Returns

A new SkillRegistry object.


Method scan_skills()

Scan a directory for skill folders containing SKILL.md files.

Usage
SkillRegistry$scan_skills(path, recursive = FALSE, remember = TRUE)
Arguments
path

Path to the directory to scan.

recursive

Whether to scan subdirectories. Default FALSE.

remember

Whether this root should be remembered for refresh().

Returns

The registry object (invisibly), for chaining.


Method refresh()

Re-scan remembered skill roots so updates on disk become visible.

Usage
SkillRegistry$refresh(clear = TRUE)
Arguments
clear

If TRUE, clears currently loaded skills before re-scanning.

Returns

The registry object (invisibly).


Method list_roots()

List skill roots remembered by this registry.

Usage
SkillRegistry$list_roots()
Returns

A data frame with root path and recursive flag.


Method get_skill()

Get a skill by name.

Usage
SkillRegistry$get_skill(name)
Arguments
name

The name of the skill to retrieve.

Returns

The Skill object, or NULL if not found.


Method resolve_skill_name()

Resolve a skill name or alias to its canonical name.

Usage
SkillRegistry$resolve_skill_name(name)
Arguments
name

Skill name or alias.

Returns

Canonical skill name or NULL.


Method find_closest_skill_name()

Find the closest matching canonical skill name for fuzzy recovery.

Usage
SkillRegistry$find_closest_skill_name(name)
Arguments
name

Skill name or alias candidate.

Returns

Canonical skill name or NULL.


Method has_skill()

Check if a skill exists in the registry.

Usage
SkillRegistry$has_skill(name)
Arguments
name

The name of the skill to check.

Returns

TRUE if the skill exists, FALSE otherwise.


Method list_skills()

List all registered skills with their names and descriptions.

Usage
SkillRegistry$list_skills()
Returns

A data.frame with columns: name, description.


Method count()

Get the number of registered skills.

Usage
SkillRegistry$count()
Returns

Integer count of skills.


Method find_relevant_skills()

Find relevant skills for a user query and optional file paths.

Usage
SkillRegistry$find_relevant_skills(
  query = NULL,
  file_paths = character(0),
  cwd = NULL,
  limit = 3L
)
Arguments
query

Optional user query text.

file_paths

Optional character vector of file paths.

cwd

Optional working directory for path matching.

limit

Maximum number of results to return.

Returns

Data frame of matching skills sorted by score.


Method generate_prompt_section()

Generate a prompt section listing available skills. This can be injected into the system prompt.

Usage
SkillRegistry$generate_prompt_section()
Returns

Character string with formatted skill list.


Method print()

Print a summary of the registry.

Usage
SkillRegistry$print()

Method clone()

The objects of this class are cloneable with this method.

Usage
SkillRegistry$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


aisdk documentation built on May 29, 2026, 9:07 a.m.