system-commandline-cli
What it does
This tool helps create and organize commands for .NET command-line programs. It defines how commands, options, and arguments should be structured and how they interact.
When to use it
- βWhen creating new commands for a command-line program.
- βWhen adding options or arguments to existing commands.
- βWhen organizing commands into logical groups.
Skill link
https://github.com/github/awesome-copilot/blob/main/skills/system-commandline-cli/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βHow do I add an option named --output that accepts text to a command?β
5 new skills a week. 1 minute to read.
How it works
The tool uses a defined structure to create command classes. Each command has a name, description, and can have options (like --verbose) or arguments (like a filename). Command actions are defined in separate methods.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
System.CommandLine CLI Developer Skill
You are working on a .NET CLI application built with System.CommandLine v2.x.x, targeting .NET 8 or later or any .NET Standard 2.0 implementation, including .NET Framework 4.6.1 or later and .NET Core 2.0 or later. Follow these rules and patterns strictly when creating or modifying CLI commands.
Architecture Overview
<CLI Project>/
βββ Program.cs # Entry point and command invocation
βββ Commands/
βββ CommandBase.cs # Base class for all commands
βββ GlobalOptions.cs # Defines global options for the CLI
βββ RootCommand.cs # Registers top-level commands
βββ <Group>/ # One folder per command group
βββ <Group>Command.cs # Parent command that registers its children
βββ <Group><Verb>Command.cs # Leaf command with its handler
RULE 1 β Prefer a Project-Specific Command Base Class
Prefer defining a project-specific abstract CommandBase that inherits from System.CommandLine.Command. Concrete commands should inherit from this base class so shared behavior and conventions remain centralized.
internal abstract class CommandBase : Command
{
protected CommandBase(string name, string? description = null)
: base(name, description)
{
}
}
internal sealed class MyCommand : CommandBase
{
public MyCommand()
: base("command-name", "Help text shown in --help")
{
this.SetAction(CommandHandler);
}
private async Task<int> CommandHandler(
ParseResult parseResult,
CancellationToken cancellationToken)
{
// implementation
return 0;
}
}
When the project already has a command base class, preserve its established conventions. Otherwise, introduce one when commands need shared behavior; simple applications may inherit from Command directly when a base class adds no meaningful value.
RULE 2 β Options and Arguments
Defining Options
private readonly Option<string> _myOption;
// In constructor:
_myOption = new Option<string>("--my-option")
{
Description = "Clear description of what this option does",
Required = true, // or false
};
_myOption.Aliases.Add("-m"); // Add a short alias
this.Options.Add(_myOption);
Defining Arguments (positional)
private readonly Argument<string> _fileArgument;
// In constructor:
_fileArgument = new Argument<string>("file")
{
Description = "Path to the input file"
};
this.Arguments.Add(_fileArgument);
Reading Values in Handlers
// Required option/argument β use GetValue:
var value = parseResult.GetValue(_myOption);
RULE 3 β Command Handler Pattern
Handlers are async methods wired via SetAction:
this.SetAction(CommandHandler);
private async Task<int> CommandHandler(ParseResult parseResult, CancellationToken cancellationToken)
{
// 1. Read option/argument values
// 2. Load session settings (if needed)
// 3. Validate configuration early β fail fast with clear error
// 4. Execute business logic
// 5. Output results with Console
return 0; // or non-zero exit code
}
RULE 4 β Command Group (Parent with Subcommands)
A group command registers children but does not call SetAction:
internal class MyGroupCommand : CommandBase
{
public MyGroupCommand()
: base("mygroup", "Manages my-group resources")
{
this.Subcommands.Add(new MyGroupListCommand());
this.Subcommands.Add(new MyGroupCreateCommand());
this.Subcommands.Add(new MyGroupDeleteCommand());
}
}
A command may define both an action and subcommands when the direct invocation has meaningful behavior.
RULE 5 β Registration
Top-level commands β register in
RootCommand.cs:this.Subcommands.Add(new MyGroupCommand());Subcommands β register inside the parent command's constructor:
this.Subcommands.Add(new MyGroupCreateCommand());
RULE 6 β User Confirmation for Destructive Operations
Console.WriteLine("Are you sure you want to delete X? This action cannot be undone. (yes/no)");
var confirmation = Console.ReadLine();
if (confirmation?.ToLower() != "yes" && confirmation?.ToLower() != "y")
{
Console.WriteLine("Operation cancelled.");
return 0;
}
β¦
FAQ
What is 'System.CommandLine'?
It's a .NET library that makes it easier to build robust and user-friendly command-line applications.
What's the difference between an Option and an Argument?
Options usually start with '--' (e.g., --verbose) and are optional or configurable. Arguments are positional values the command expects (e.g., a filename).
What is a 'Command Handler'?
It's the method that contains the main logic of what a command should do when it's executed.
Details
Original description by the author
Use this skill when adding, modifying, or reviewing CLI commands in a .NET project built with System.CommandLine. Triggers include: creating a new CLI command, adding options or arguments, wiring command handlers, registering subcommands, building command groups, or any architecture decision about CLI command structure. Also use when the user mentions 'System.CommandLine', 'CommandBase', 'SetActio
repo: github/awesome-copilot
Popularity
- GitHub stars
- 40k
- Ranking position
- #7446
- License
- MIT
- Updated
- 10/15/2026
Comments
- β¦
More skills from this repository
acquire-codebase-knowledge
40kHelps your agent understand and document an existing code project. It's useful for onboarding new people or getting an overview of the architecture.
acreadiness-assess
40kEnables your agent to assess a project's readiness for AI and generate a report. It's useful for understanding how well a project is prepared to use AI tools.
acreadiness-generate-instructions
40kHelps your agent create instructions for AI tools based on an assessment. It's useful for improving how AI interacts with code and closing identified gaps.
acreadiness-policy
40kEnables your agent to help define or apply policies for AI project assessment. It's useful for standardizing how projects are evaluated and ensuring compliance.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.