应用简介
VS Code扩展开发指南:从脚手架到Marketplace发布
--- name: vscode-extension-guide-en description: "Guide for VS Code extension development from scaffolding to Marketplace publication" category: core-dev risk: safe source: community source_repo: lewiswigmore/agent-skills source_type: community date_added: "2026-04-12" author: lewiswigmore tags: [vscode, extension, ide, typescript, marketplace] tools: [claude, cursor, copilot, codex, gemini] --- # VS Code Extension Guide (English) ## Overview An English guide for building VS Code extensions, covering the full lifecycle from scaffolding to Marketplace publication. Includes reference material on webview patterns, CSP security, TreeView, testing, packaging and troubleshooting. Updated for VS Code 1.74+ APIs. Adapted from aktsmm/agent-skills (CC BY-NC-SA 4.0), translated to English with corrections for current VS Code APIs. ## When to Use This Skill - Use when creating a new VS Code extension from scratch - Use when adding commands, keybindings or settings to an extension - Use when building TreeView or Webview UI in an extension - Use when publishing an extension to the VS Code Marketplace - Use when troubleshooting extension activation or packaging issues ## How It Works ### Quick Start ```bash npm install -g yo generator-code yo code ``` ### Project Structure ``` my-extension/ ├── package.json # Extension manifest ├── src/extension.ts # Entry point ├── out/ # Compiled JS ├── images/icon.png # 128x128 PNG for Marketplace └── .vscodeignore # Exclude files from VSIX ``` ### Building and Packaging ```bash npm run compile # Build once npm run watch # Watch mode (F5 to launch debug) npx @vscode/vsce package # Creates .vsix ``` ## Reference Topics The full skill includes detailed reference documents on: - **Webview patterns** with CSP security and message passing - **TreeView** data providers and drag-and-drop - **Testing** setup with @vscode/test-electron - **Publishing** to the VS Code Marketplace - **AI customization** for extension projects - **Code review prompts** for extension code - **Troubleshooting** common extension issues ## Install the Full Skill For the complete guide with all reference documents: ```bash npx skills add lewiswigmore/agent-skills --skill vscode-extension-guide-en ``` ## Best Practices - Unify package name, setting keys, command IDs and view IDs before publishing - Keep package size under 5MB using `.vscodeignore` - Since VS Code 1.74, `activationEvents` are auto-detected for contributed commands and views - Always test with the Extension Development Host (F5) before packaging ## Common Pitfalls - **Problem:** Extension not loading **Solution:** Check `activationEvents`. Since VS Code 1.74, these are auto-detected for contributed commands/views. - **Problem:** Command not found **Solution:** Match the command ID exactly between package.json and your code. - **Problem:** Webview content not displaying **Solution:** Check your Content Security Policy. Use the webview's `cspSource` property. ## Related Skills - `@test-driven-development` - Write tests before implementing extension features - `@debugging-strategies` - Systematic troubleshooting for extension issues ## Limitations - Use this skill only when the task clearly matches the scope described above. - Do not treat the output as a substitute for environment-specific validation, testing, or expert review. - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
发布日期
5/16/2026
提供方
SkillOPIC
来源类型
导入
sickn33
other
数据安全
使用 Skill 时,您的对话内容将被发送至 AI 模型进行处理。我们会严格保护您的隐私数据,不会将您的对话内容用于模型训练或分享给第三方。 以下为此 Skill 的数据处理说明。
此 Skill 将处理您的对话输入
您的消息将作为 Prompt 上下文发送至 AI 模型
所有通信均通过加密通道传输
对话记录仅保存在本地
您可以随时清除本地对话历史,清除后数据不可恢复
评分和评价
已验证评分
Skill 信息
了解此 Skill 的详细信息和功能特性
其他
职场发展
文件结构
SKILL.md3.5 KB
版本历史
- 公开
- 来源于用户导入
如需详细了解相关要求,请访问帮助中心,或给我们提交反馈信息