home / skills / github / awesome-copilot / vscode-ext-commands

vscode-ext-commands skill

/skills/vscode-ext-commands

This skill helps you configure and contribute VS Code extension commands following official guidelines, ensuring proper titles, categories, visibility, and

npx playbooks add skill github/awesome-copilot --skill vscode-ext-commands

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.5 KB
---
name: vscode-ext-commands
description: 'Guidelines for contributing commands in VS Code extensions. Indicates naming convention, visibility, localization and other relevant attributes, following VS Code extension development guidelines, libraries and good practices'
---

# VS Code extension command contribution

This skill helps you to contribute commands in VS Code extensions

## When to use this skill

Use this skill when you need to:
- Add or update commands to your VS Code extension

# Instructions

VS Code commands must always define a `title`, independent of its category, visibility or location. We use a few patterns for each "kind" of command, with some characteristics, described below:

* Regular commands: By default, all commands should be accessible in the Command Palette, must define a `category`, and don't need an `icon`, unless the command will be used in the Side Bar.

* Side Bar commands: Its name follows a special pattern, starting with underscore (`_`) and suffixed with `#sideBar`, like `_extensionId.someCommand#sideBar` for instance. Must define an `icon`, and may or may not have some rule for `enablement`. Side Bar exclusive commands should not be visible in the Command Palette. Contributing it to the `view/title` or `view/item/context`, we must inform _order/position_ that it will be displayed, and we can use terms "relative to other command/button" in order to you identify the correct `group` to be used. Also, it's a good practice to define the condition (`when`) for the new command is visible.

Overview

This skill explains how to contribute commands to Visual Studio Code extensions, covering naming, visibility, icons, categories, and conditional display. It lays out patterns for regular commands and Side Bar-specific commands and highlights attributes that affect user discovery and behavior. The guidance aligns with VS Code extension development best practices and localization needs.

How this skill works

The skill inspects command contribution patterns and recommends required manifest fields such as title and category. It explains the naming convention for Side Bar commands (leading underscore and #sideBar suffix), when to add icons, and how to control visibility with when conditions and contribution locations. It also describes how to specify ordering and group placement for view/title and view/item/context entries.

When to use it

  • Adding new commands to a VS Code extension
  • Modifying command visibility or discoverability
  • Moving commands between Command Palette, editor context, and side bar
  • Localizing command titles and categories
  • Defining enablement or when conditions for UI commands

Best practices

  • Always define a human-friendly title for every command regardless of location.
  • Regular commands should include a category for Command Palette grouping.
  • Use the Side Bar naming pattern: start with an underscore and append #sideBar (e.g., _extId.command#sideBar).
  • Provide an icon for Side Bar commands and avoid showing them in the Command Palette when they are Side Bar exclusive.
  • Specify when conditions to control visibility and define enablement rules where appropriate.
  • Declare order/group for view/title or view/item/context contributions using relative positioning to place buttons logically.

Example use cases

  • Add a global formatting command with a category so it appears clearly in the Command Palette.
  • Create a Side Bar action with an icon and a when clause that only appears for specific view item types.
  • Define a right-click context command (view/item/context) ordered relative to existing buttons to match UX expectations.
  • Localize command titles and categories so the Command Palette and menus show translated labels.
  • Add enablement rules so a command is active only when a workspace or file type matches the intended scenario.

FAQ

Do all commands need a title?

Yes. Every command must define a human-friendly title to ensure it is discoverable and localizable.

When should I add an icon?

Add an icon for commands that appear in the Side Bar or toolbar. Command Palette entries do not require icons.

How do I keep a Side Bar command out of the Command Palette?

Use the Side Bar naming pattern and contribute the command only to view/title or view/item/context. Also avoid adding it to the global commands list so it remains exclusive to the view.