SkillBase
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 agent with a single call to
agent.addSkill().
Extend SkillBase to create custom skills. Metadata (name, description, version,
required packages, required environment variables, multi-instance support) is
declared as static class constants on the subclass — the SkillRegistry
and SkillManager read these constants directly. You override getTools() to
expose SWAIG tools and optionally override lifecycle and prompt methods.
For the catalog of built-in skills and their configuration parameters, see the Skills page.
Static Class Constants
Subclasses declare their identity and requirements by overriding these static
members. The SkillRegistry reads them directly — no manifest
object is exchanged.
SKILL_NAME
Unique skill name used for registration. Subclasses must override with a non-empty string; the constructor throws otherwise.
SKILL_DESCRIPTION
Human-readable description. Subclasses must override with a non-empty string; the constructor throws otherwise.
SKILL_VERSION
Semantic version string.
REQUIRED_PACKAGES
NPM packages the skill depends on. Checked at load time by validatePackages().
REQUIRED_ENV_VARS
Environment variables the skill requires. Checked at load time by validateEnvVars().
SUPPORTS_MULTIPLE_INSTANCES
When true, the same skill can be added to an agent multiple times with
different configurations (distinguished by tool_name).
getParameterSchema()
Returns metadata about all parameters the skill accepts.
See getParameterSchema.
Constructor
The skill name, description, and version come from the subclass’s static constants — not from constructor arguments.
config
Optional configuration key-value pairs for the skill instance. Any
swaig_fields entry is extracted and automatically merged into tool
definitions.
Instance Properties
skillName
The registered name for this skill instance, copied from SKILL_NAME (readonly).
instanceId
Unique identifier for this skill instance (readonly).
config
Configuration parameters passed to the constructor (protected).
swaigFields
SWAIG metadata extracted from config, automatically merged into tool definitions (readonly).
Methods
Initialize the skill. Return false to fail-closed on missing config.
Release resources when the skill is removed or the agent shuts down.
Return SWAIG tool definitions this skill exposes.
Return fully-built SWAIG function dicts (DataMap style).
Return metadata about all parameters the skill accepts.
Return data to merge into the agent’s global data.
Return speech recognition hints for this skill.
Get the unique key used to track this skill instance.
Return prompt sections for the agent.
Extract this skill’s namespaced data from raw request data.
Get the namespace key used to store this skill’s data.
Write data under this skill’s namespace into a FunctionResult.
Check whether the skill has been initialized.
Mark the skill as initialized.
Validate that required environment variables are set.
Check whether all required env vars are present.
Validate that required packages can be imported.
Check whether all required packages are importable.
Look up a configuration value by key.
Get the agent this skill is attached to.
Attach the skill to an agent.
Imperatively register a tool with this skill.
defineTool (protected)
Imperatively register a tool. Use from setup() when the tool shape depends on
config evaluated at runtime. The method merges this.swaigFields into the
definition and pushes it onto the internal dynamic-tools list; the default
getTools() returns that list. Skills with a static tool list should override
getTools() directly instead.
getConfig
Read a configuration value by key, with an optional fallback default.
key
The configuration key to look up.
defaultValue
Value to return if the key is not present in the config.
hasAllEnvVars / hasAllPackages
Boolean wrappers around validateEnvVars() and validatePackages().