setup

View as MarkdownOpen in Claude

Initialize the skill: validate environment variables, initialize API clients, and prepare resources. Called once when the skill is loaded, before any tool registration.

This is a concrete method with a default that returns true. Override it in your SkillBase subclass when you need initialization logic or need to short-circuit loading on invalid config.

Returning false from setup() causes SkillManager.addSkill() (and AgentBase.addSkill()) to fail closed: the skill is not registered and the call throws. This matches the Python SDK’s behavior — never silently continue with a half-initialized skill.

Takes no parameters.

Returns

Promise<boolean>true on success, false to signal that the skill cannot be loaded (invalid config, missing credentials, failed handshake, etc.).

Example

1class MySkill extends SkillBase {
2 override async setup(): Promise<boolean> {
3 if (!this.hasAllEnvVars()) return false;
4 const missing = await this.validatePackages();
5 if (missing.length) return false;
6 // Initialize API connections here
7 return true;
8 }
9}