resetInstance

View as MarkdownOpen in Claude

Static helper that clears the process-wide SkillRegistry singleton. The next call to getInstance() constructs a fresh registry with no registered skills, cleared search paths, and no locked names.

Intended for use in test suites that need a clean registry per test case. Calling this in production is almost always a bug — every previously registered skill is forgotten, and any code still holding the old instance reference will diverge from the new one.

Returns

void

Example

import { SkillRegistry } from '@signalwire/sdk';
describe('MySkill', () => {
beforeEach(() => {
SkillRegistry.resetInstance();
const registry = SkillRegistry.getInstance();
registry.register(MySkill);
});
afterAll(() => {
SkillRegistry.resetInstance();
});
it('registers correctly', () => {
expect(SkillRegistry.getInstance().has('my-skill')).toBe(true);
});
});