add-cli-command

Add or modify dotnet CLI commands, subcommands, and options across CLI projects.

1.2k|337|Updated Oct 13, 2022
One-click install
npx skills add https://github.com/dotnet/dotnet --skill add-cli-command
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-cli-command
Source: https://github.com/dotnet/dotnet/tree/main/src/sdk/.github/skills/add-cli-command
Command: npx skills add https://github.com/dotnet/dotnet --skill add-cli-command

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Adding or changing a dotnet CLI command or option requires coordinated edits across multiple projects, resource files, and tests, and missing any step breaks parsing, help output, or localization.

Core Features & Use Cases

  • Option Addition: Declare Option<T> or Argument<T> in the Definitions project, consume it in the managed implementation, and wire help and runtime strings into the correct resx files.
  • New Command Registration: Create a command definition, register it in the root command tree, build the managed parser, and wire it in Parser.cs.
  • Localization Workflow: Regenerate .xlf siblings via /t:UpdateXlf so help descriptions and runtime messages stay localized.
  • Use Case: When adding a new --output option to dotnet build, follow the file map to touch the definition, handler, both resx files, and parser tests without missing a step.

Quick Start

Add a new --verbosity option to the dotnet build command and update its help description and tests.

Frequently Asked Questions about add-cli-command

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

FAQPage Schema
How do I add a new option to a dotnet CLI command?

Declare the Option<T> in the command's definition class under Microsoft.DotNet.Cli.Definitions, add it via Options.Add in the constructor, then consume it in the managed implementation under src/Cli/dotnet/Commands. Add the help description to CommandDefinitionStrings.resx and regenerate the xlf files.

How do I add a new command to the dotnet CLI?

Create a command definition class, register it in DotNetCommandDefinition.cs via Subcommands.Add, create the managed implementation and a CommandParser with ConfigureCommand, then wire the parser in Parser.cs ConfigureManagedActions. Add tests under test/dotnet.Tests/CommandTests.

What is the difference between CommandDefinitionStrings.resx and CliCommandStrings.resx?

CommandDefinitionStrings.resx holds help descriptions for commands, options, and arguments parsed by both managed and AOT hosts. CliCommandStrings.resx holds runtime messages emitted by managed handlers such as errors and validation output.

Does a new dotnet CLI command work with Native AOT?

Yes, a newly registered command runs under Native AOT through the managed fallback, and its parsing and --help reach the AOT CLI automatically. In-process execution in the native binary requires separate work covered by the add-dotnet-aot-command skill.

How do I regenerate xlf localization files after editing resx?

Run the build with /t:UpdateXlf to regenerate the .xlf siblings of both resx files. Never hand-edit xlf files, and commit the resx and xlf changes together.