creating-dynamic-commands

Generate runtime menu items in Visual Studio extensions from dynamic data sources.

14|2|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/madskristensen/vs-agent-plugins --skill creating-dynamic-commands
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: creating-dynamic-commands
Source: https://github.com/madskristensen/vs-agent-plugins/tree/main/skills/creating-dynamic-commands
Command: npx skills add https://github.com/madskristensen/vs-agent-plugins --skill creating-dynamic-commands

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dynamic commands solve the problem of variable-length menus by generating menu items at runtime from a data source, enabling contextual actions like recent files lists or data-driven menus.

Core Features & Use Cases

  • Toolkit-based dynamic commands using BaseDynamicCommand<TCommand, TItem> with DynamicItemStart in .vsct for in-process dynamic items.
  • VSSDK approach using OleMenuCommand and MatchedCommandId, enabling per-item behavior created on-the-fly.
  • Guidance on when to prefer dynamic menus versus tool windows or visibility-based commands.

Quick Start

Begin by defining a dynamic item anchor in your .vsct and implementing GetItems to supply the data, then handle before-query-status and execute logic for each generated item.

Frequently Asked Questions about creating-dynamic-commands

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create dynamic menu items in Visual Studio extensions at runtime?

To create dynamic VS menu items, define a DynamicItemStart anchor in your .vsct file and implement BaseDynamicCommand or OleMenuCommand with MatchedCommandId to generate items at runtime from a data source.

What is the difference between BaseDynamicCommand and OleMenuCommand for dynamic menus?

BaseDynamicCommand is used for toolkit-based in-process dynamic items, whereas OleMenuCommand with MatchedCommandId enables the VSSDK approach, allowing per-item behavior to be created on-the-fly for out-of-process extensions.

When should I use dynamic commands instead of tool windows in VSIX extensions?

Use dynamic commands for variable-length menus driven by changing state, such as recent files lists or context menus. Tool windows are better suited for persistent, complex UI rather than contextual menu generation.

Can I generate context menus from a runtime data source in Visual Studio?

Yes, you can generate context menus from a runtime data source by implementing GetItems to supply the data and handling before-query-status and execute logic for each generated item.

Does the VSSDK approach support out-of-process dynamic command generation?

Yes, the VSSDK approach using OleMenuCommand and MatchedCommandId supports out-of-process extension approaches, enabling per-item behavior to be created on-the-fly for dynamic command generation.