Method EnsureSkills
EnsureSkills()
Ensures the skill registry is initialized and returns it.
public SkillRegistry EnsureSkills()
Returns
- SkillRegistry
The skill registry for this agent.
Examples
Using EnsureSkills to load skills safely:
using LMKit.Model;
using LMKit.Agents;
using LMKit.Agents.Skills;
using var model = new LM("path/to/model.gguf");
var agent = new Agent(model);
// EnsureSkills creates the registry if needed
var skills = agent.Capabilities.EnsureSkills();
skills.LoadFromDirectory("./skills/general");
skills.LoadFromDirectory("./skills/specialized");
Console.WriteLine($"Total skills: {agent.Capabilities.Skills.Count}");
Remarks
If no skill registry has been set, a new empty registry is created. Use this method when you want to load skills without checking if the registry exists.