Skip to content

feat(skills): Add system-commandline-cli skill for managing .NET CLI commands based on System.CommandLine library - #2584

Open
massimobonanni wants to merge 1 commit into
github:mainfrom
massimobonanni:SystemCommandLine-Skill
Open

feat(skills): Add system-commandline-cli skill for managing .NET CLI commands based on System.CommandLine library#2584
massimobonanni wants to merge 1 commit into
github:mainfrom
massimobonanni:SystemCommandLine-Skill

Conversation

@massimobonanni

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • My contribution adds a new instruction, prompt, agent, skill, workflow, or canvas extension file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, workflow, or canvas extension with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.
  • I am targeting the main branch for this pull request.

Description

This pull request adds a new skill for working with .NET CLI applications built using System.CommandLine, and documents its usage and conventions. The most important changes are:

New Skill Addition:

  • Added the system-commandline-cli skill, which provides detailed rules, patterns, and best practices for adding, modifying, or reviewing CLI commands in .NET projects using System.CommandLine. The skill includes when to trigger, what scenarios are in scope, and when not to use it. [1] [2]

Documentation Updates:

  • Updated docs/README.skills.md to include the new system-commandline-cli skill, its installation command, and a clear description of its intended use cases and exclusions.

Skill Guidelines and Best Practices:

  • Created skills/system-commandline-cli/SKILL.md with comprehensive guidelines covering project architecture, command base class usage, options/arguments definition, handler patterns, command grouping, registration, destructive operation confirmation, dependency injection, naming conventions, global options, validation, and a checklist for new commands.

Type of Contribution

  • New instruction file.
  • New prompt file.
  • New agent file.
  • New plugin.
  • New skill file.
  • New agentic workflow.
  • New canvas extension.
  • Update to existing instruction, prompt, agent, plugin, skill, workflow, or canvas extension.
  • Other (please specify):

By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

Copilot AI balanced review requested due to automatic review settings August 7, 2026 15:17
@github-actions github-actions Bot added new-submission PR adds at least one new contribution skills PR touches skills labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🔒 PR Risk Scan Results

Scanned 1 changed file(s).

Severity Count
🔴 High 0
🟠 Medium 0
ℹ️ Info 0

✅ No matching risk patterns were detected in changed files.

This is an automated soft-gate report. Findings indicate review targets and do not block merge by themselves.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🔍 Vally Lint Results

✅ All checks passed

Scope Checked
Skills 1
Agents 0
Total 1
Severity Count
❌ Errors 0
⚠️ Warnings 0
ℹ️ Advisories 0

Summary

Level Finding
ℹ️ ✅ system-commandline-cli (2/2 checks passed)
ℹ️ ✓ [spec-compliance] All 1 skill(s) are spec-compliant.
ℹ️ ✓ spec-compliance: All spec checks passed.
ℹ️ ✓ [valid-refs] All file references across 1 skill(s) are valid.
ℹ️ ✓ valid-refs: All file references resolve to existing files within the skill directory.
ℹ️ 1 skill(s) linted, 1 passed
Full linter output
### Linting skills/system-commandline-cli
✅ system-commandline-cli (2/2 checks passed)
    ✓ [spec-compliance] All 1 skill(s) are spec-compliant.
        ✓ spec-compliance: All spec checks passed.
    ✓ [valid-refs] All file references across 1 skill(s) are valid.
        ✓ valid-refs: All file references resolve to existing files within the skill directory.

1 skill(s) linted, 1 passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a reusable skill for developing .NET CLIs with System.CommandLine.

Changes:

  • Adds command architecture, handlers, DI, validation, and naming guidance.
  • Adds the skill to generated documentation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
skills/system-commandline-cli/SKILL.md Defines the new skill and examples.
docs/README.skills.md Lists installation and usage details.
Suppressed comments (1)

skills/system-commandline-cli/SKILL.md:313

  • The checklist reintroduces the unconditional async requirement even if Rule 3 is corrected. Allow a synchronous handler signature when the command performs no asynchronous work.
5. ✅ Handler signature: `async Task<int> CommandHandler(ParseResult, CancellationToken)`

@@ -0,0 +1,317 @@
---
name: system-commandline-cli
description: "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', 'SetAction', 'ParseResult', 'RootCommand', 'subcommand', or asks to add a verb to the CLI. Do NOT use for general C# coding, web APIs, UI work, or non-CLI projects."
# 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.

## RULE 3 — Command Handler Pattern

Handlers are **async methods** wired via `SetAction`:
Comment on lines +197 to +202
Add a convenience extension in `ServiceProviderExtensions.cs`:

```csharp
public static IMyService GetMyService(this ServiceProvider provider)
=> provider.GetRequiredService<IMyService>();
```
1. Set `Recursive = true` so the option is accepted for every descendant command.
2. Add each global option exactly once to `RootCommand.Options`; do not duplicate it on leaf commands.
3. Read values through the shared symbol, for example
`parseResult.GetValue(GlobalOptions.Endpoint)`, preferably behind a `CommandBase` helper.
Comment on lines +294 to +295
5. Validate endpoint options as nonblank absolute `http` or `https` URIs. Reject unsupported schemes,
relative URIs, query strings, and fragments because appending a fixed endpoint path would change their meaning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-submission PR adds at least one new contribution skills PR touches skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants