A skill bundles extra system prompt text, tools, and the packages and
providers it needs, so you can add them to an Agent in one step with
agent$load_skill(skill).
Arguments
- name
Skill name.
- version
Version string. Defaults to
"0.0.0"(skill_create()defaults to"1.0.0").- description
Optional description.
- prompt
Optional text to add to the system prompt.
- tools
List of tools created with
ellmer::tool().- requires
List with optional
packagesandprovidersentries, each a character vector. Other entries are kept but not checked. It must hold only plain data, not functions or environments.- path
Optional path to the skill directory. It is recorded, not read.
Details
Create skills with Skill(), skill_create(), or skill_load(). Skills
are read-only: read fields with $, and to change one, edit
S7::props(skill) and pass the list back to Skill() with do.call(), as
in the example.
Tools are stored as given, not copied, so any state they hold is shared
with the originals. Creating a skill or checking its requirements never runs
tool code; skill_load() runs the R files a skill's tools come from.
Examples
concise <- Skill("concise", prompt = "Answer in one short paragraph.")
fields <- S7::props(concise)
fields$prompt <- "Answer in one sentence."
shorter <- do.call(Skill, fields)
shorter$prompt
#> [1] "Answer in one sentence."
concise$prompt
#> [1] "Answer in one short paragraph."
skill_check_requirements(concise)$ok
#> [1] TRUE