Skip to main content

write_skill_template

Function write_skill_template 

Source
pub fn write_skill_template(
    dest: &Path,
    name: &str,
    description: &str,
) -> Result<PathBuf, SkillError>
Expand description

Resolve where a template write should land and write it.

dest interpretation:

  • If dest is an existing directory, the file is written to dest/<name>.md.
  • If dest ends in .md, it is used verbatim and its parent must already exist.
  • Otherwise dest is treated as a directory that should be created (and its parents created with create_dir_all) before writing dest/<name>.md.

Existing files are never overwritten — if the destination already exists, returns a SkillError::Io wrapping AlreadyExists. The caller should delete first if they really want to replace.