skill: Skill Class

SkillR Documentation

Skill Class

Description

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).

aliases

Optional aliases that should also trigger this skill.

when_to_use

Optional triggering guidance for this skill.

paths

Optional file glob patterns that make this skill relevant.

path

The directory path containing the skill files.

manifest

Raw YAML frontmatter parsed from SKILL.md.

Methods

Public methods


Method new()

Create a new Skill object by parsing a SKILL.md file.

Usage
Skill$new(path)
Arguments
path

Path to the skill directory (containing SKILL.md).

Returns

A new Skill object.


Method load()

Load the full SKILL.md body content (Level 2).

Usage
Skill$load()
Returns

Character string containing the skill instructions.


Method get_manifest()

Return the raw SKILL.md frontmatter as a list.

Usage
Skill$get_manifest()
Returns

Named list of metadata fields.


Method to_store_record()

Export the skill to a structured record suitable for a skill store.

Usage
Skill$to_store_record(
  include_body = TRUE,
  include_files = TRUE,
  include_assets = FALSE
)
Arguments
include_body

Include the full SKILL.md body in the record.

include_files

Include textual source files from the skill folder.

include_assets

Include a list of asset file names.

Returns

A named list ready for JSON serialization.


Method metadata_text()

Return concise metadata text used for routing and listing.

Usage
Skill$metadata_text()
Returns

Character scalar.


Method matches_paths()

Check whether the skill's paths patterns match any provided file paths.

Usage
Skill$matches_paths(file_paths = character(0), cwd = NULL)
Arguments
file_paths

Character vector of file paths.

cwd

Optional working directory used to relativize absolute paths.

Returns

Logical scalar.


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.

Usage
Skill$list_scripts()
Returns

Character vector of script file names.


Method list_resources()

List available reference files in the skill's references directory.

Usage
Skill$list_resources()
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.


Method print()

Print a summary of the skill.

Usage
Skill$print()

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.


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