Skip to content

feat: use_skill_search_code() #20

@jonthegeek

Description

@jonthegeek

Summary

As a package developer, in order to give AI agents the ability to search and
rewrite R code by syntax in my package, I would like to install a pkgskills
search-code skill with a single function call.

Proposed signature

use_skill_search_code(
  target_dir = ".github",
  use_skills_subdir = TRUE,
  overwrite = TRUE,
  open = rlang::is_interactive()
)

Arguments

All arguments for use_skill_search_code() are already defined in
@R/aaa-shared_params.R.

  • target_dir (character(1)) — Directory where the skill will be installed,
    relative to the project root. Defaults to ".github".
  • use_skills_subdir (logical(1)) — Whether to place the search-code
    folder under a skills subdirectory of target_dir. Defaults to TRUE,
    producing .github/skills/search-code/SKILL.md.
  • overwrite (logical(1)) — Whether to overwrite an existing skill file.
    Defaults to TRUE.
  • open (logical(1)) — Whether to open the installed skill file in the
    editor after creation. Defaults to rlang::is_interactive().

Returns the path to the installed skill file, invisibly (following the
usethis convention and the convention in use_skill_create_issue()).

Behavior

  • Validates all arguments using stbl (following the r-code skill
    conventions). Arguments only need to be validated once; things passed to
    .use_skill() without modification should be validated there.
  • Calls .use_skill() to install the skill.
  • Returns the installed skill file path invisibly.

Under the hood, use_skill_search_code() delegates to .use_skill():

.use_skill(
  "search-code",
  target_dir = target_dir,
  use_skills_subdir = use_skills_subdir,
  overwrite = overwrite,
  open = open
)

Details

  • Create inst/templates/skills/search-code/SKILL.md: a copy of
    .github/skills/search-code/SKILL.md. The file has no whisker template
    variables.
  • Create R/use_skill_search_code.R containing use_skill_search_code().

References

  • use_skill_document() in @R/use_skill_document.R — model for this function;
    use_skill_search_code() has the same structure but without the
    aaa-shared_params.R bootstrap step.
  • .use_skill() in @R/use_skill.R — core implementation for installing skills.
  • Existing .github/skills/search-code/SKILL.md — source for the template.
    EOF 2>&1

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions