loadSkill

View as MarkdownOpen in Claude

Construct a skill instance from the provided class and add it via addSkill. Catches any throw from addSkill and returns a [success, errorMessage] tuple — matching the Python SDK’s load_skill return contract.

Parameters

skillClass
typeof SkillBaseRequired

A concrete subclass of SkillBase.

config
SkillConfig

Optional configuration forwarded to the skill constructor.

Returns

Promise<[boolean, string]>[true, ''] on success, [false, errorMessage] on any validation or setup failure.

Example

1import { MyCustomSkill } from './my-skill.js';
2
3const [ok, err] = await agent.skillManager.loadSkill(MyCustomSkill, { api_key: 'secret' });
4if (!ok) console.error(err);