vscode-extension-guide-en
它能做什么
这份指南教你从零开始为 VS Code 代码编辑器开发扩展,一直讲到发布上线。内容涵盖安全性、用户界面,以及如何解决常见问题。
适用场景
- ✓开始创建一个新的 VS Code 扩展时。
- ✓需要添加命令、菜单等新功能时。
- ✓准备把扩展发布出去供别人使用时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/vscode-extension-guide-en/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该怎么创建一个简单的 VS Code 扩展?”
每周 5 个新技能,1 分钟读完。
工作原理
它会提供启动项目的命令,并展示基本的文件结构。你可以用简单的命令编译和测试代码。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
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
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:
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,
activationEventsare 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
cspSourceproperty.
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.
常见问题
什么是“脚手架”(scaffolding)?
就是自动生成项目初始结构的过程,比如一个已经预先配好基础文件的文件夹。
什么是 VS Code Marketplace?
它是一个在线商店,开发者可以在这里把自己的 VS Code 扩展分享给全世界的用户。
为什么扩展的体积很重要?
体积更小的扩展加载更快,占用的资源也更少,能提升用户体验。
详情
作者的原始描述
Guide for VS Code extension development from scaffolding to Marketplace publication
热度
- GitHub 星标
- 48k
- 排名
- #6136
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。