CustomSkillsSkill

View as MarkdownOpen in Claude

A meta-skill that registers user-defined tools from configuration. Define tools with names, descriptions, parameters, and JavaScript handler code without writing skill classes.

Class: CustomSkillsSkill

Tools: Dynamically created from the tools array

Env vars: SWML_ALLOW_CUSTOM_HANDLER_CODE must be set to "true" to enable handler execution.

tools
Record<string, unknown>[]

Array of custom tool definitions. Each object has:

  • name (string, required) — Unique tool name.
  • description (string, required) — Tool description shown to the AI.
  • handler_code (string, required) — JavaScript function body. Receives (args, rawData, FunctionResult) as arguments. Must return a FunctionResult, string, or object.
  • parameters (array, optional) — Parameter definitions: [{ name, type, description, required? }].
  • required (string[], optional) — Array of required parameter names.
  • prompt_description (string, optional) — Description to include in the prompt section.
  • secure (boolean, optional) — Whether to mark the tool as secure.
  • fillers (object, optional) — Filler phrases keyed by language.
prompt_title
stringDefaults to Custom Tools

Custom title for the prompt section.

prompt_body
string

Custom body text for the prompt section.

1import { AgentBase, CustomSkillsSkill } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'assistant', route: '/assistant' });
4agent.setPromptText('You are a helpful assistant.');
5
6await agent.addSkill(new CustomSkillsSkill({
7 tools: [
8 {
9 name: 'greet_user',
10 description: 'Greet the user by name.',
11 parameters: [
12 { name: 'name', type: 'string', description: 'The user name', required: true },
13 ],
14 required: ['name'],
15 handler_code: 'return new FunctionResult("Hello, " + args.name + "! Welcome.");',
16 },
17 ],
18}));
19
20agent.run();