Skip to navigation

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.

On a manager that belongs to an agent, the skill’s tools, prompt sections, hints, and global data are registered on that agent, as with agent.addSkill(). On a standalone manager the call only records the skill.

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

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