vscode-extension-guide

Guide for creating VS Code extensions from scratch to Marketplace publication. Use when: (1) Creating a new VS Code extension, (2) Adding commands, keybindings, or settings to an extension, (3) Publishing to VS Code Marketplace, (4) Troubleshooting extension activation or packaging issues, (5) Building TreeView or Webview UI, (6) Setting up extension tests.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "vscode-extension-guide" with this command: npx skills add aktsmm/agent-skills/aktsmm-agent-skills-vscode-extension-guide

VS Code Extension Guide

Create, develop, and publish VS Code extensions.

When to Use

  • VS Code extension, extension development, vscode plugin
  • Creating a new VS Code extension from scratch
  • Adding commands, keybindings, or settings to an extension
  • Publishing to VS Code Marketplace

Quick Start

# Scaffold new extension (recommended)
npm install -g yo generator-code
yo code

# Or minimal manual setup
mkdir my-extension && cd my-extension
npm init -y && npm install -D typescript @types/vscode

Project Structure

my-extension/
├── package.json          # Extension manifest (CRITICAL)
├── src/extension.ts      # Entry point
├── out/                  # Compiled JS (gitignore)
├── images/icon.png       # 128x128 PNG for Marketplace
└── .vscodeignore         # Exclude files from VSIX

Building & Packaging

npm run compile      # Build once
npm run watch        # Watch mode (F5 to launch debug)
npx @vscode/vsce package   # Creates .vsix

Done Criteria

  • Extension activates without errors
  • All commands registered and working
  • Package size < 5MB (use .vscodeignore)
  • README.md includes Marketplace/GitHub links

Quick Troubleshooting

SymptomFix
Extension not loadingAdd activationEvents to package.json
Command not foundMatch command ID in package.json/code
Shortcut not workingRemove when clause, check conflicts

Best Practices

命名の一貫性

公開前にパッケージ名・設定キー・コマンド名を統一:

項目
パッケージ名copilot-scheduler
設定キーcopilotScheduler.enabled
コマンドIDcopilotScheduler.createTask
ビューIDcopilotSchedulerTasks

通知の一元管理

type NotificationMode = "sound" | "silentToast" | "silentStatus";

function getNotificationMode(): NotificationMode {
  const config = vscode.workspace.getConfiguration("myExtension");
  return config.get<NotificationMode>("notificationMode", "sound");
}

function notifyInfo(message: string, timeoutMs = 4000): void {
  const mode = getNotificationMode();
  switch (mode) {
    case "silentStatus":
      vscode.window.setStatusBarMessage(message, timeoutMs);
      break;
    case "silentToast":
      void vscode.window.withProgress(
        { location: vscode.ProgressLocation.Notification, title: message },
        async () => {},
      );
      break;
    default:
      void vscode.window.showInformationMessage(message);
  }
}

function notifyError(message: string, timeoutMs = 6000): void {
  const mode = getNotificationMode();
  if (mode === "silentStatus") {
    vscode.window.setStatusBarMessage(`⚠ ${message}`, timeoutMs);
    console.error(message);
    return;
  }
  void vscode.window.showErrorMessage(message);
}

設定で notificationMode を選べるようにすることで、ユーザーが通知音を制御可能。

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

code-simplifier

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

chrome-extension-dev

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

vscode-custom-agents

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

powerpoint-automation

No summary provided by upstream source.

Repository SourceNeeds Review
631-aktsmm