Table of Contents

Method LoadAsync

Namespace
LMKit.Agents.Skills
Assembly
LM-Kit.NET.dll

LoadAsync(string, CancellationToken)

Asynchronously loads an Agent Skill from a directory containing a SKILL.md file.

public static Task<AgentSkill> LoadAsync(string skillPath, CancellationToken cancellationToken = default)

Parameters

skillPath string

The path to the skill directory. Must contain a SKILL.md file.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<AgentSkill>

A task that represents the asynchronous operation, containing the loaded Agent Skill.

Examples

Asynchronous loading with cancellation support:

var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var skill = await AgentSkill.LoadAsync("./skills/code-review", cts.Token);
Console.WriteLine($"Loaded: {skill.Name}");

Exceptions

ArgumentNullException

Thrown when skillPath is null.

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.