context-menus

$npx mdskill add microsoft/vscode/context-menus

A context menu lists the actions for the clicked object in a predictable order, so users find the same action in the same place on every object and surface.

SKILL.md

.github/skills/context-menusView on GitHub ↗
---
name: context-menus
description: 'Use when adding, changing, or reviewing context menus or menu contributions, including Action2 `menu` entries and MenuRegistry items with `group`/`order`, hand-built `showContextMenu` action lists, submenus, and separators. Covers group order, destructive-action placement, consistency across surfaces, and labels.'
---

# Context menus

A context menu lists the actions for the clicked object in a predictable order, so users find the same action in the same place on every object and surface.

## Group order

Groups render in lexicographic order of their ID, with `navigation` always first. Use these groups, in this order, for new menus and for all Agents window menus:

| Group | Purpose |
|---|---|
| `navigation` | Open, create, or run the object. The default (double-click or Enter) action comes first. |
| `1_state` | Change the object's state. |
| `2_organize` | Change where the object is listed or how it is ordered. |
| `3_copy` | Copy information about the object to the clipboard. |
| `4_manage` | Configure or edit the object itself. Destructive actions come last. |

- Order items within a group with `order` (or `group@n` in `package.json`) instead of relying on title sorting.
- Prefer these groups over inventing new ones. A new group needs a purpose none of them covers.
- Established workbench menus with documented groups (editor, Explorer, terminal, editor title) keep their own group IDs. Add to the closest matching group.
- Group IDs of menus open to extensions are API. When you change one, update every contribution, including `extensions/*/package.json`.

## Rules

- **Destructive actions last.** An action that deletes or removes data is the final item of the menu. Never place it mid-menu.
- **Same object, same menu.** An object shown in several places (list row, tab, header, card) offers the same actions in the same order. Reuse one `MenuId` or the same group IDs rather than building a parallel action list by hand.
- **Inline actions are in the menu too.** Every hover or toolbar action of a row or header also appears in its context menu.
- **Only actions for the clicked object.** List-wide or unrelated actions belong on the section header, view title, or empty space, not on an item.
- **Hide what doesn't apply; disable what can't run now.** Use `when` for actions irrelevant to the object and `precondition` for applicable actions that are temporarily unavailable, such as single-item actions during multi-selection.
- **Keep it short.** At most about 5 groups and 15 items, with one level of submenus. Use a submenu for 3 or more related targets, and a toggle rather than a submenu for a two-way choice.
- **Labels.** Use Title Case. End with `...` when the action asks for more input or confirmation. Labels must be unique within a menu.
- **Dynamic actions join their group.** When actions must be built in code, merge them into the matching group of the menu's actions instead of appending them after a final separator. Join groups with `Separator.join`.

Based on the [VS Code context menu UX guidelines](https://code.visualstudio.com/api/ux-guidelines/context-menus), the [Windows menu guidelines](https://learn.microsoft.com/windows/win32/uxguide/cmd-menus), and the [Apple context menu guidelines](https://developer.apple.com/design/human-interface-guidelines/context-menus).

More from microsoft/vscode

SkillDescription
accessibilityPrimary accessibility skill for VS Code. REQUIRED for new feature and contribution work, and also applies to updates of existing UI. Covers accessibility help dialogs, accessible views, verbosity settings, signals, ARIA announcements, keyboard navigation, and ARIA labels/roles.
act-on-feedbackAct on user feedback attached to the current session. Use when the user submits feedback on the session's changes via the Submit Feedback button.
agent-customization**WORKFLOW SKILL** — Create, update, review, fix, or debug VS Code agent customization files (.instructions.md, .prompt.md, .agent.md, SKILL.md, copilot-instructions.md, AGENTS.md). USE FOR: saving coding preferences; troubleshooting why instructions/skills/agents are ignored or not invoked; configuring applyTo patterns; defining tool restrictions; creating custom agent modes or specialized workflows; packaging domain knowledge; fixing YAML frontmatter syntax. DO NOT USE FOR: general coding questions (use default agent); runtime debugging or error diagnosis; MCP server configuration (use MCP docs directly); VS Code extension development. INVOKES: file system tools (read/write customization files), ask-questions tool (interview user for requirements), subagents for codebase exploration. FOR SINGLE OPERATIONS: For quick YAML frontmatter fixes or creating a single file from a known pattern, edit the file directly — no skill needed.
agent-host-chat-contributionsBuild and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.
agent-host-e2e-testsUse when writing, recording, updating, validating, or troubleshooting Agent Host end-to-end and real-provider integration tests under src/vs/platform/agentHost/test/node/e2e and providerIntegration. Covers adding a cross-provider test, re-recording fixtures after an SDK bump, required cross-platform Azure validation, gating non-deterministic or platform-specific tests, and diagnosing replay cache misses.
agent-host-logsAnalyze Agent Host debug log exports. Use when given an ah-logs or ahp-logs zip/folder, an Export Agent Host Debug Logs bundle, events.jsonl, AHP JSONL transport logs, Agent Host.log, remote-agenthost.log, or copilot-logs.
author-contributionsIdentify all files a specific author contributed to on a branch vs its upstream, tracing code through renames. Use when asked who edited what, what code an author contributed, or to audit authorship before a merge. This skill should be run as a subagent — it performs many git operations and returns a concise table.
auto-perf-optimizeRun agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.
azure-pipelinesUse when validating Azure DevOps pipeline changes for the VS Code build. Covers queueing builds, checking build status, viewing logs, and iterating on pipeline YAML changes without waiting for full CI runs.
build-champ-triageFind out why a build has failed