dotnet-console-apps

Implements .NET CLI tools and long-running bots using System.CommandLine, Spectre.Console, and platform SDKs.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/envoydev/claude-stack --skill dotnet-console-apps-envoydev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-console-apps
Source: https://github.com/envoydev/claude-stack/tree/main/stack/skills/dotnet-console-apps
Command: npx skills add https://github.com/envoydev/claude-stack --skill dotnet-console-apps-envoydev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building a .NET console binary means choosing the right argument-parsing library, wiring it into the generic host correctly, and structuring bots so a slow handler never stalls the gateway connection - mistakes here produce tools that return wrong exit codes in CI and bots that silently drop connections. ## Core Features & Use Cases - CLI Argument Parsing: Conventions for choosing between System.CommandLine 2.0 GA, Spectre.Console.Cli, and Cocona, including migration warnings about beta-era breaking changes and deprecated sub-packages. - Bot and Gateway Consumers: Integration patterns for Telegram.Bot, Discord.Net, DSharpPlus, SlackNet, and CryptoExchange.Net running inside a BackgroundService with bounded-channel decoupling of receive loops from work handlers. - Verification Discipline: A prove-it-runs checklist covering warnaserror builds, --help rendering, and exit-code validation on success and failure paths. - Use Case: You are building a Telegram trading bot. This Skill guides you to run Telegram.Bot in a BackgroundService, drain a bounded channel for updates, model the order lifecycle as a Stateless state machine, and honor per-chat rate limits. ## Quick Start Ask the AI to scaffold a .NET 8 console app with System.CommandLine subcommands wired into the generic host, or to structure a Discord bot as a BackgroundService with channel-based backpressure.

Frequently Asked Questions about dotnet-console-apps

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

FAQPage Schema
How do I parse command-line arguments in a .NET console app?▼

Use System.CommandLine 2.0 GA for a real command tree with subcommands and tab-completion, Spectre.Console.Cli for a polished interactive CLI with DI support, or Cocona for the fastest small command surface. Wire the parser into the generic host yourself rather than using the deprecated Hosting package.

System.CommandLine vs Spectre.Console.Cli - which should I choose?▼

System.CommandLine is the parser behind the dotnet CLI and suits full command trees with subcommands and shell completion. Spectre.Console.Cli offers a type-safe attribute-based model with rich rendering like tables and progress bars, making it the better default for interactive tools.

How do I build a Telegram or Discord bot in .NET?▼

Run the platform client (Telegram.Bot, Discord.Net, or DSharpPlus) inside a BackgroundService with command handlers in DI. Decouple the receive loop from work by writing updates to a bounded channel drained by a consumer at controlled concurrency.

Does System.CommandLine 2.0 work with the generic host?▼

Yes, but wire it yourself: build the host with Host.CreateApplicationBuilder, register command handlers in DI, and resolve them inside SetAction on the command. Do not use the deprecated System.CommandLine.Hosting package, which is excluded from future releases.

Why does my .NET bot stop responding after an exception?▼

An exception escaping ExecuteAsync stops the BackgroundService and the host. Catch and log per cycle inside the loop, thread the stopping token through every call, and reconnect with exponential backoff plus jitter while re-subscribing channels on each fresh socket.

When should I not use this console-app approach?▼

Do not use it for the host lifecycle itself (that belongs to the hosted-worker skill covering BackgroundService and 24/7 hardening), for web APIs or webhook endpoints, or for desktop GUIs. Webhook-mode bots are web apps owned by the ASP.NET Core surface.