Method Activate
Activate(string, string)
Activates a skill by name and prepares its context for injection.
public SkillContext Activate(string skillName, string userContext = null)
Parameters
skillNamestringThe name of the skill to activate.
userContextstringOptional additional context from the user.
Returns
- SkillContext
The prepared skill context.
Examples
Activating a skill by name:
var activator = new SkillActivator(registry);
var context = activator.Activate("code-review", "Focus on security issues");
Console.WriteLine(context.FormattedInstructions);
Exceptions
- InvalidOperationException
Thrown when the registry is not set or the skill is not found.
Activate(AgentSkill, string)
Activates a skill and prepares its context for injection.
public SkillContext Activate(AgentSkill skill, string userContext = null)
Parameters
skillAgentSkillThe skill to activate.
userContextstringOptional additional context from the user.
Returns
- SkillContext
The prepared skill context.
Examples
Activating a skill directly:
var skill = AgentSkill.Load("./skills/code-review");
var activator = new SkillActivator();
var context = activator.Activate(skill, "Review for memory leaks");
Exceptions
- ArgumentNullException
Thrown when
skillisnull.