***

title: SkillBase
slug: /reference/typescript/agents/skill-base
description: Abstract base class for creating reusable, pluggable agent skills.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[agentbase]: /docs/server-sdks/reference/typescript/agents/agent-base

[skills]: /docs/server-sdks/reference/typescript/agents/skills

[cleanup]: /docs/server-sdks/reference/typescript/agents/skill-base/cleanup

[getglobaldata]: /docs/server-sdks/reference/typescript/agents/skill-base/get-global-data

[gethints]: /docs/server-sdks/reference/typescript/agents/skill-base/get-hints

[getinstancekey]: /docs/server-sdks/reference/typescript/agents/skill-base/get-instance-key

[getparameterschema]: /docs/server-sdks/reference/typescript/agents/skill-base/get-parameter-schema

[getpromptsections]: /docs/server-sdks/reference/typescript/agents/skill-base/get-prompt-sections

[getskilldata]: /docs/server-sdks/reference/typescript/agents/skill-base/get-skill-data

[getskillnamespace]: /docs/server-sdks/reference/typescript/agents/skill-base/get-skill-namespace

[isinitialized]: /docs/server-sdks/reference/typescript/agents/skill-base/is-initialized

[markinitialized]: /docs/server-sdks/reference/typescript/agents/skill-base/mark-initialized

[setup]: /docs/server-sdks/reference/typescript/agents/skill-base/setup

[updateskilldata]: /docs/server-sdks/reference/typescript/agents/skill-base/update-skill-data

[validateenvvars]: /docs/server-sdks/reference/typescript/agents/skill-base/validate-env-vars

SkillBase is the abstract base class for all agent skills. Skills are modular,
reusable capabilities -- such as weather lookup, web search, or calendar access --
that can be added to any [`AgentBase`][agentbase]
agent with a single call to `agent.addSkill()`.

Extend SkillBase to create custom skills. You must implement the abstract methods
`getManifest()` and `getTools()`, and optionally override lifecycle and prompt methods.

<Info>
  For the catalog of built-in skills and their configuration parameters, see
  the [Skills][skills] page.
</Info>

## **Static Members**

<ParamField path="SUPPORTS_MULTIPLE_INSTANCES" type="boolean" default="false" toc={true}>
  When `true`, the same skill can be added to an agent multiple times with
  different configurations.
</ParamField>

<ParamField path="getParameterSchema()" type="static method" toc={true}>
  Returns metadata about all parameters the skill accepts.
  See [`getParameterSchema`][getparameterschema].
</ParamField>

## **Constructor**

```typescript {1}
constructor(skillName: string, config?: SkillConfig)
```

<ParamField path="skillName" type="string" required={true} toc={true}>
  Unique identifier for the skill (e.g., `"weather"`, `"web_search"`).
</ParamField>

<ParamField path="config" type="SkillConfig" toc={true}>
  Optional configuration key-value pairs for the skill instance.
</ParamField>

## **Instance Properties**

<ParamField path="skillName" type="string" toc={true}>
  The registered name for this skill instance (readonly).
</ParamField>

<ParamField path="instanceId" type="string" toc={true}>
  Unique identifier for this skill instance (readonly).
</ParamField>

<ParamField path="config" type="SkillConfig" toc={true}>
  Configuration parameters passed to the constructor (protected).
</ParamField>

<ParamField path="swaigFields" type={"Record<string, unknown>"} toc={true}>
  SWAIG metadata extracted from config, automatically merged into tool
  definitions (readonly).
</ParamField>

## **Methods**

<CardGroup cols={3}>
  <Card title="setup" href="/docs/server-sdks/reference/typescript/agents/skill-base/setup">
    Initialize the skill and prepare resources.
  </Card>

  <Card title="cleanup" href="/docs/server-sdks/reference/typescript/agents/skill-base/cleanup">
    Release resources when the skill is removed or the agent shuts down.
  </Card>

  <Card title="getParameterSchema" href="/docs/server-sdks/reference/typescript/agents/skill-base/get-parameter-schema">
    Return metadata about all parameters the skill accepts.
  </Card>

  <Card title="getGlobalData" href="/docs/server-sdks/reference/typescript/agents/skill-base/get-global-data">
    Return data to merge into the agent's global data.
  </Card>

  <Card title="getHints" href="/docs/server-sdks/reference/typescript/agents/skill-base/get-hints">
    Return speech recognition hints for this skill.
  </Card>

  <Card title="getInstanceKey" href="/docs/server-sdks/reference/typescript/agents/skill-base/get-instance-key">
    Get the unique key used to track this skill instance.
  </Card>

  <Card title="getPromptSections" href="/docs/server-sdks/reference/typescript/agents/skill-base/get-prompt-sections">
    Return prompt sections for the agent.
  </Card>

  <Card title="getSkillData" href="/docs/server-sdks/reference/typescript/agents/skill-base/get-skill-data">
    Extract this skill's namespaced data from raw request data.
  </Card>

  <Card title="getSkillNamespace" href="/docs/server-sdks/reference/typescript/agents/skill-base/get-skill-namespace">
    Get the namespace key used to store this skill's data.
  </Card>

  <Card title="updateSkillData" href="/docs/server-sdks/reference/typescript/agents/skill-base/update-skill-data">
    Write data under this skill's namespace into a FunctionResult.
  </Card>

  <Card title="isInitialized" href="/docs/server-sdks/reference/typescript/agents/skill-base/is-initialized">
    Check whether the skill has been initialized.
  </Card>

  <Card title="markInitialized" href="/docs/server-sdks/reference/typescript/agents/skill-base/mark-initialized">
    Mark the skill as initialized.
  </Card>

  <Card title="validateEnvVars" href="/docs/server-sdks/reference/typescript/agents/skill-base/validate-env-vars">
    Validate that required environment variables are set.
  </Card>
</CardGroup>

### getManifest (abstract)

```typescript {1}
abstract getManifest(): SkillManifest
```

Returns the skill's metadata including name, description, version, required environment
variables, and required packages. You **must** implement this in every subclass.

### getTools (abstract)

```typescript {1}
abstract getTools(): SkillToolDefinition[]
```

Returns the SWAIG tool definitions this skill provides. You **must** implement this
in every subclass. Each tool is registered with the agent when the skill is loaded.

### getConfig

```typescript {1}
getConfig<T = unknown>(key: string, defaultValue?: T): T
```

Read a configuration value by key, with an optional fallback default. Returns the
value cast to type `T`, or `defaultValue` if the key is not present.

<ParamField path="key" type="string" required={true} toc={true}>
  The configuration key to look up.
</ParamField>

<ParamField path="defaultValue" type="T" toc={true}>
  Value to return if the key is not present in the config.
</ParamField>

## **Examples**

### Custom skill

```typescript {3}
import { SkillBase, SkillManifest, SkillToolDefinition } from '@signalwire/sdk';

class MyWeatherSkill extends SkillBase {
  constructor(config?: Record<string, unknown>) {
    super('my_weather', config);
  }

  getManifest(): SkillManifest {
    return { name: 'my_weather', description: 'Look up weather', version: '1.0.0' };
  }

  getTools(): SkillToolDefinition[] {
    return [{
      name: 'get_weather',
      description: 'Get current weather for a city',
      parameters: { city: { type: 'string', description: 'City name' } },
      handler: async (args) => ({ response: 'Sunny, 72F' }),
    }];
  }
}
```

### Using a skill

```typescript {5}
import { AgentBase } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'weather-agent' });
agent.setPromptText("You are a helpful assistant.")
agent.addSkill("weather")

// Or with custom configuration
agent.addSkill("weather", { units: "celsius" })

// Entry point
agent.run()
```