addSkill

View as MarkdownOpen in Claude

Add a skill to the manager. The call sequence is:

  1. Deduplicate by instance key (multi-instance skills with the same key are skipped with a warning; single-instance duplicates throw).
  2. Validate required environment variables — throws if any are missing.
  3. Validate that the skill’s getParameterSchema() returns a non-empty object.
  4. Validate required NPM packages — throws if any cannot be imported.
  5. Call setup()throws if it returns false.
  6. Mark the skill initialized and register it.

addSkill fails closed: any validation miss or a setup() returning false throws and the skill is not registered. The wrapper methods loadSkill / loadSkillByName catch and convert the throw into a [false, message] tuple that matches the Python SDK’s load_skill contract.

Parameters

skill
SkillBaseRequired

The skill instance to add.

Returns

Promise<void>

Throws

  • Error — duplicate single-instance skill already loaded.
  • Error — missing required environment variables.
  • ErrorgetParameterSchema() returns an empty object.
  • Error — missing required NPM packages.
  • Errorsetup() returned false.