addSkill

View as MarkdownOpen in Claude

Load and activate a skill on this agent. Skills are pluggable capability modules that register their own tools, prompts, hints, and global data. The addSkill() method takes a SkillBase instance (not a string name).

This is an async method that returns Promise<this>. Use await when calling. Throws Error if a duplicate non-multi-instance skill is added. Check available skills with listSkills() or consult the skills catalog.

Parameters

skill
SkillBaseRequired

A skill instance to add to the agent. Skills extend SkillBase and provide tools, prompt sections, hints, and global data.

Returns

Promise<this> — Returns this for method chaining (async).

Example

1import { AgentBase, DateTimeSkill, MathSkill } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'assistant', route: '/assistant' });
4agent.setPromptText('You are a helpful assistant.');
5await agent.addSkill(new DateTimeSkill());
6await agent.addSkill(new MathSkill());
7await agent.serve();