Installs a skill from a GitHub repository or a local directory into a skills directory.
Arguments
- source
One of:
A GitHub URL pointing to a repo, e.g.
"https://github.com/owner/repo".A GitHub URL pointing to a subdirectory, e.g.
"https://github.com/owner/repo/tree/main/path/to/skill".A GitHub shorthand, e.g.
"owner/repo".A local directory path containing a
SKILL.mdfile.
- skill
The skill to install. One of:
A bare skill name, e.g.
"proofread". The skill is read fromskills/<skill>within the repository.A path to the skill directory, e.g.
"r-lib/mirai"or"r-lib/mirai/". Used directly as the subdirectory path.A path to the
SKILL.mdfile, e.g."r-lib/mirai/SKILL.md". The filename is stripped and the containing directory is used. Ignored whensourcealready points to a specific subdirectory via/tree/...or/blob/....
- path
The skills directory. Can be one of:
A known coding agent name such as
'claude_code','cursor', or'github_copilot'(seeskill_path()for the full list) to use that agent's conventional project-scope path.A character string giving the directory path directly.
NULL(the default), in which case the path is resolved from theWF_AGENTenvironment variable, or by prompting in interactive sessions. SetWF_AGENTin your.Renviron(e.g. withusethis::edit_r_environ()) to avoid the prompt.
- overwrite
If
FALSE(the default), an error is raised if the skill is already installed. Set toTRUEto replace it.
Examples
src <- tempfile()
dir.create(src)
writeLines(
c('---', 'name: example', 'description: An example skill.', '---'),
file.path(src, 'SKILL.md')
)
add_skill(src, path = tempfile())
#> Installed skill "example" to /tmp/Rtmplehrfy/file196d3ad8c1eb/example.
