跳到正文
Skillpedia
写作48k · #6136

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/vscode-extension-guide-en/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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, 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.
常见问题

什么是“脚手架”(scaffolding)?

就是自动生成项目初始结构的过程,比如一个已经预先配好基础文件的文件夹。

什么是 VS Code Marketplace?

它是一个在线商店,开发者可以在这里把自己的 VS Code 扩展分享给全世界的用户。

为什么扩展的体积很重要?

体积更小的扩展加载更快,占用的资源也更少,能提升用户体验。

详情

作者的原始描述

Guide for VS Code extension development from scaffolding to Marketplace publication

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#6136
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能