Method SaveToFile
SaveToFile(string, bool)
Saves the skill to disk as a SKILL.md file.
public string SaveToFile(string directoryPath, bool createDirectory = true)
Parameters
directoryPathstringThe directory where the skill will be saved.
createDirectoryboolWhether to create the directory if it doesn't exist.
Returns
- string
The path to the created SKILL.md file.
Examples
Saving a skill to disk:
var builder = new SkillBuilder()
.WithName("code-review")
.WithDescription("Reviews code")
.WithInstructions("# Guidelines\n...");
string skillPath = builder.SaveToFile("./skills/code-review");
Console.WriteLine($"Skill saved to: {skillPath}");
Exceptions
- InvalidOperationException
Thrown when required fields are missing.