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

1import { SkillRegistry } from '@signalwire/sdk';
2
3describe('MySkill', () => {
4 beforeEach(() => {
5 SkillRegistry.resetInstance();
6 const registry = SkillRegistry.getInstance();
7 registry.register(MySkill);
8 });
9
10 afterAll(() => {
11 SkillRegistry.resetInstance();
12 });
13
14 it('registers correctly', () => {
15 expect(SkillRegistry.getInstance().has('my-skill')).toBe(true);
16 });
17});