Method TryGet
TryGet(string, out AgentSkill)
Tries to get a skill by name.
public bool TryGet(string name, out AgentSkill skill)
Parameters
namestringThe skill name (case-insensitive).
skillAgentSkillWhen this method returns, contains the skill if found; otherwise,
null.
Returns
- bool
trueif the skill was found; otherwise,false.
Examples
Safe skill retrieval without exceptions:
var registry = new SkillRegistry();
registry.LoadFromDirectory("./skills");
if (registry.TryGet("code-review", out var skill))
{
Console.WriteLine(skill.Description);
}
else
{
Console.WriteLine("Skill not found");
}