R6 class representing a skill with progressive loading capabilities.
A Skill consists of:
Level 1: YAML frontmatter (name, description) - always loaded
Level 2: SKILL.md body (detailed instructions) - on demand
Level 3: R scripts (executable code) - executed by agent
Public fields
name
The unique name of the skill (from YAML frontmatter).
description
A brief description of the skill (from YAML frontmatter).
path
The directory path containing the skill files.
Methods
Method new()
Create a new Skill object by parsing a SKILL.md file.
Arguments
path
Path to the skill directory (containing SKILL.md).
Returns
A new Skill object.
Load the full SKILL.md body content (Level 2).
Returns
Character string containing the skill instructions.
Method execute_script()
Execute an R script from the skill's scripts directory (Level 3).
Uses callr for safe, isolated execution.
Usage
Skill$execute_script(script_name, args = list())
Arguments
script_name
Name of the script file (e.g., "normalize.R").
args
Named list of arguments to pass to the script.
Returns
The result from the script execution.
Method list_scripts()
List available scripts in the skill's scripts directory.
Returns
Character vector of script file names.
Method list_resources()
List available reference files in the skill's references directory.
Returns
Character vector of reference file names.
Method read_resource()
Read content of a reference file from the references directory.
Usage
Skill$read_resource(resource_name)
Arguments
resource_name
Name of the reference file.
Returns
Character string containing the resource content.
Method get_asset_path()
Get the absolute path to an asset in the assets directory.
Usage
Skill$get_asset_path(asset_name)
Arguments
asset_name
Name of the asset file or directory.
Returns
Absolute path string.
Print a summary of the skill.
Method clone()
The objects of this class are cloneable with this method.
Usage
Skill$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.