Method ParseAsync
ParseAsync(string, CancellationToken)
Asynchronously parses a skill from the specified directory.
public static Task<AgentSkill> ParseAsync(string skillPath, CancellationToken cancellationToken = default)
Parameters
skillPathstringThe path to the skill directory containing a SKILL.md file.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<AgentSkill>
A task that represents the asynchronous operation, containing the parsed Agent Skill.
Examples
Asynchronously parsing a skill:
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var skill = await SkillParser.ParseAsync("./skills/code-review", cts.Token);
Console.WriteLine($"Parsed: {skill.Name}");
Exceptions
- ArgumentNullException
Thrown when
skillPathisnull.- DirectoryNotFoundException
Thrown when the specified directory does not exist.
- FileNotFoundException
Thrown when SKILL.md is not found in the specified directory.
- SkillParseException
Thrown when the SKILL.md file cannot be parsed.
- OperationCanceledException
Thrown when the operation is cancelled.