Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

vscode-extension-debugger

БесплатноБез исполняемых скриптовНе проверен

This skill provides expert-level guidance for debugging and fixing bugs in VS Code extensions. Use when investigating runtime errors, fixing memory leaks…

s-hiraokuот s-hiraoku★ 21 звезда на GitHub16 установок в других каталогах

Об этом скилле

VS Code Extension Debugger

Overview

This skill enables systematic debugging and bug fixing for VS Code extensions. It provides structured workflows for identifying root causes, analyzing error patterns, and implementing robust fixes while preventing regressions.

When to Use This Skill

  • Investigating runtime errors or crashes in extensions
  • Fixing memory leaks and dispose handler issues
  • Resolving WebView rendering or communication failures
  • Debugging extension activation or deactivation problems
  • Troubleshooting message passing between Extension and WebView
  • Fixing TypeScript compilation errors
  • Resolving race conditions and async operation issues
  • Debugging terminal-related functionality

Debugging Workflow

Phase 1: Bug Triage and Reproduction

  1. Gather Information

    • Error messages and stack traces
    • Steps to reproduce
    • Environment details (VS Code version, OS, extension version)
    • Frequency (always, intermittent, specific conditions)
  2. Classify Bug Type

    Category Symptoms Priority
    Crash Extension host crash, unhandled rejection P0
    Memory Leak Increasing memory usage over time P0
    Data Loss State not persisted, data corruption P0
    Functionality Feature not working as expected P1
    Performance Slow response, UI lag P1
    UI/UX Visual glitches, incorrect display P2
  3. Create Minimal Reproduction

    • Isolate the failing scenario
    • Document exact steps
    • Identify triggering conditions

Phase 2: Root Cause Analysis

Error Analysis Strategy

// Add strategic logging for investigation
console.log('[DEBUG] State before operation:', JSON.stringify(state));
try {
  await problematicOperation();
} catch (error) {
  console.error('[DEBUG] Error details:', {
    message: error.message,
    stack: error.stack,
    context: currentContext
  });
  throw error;
}

Common Root Cause Patterns

1. Dispose Handler Issues

// Bug: Missing dispose registration
const listener = vscode.workspace.onDidChangeConfiguration(...);
// listener never disposed!

// Fix: Always register disposables
context.subscriptions.push(
  vscode.workspace.onDidChangeConfiguration(...)
);

2. Race Conditions

// Bug: Concurrent operations conflict
async function createTerminal() {
  if (isCreating) return; // Insufficient guard
  isCreating = true;
  // ... creation logic
}

// Fix: Use atomic operation pattern
private creationPromise: Promise<void> | null = null;

async function createTerminal(): Promise<void> {
  if (this.creationPromise) {
    return this.creationPromise;
  }
  this.creationPromise = this.doCreateTerminal();
  try {
    await this.creationPromise;
  } finally {
    this.creationPromise = null;
  }
}

3. WebView Message Timing

// Bug: Message sent before WebView ready
panel.webview.postMessage({ type: 'init', data });

// Fix: Wait for ready signal
panel.webview.onDidReceiveMessage(msg => {
  if (msg.type === 'ready') {
    panel.webview.postMessage({ type: 'init', data });
  }
});

4. Null/Undefined Reference

// Bug: Assuming object exists
const terminal = this.terminals.get(id);
terminal.write(data); // Crash if undefined!

// Fix: Defensive access with early return
const terminal = this.terminals.get(id);
if (!terminal) {
  console.warn(`Terminal ${id} not found`);
  return;
}
terminal.write(data);

5. Async/Await Errors

// Bug: Unhandled promise rejection
someAsyncFunction(); // No await, no catch!

// Fix: Proper error handling
try {
  await someAsyncFunction();
} catch (error) {
  vscode.window.showErrorMessage(`Operation failed: ${error.message}`);
}

Phase 3: Fix Implementation

Fix Implementation Checklist

  • Identify all affected code paths
  • Consider edge cases and error scenarios
  • Maintain backward compatibility
  • Add defensive null checks
  • Ensure proper error handling
  • Register all disposables
  • Add logging for debugging
  • Consider performance impact

Safe Fix Patterns

Pattern 1: Guard Clause

async function processTerminal(id: number): Promise<void> {
  // Early validation
  if (id < 1 || id > MAX_TERMINALS) {
    throw new Error(`Invalid terminal ID: ${id}`);
  }

  const terminal = this.getTerminal(id);
  if (!terminal) {
    console.warn(`Terminal ${id} not found, skipping`);
    return;
  }

  // Safe to proceed
  await terminal.process();
}

Pattern 2: Try-Catch-Finally

async function safeOperation(): Promise<void> {
  const resource = await acquireResource();
  try {
    await performOperation(resource);
  } catch (error) {
    await handleError(error);
    throw error; // Re-throw after logging
  } finally {
    await releaseResource(resource); // Always cleanup
  }
}

Pattern 3: Timeout Protection ```typescrip

Полный SKILL.md на GitHub

Установить vscode-extension-debugger в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/common-bugs.mdreferences/debugging-tools.mdreferences/fix-patterns.md

FAQ

Что делает скилл vscode-extension-debugger?

This skill provides expert-level guidance for debugging and fixing bugs in VS Code extensions. Use when investigating runtime errors, fixing memory leaks, resolving WebView issues, debugging activation problems, fixing TypeScript type errors, or troubleshooting extension communication failures. Covers systematic debugging workflows, common bug patterns, root cause analysis, and prevention strategies.

Как установить скилл vscode-extension-debugger?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл vscode-extension-debugger запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить vscode-extension-debugger с