dotnet-spectre-console
Create beautiful, interactive command-line interfaces for .NET apps.
Install
mkdir -p .claude/skills/dotnet-spectre-console && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13104" && unzip -o skill.zip -d .claude/skills/dotnet-spectre-console && rm skill.zipInstalls to .claude/skills/dotnet-spectre-console
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Renders rich console output. Spectre.Console tables, trees, progress, prompts, live displays.Key capabilities
- →Render styled text using BBCode-inspired markup
- →Display Figlet text with color and centering
- →Create horizontal rules with titles and alignment
- →Construct and style tables with columns and rows
- →Build hierarchical tree structures
- →Present content within panels
How it works
The skill uses Spectre.Console components to render various UI elements like tables, trees, and progress bars directly to the console using markup and styling.
Inputs & outputs
When to use dotnet-spectre-console
- →Building a TUI application
- →Adding progress bars to CLI
- →Creating interactive CLI prompts
About this skill
dotnet-spectre-console
Spectre.Console for building rich console output (tables, trees, progress bars, prompts, markup, live displays) and Spectre.Console.Cli for structured command-line application parsing. Cross-platform across Windows, macOS, and Linux terminals.
Version assumptions: .NET 8.0+ baseline. Spectre.Console 0.54.0 (latest stable). Spectre.Console.Cli 0.53.1 (latest stable). Both packages target net8.0+ and netstandard2.0.
Scope
- Spectre.Console rich output: markup, tables, trees, progress bars, prompts, live displays
- Spectre.Console.Cli command-line application framework
Out of scope
- Full TUI applications (windows, menus, dialogs, views) -- see [skill:dotnet-terminal-gui]
- System.CommandLine parsing -- see [skill:dotnet-system-commandline]
- CLI application architecture and distribution -- see [skill:dotnet-cli-architecture] and [skill:dotnet-cli-distribution]
Cross-references: [skill:dotnet-terminal-gui] for full TUI alternative, [skill:dotnet-system-commandline] for System.CommandLine scope boundary, [skill:dotnet-cli-architecture] for CLI structure, [skill:dotnet-csharp-async-patterns] for async patterns, [skill:dotnet-csharp-dependency-injection] for DI with Spectre.Console.Cli, [skill:dotnet-accessibility] for TUI accessibility limitations and screen reader considerations.
Package References
<ItemGroup>
<!-- Rich console output: markup, tables, trees, progress, prompts, live displays -->
<PackageReference Include="Spectre.Console" Version="0.54.0" />
<!-- CLI command framework (adds command parsing, settings, DI support) -->
<PackageReference Include="Spectre.Console.Cli" Version="0.53.1" />
</ItemGroup>
```bash
Spectre.Console.Cli has a dependency on Spectre.Console -- install both only when you need the CLI framework. For rich output only, Spectre.Console alone is sufficient.
---
## Markup and Styling
Spectre.Console uses a BBCode-inspired markup syntax for styled console output.
### Basic Markup
```csharp
using Spectre.Console;
// Styled text with markup tags
AnsiConsole.MarkupLine("[bold red]Error:[/] File not found.");
AnsiConsole.MarkupLine("[green]Success![/] Build completed in [blue]2.3s[/].");
AnsiConsole.MarkupLine("[underline]https://example.com[/]");
AnsiConsole.MarkupLine("[dim italic]This is subtle text[/]");
// Nested styles
AnsiConsole.MarkupLine("[bold [red on white]Warning:[/] check config[/]");
// Escape brackets with double brackets
AnsiConsole.MarkupLine("Use [[bold]] for bold text.");
```text
### Figlet Text
```csharp
AnsiConsole.Write(
new FigletText("Hello!")
.Color(Color.Green)
.Centered());
```text
### Rule (Horizontal Line)
```csharp
// Simple rule
AnsiConsole.Write(new Rule());
// Titled rule
AnsiConsole.Write(new Rule("[yellow]Section Title[/]"));
// Aligned rule
AnsiConsole.Write(new Rule("[blue]Left Aligned[/]").LeftJustified());
```text
---
## Tables
```csharp
var table = new Table();
// Add columns
table.AddColumn("Name");
table.AddColumn(new TableColumn("Age").Centered());
table.AddColumn(new TableColumn("City").RightAligned());
// Add rows
table.AddRow("Alice", "30", "Seattle");
table.AddRow("[green]Bob[/]", "25", "Portland");
table.AddRow("Charlie", "35", "Vancouver");
// Styling
table.Border(TableBorder.Rounded);
table.BorderColor(Color.Grey);
table.Title("[underline]Team Members[/]");
table.Caption("[dim]Updated daily[/]");
// Column configuration
table.Columns[0].PadLeft(2);
table.Columns[0].NoWrap();
AnsiConsole.Write(table);
```text
### Nested Tables
```csharp
var innerTable = new Table()
.AddColumn("Detail")
.AddColumn("Value")
.AddRow("Role", "Developer")
.AddRow("Level", "Senior");
var outerTable = new Table()
.AddColumn("Name")
.AddColumn("Info")
.AddRow("Alice", innerTable);
AnsiConsole.Write(outerTable);
```text
---
## Trees
```csharp
var tree = new Tree("Solution");
// Add nodes
var srcNode = tree.AddNode("[yellow]src[/]");
var apiNode = srcNode.AddNode("Api");
apiNode.AddNode("Controllers/");
apiNode.AddNode("Program.cs");
var libNode = srcNode.AddNode("Library");
libNode.AddNode("Services/");
var testNode = tree.AddNode("[blue]tests[/]");
testNode.AddNode("Api.Tests/");
// Styling
tree.Style = Style.Parse("dim");
AnsiConsole.Write(tree);
```text
---
## Panels
```csharp
var panel = new Panel("This is [green]important[/] content.")
.Header("[bold]Notice[/]")
.Border(BoxBorder.Rounded)
.BorderColor(Color.Blue)
.Padding(2, 1) // horizontal, vertical
.Expand(); // fill available width
AnsiConsole.Write(panel);
```text
### Composing Renderables with Columns
```csharp
AnsiConsole.Write(new Columns(
new Panel("Left panel").Expand(),
new Panel("Right panel").Expand()));
```csharp
---
## Progress Displays
### Progress Bars
```csharp
await AnsiConsole.Progress()
.AutoClear(false) // keep completed tasks visible
.HideCompleted(false)
.Columns(
new TaskDescriptionColumn(),
new ProgressBarColumn(),
new PercentageColumn(),
new RemainingTimeColumn(),
new SpinnerColumn())
.StartAsync(async ctx =>
{
var downloadTask = ctx.AddTask("[green]Downloading[/]", maxValue: 100);
var extractTask = ctx.AddTask("[blue]Extracting[/]", maxValue: 100);
while (!ctx.IsFinished)
{
await Task.Delay(50);
downloadTask.Increment(1.5);
if (downloadTask.Value > 50)
{
extractTask.Increment(0.8);
}
}
});
```text
### Status Spinners
```csharp
await AnsiConsole.Status()
.Spinner(Spinner.Known.Dots)
.SpinnerStyle(Style.Parse("green bold"))
.StartAsync("Processing...", async ctx =>
{
await Task.Delay(1000);
ctx.Status("Compiling...");
ctx.Spinner(Spinner.Known.Star);
await Task.Delay(1000);
ctx.Status("Publishing...");
await Task.Delay(1000);
});
```text
---
## Prompts
### Text Prompt
```csharp
// Simple typed input
var name = AnsiConsole.Ask<string>("What's your [green]name[/]?");
var age = AnsiConsole.Ask<int>("What's your [green]age[/]?");
// With default value
var city = AnsiConsole.Prompt(
new TextPrompt<string>("Enter [green]city[/]:")
.DefaultValue("Seattle")
.ShowDefaultValue());
// Secret input (password)
var password = AnsiConsole.Prompt(
new TextPrompt<string>("Enter [green]password[/]:")
.Secret());
// With validation
var email = AnsiConsole.Prompt(
new TextPrompt<string>("Enter [green]email[/]:")
.Validate(input =>
input.Contains('@') && input.Contains('.')
? ValidationResult.Success()
: ValidationResult.Error("[red]Invalid email address[/]")));
// Optional (allow empty)
var nickname = AnsiConsole.Prompt(
new TextPrompt<string>("Enter [green]nickname[/] (optional):")
.AllowEmpty());
```text
### Confirmation Prompt
```csharp
bool proceed = AnsiConsole.Confirm("Continue with deployment?");
```csharp
### Selection Prompt
```csharp
var fruit = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title("Pick a [green]fruit[/]:")
.PageSize(10)
.EnableSearch()
.WrapAround()
.AddChoices("Apple", "Banana", "Orange", "Mango", "Grape"));
// Grouped choices
var country = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title("Select [green]destination[/]:")
.AddChoiceGroup("Europe", "France", "Italy", "Spain")
.AddChoiceGroup("Asia", "Japan", "Thailand", "Vietnam"));
```text
### Multi-Selection Prompt
```csharp
var toppings = AnsiConsole.Prompt(
new MultiSelectionPrompt<string>()
.Title("Choose [green]toppings[/]:")
.PageSize(10)
.Required()
.InstructionsText("[grey](Press [blue]<space>[/] to toggle, [green]<enter>[/] to accept)[/]")
.AddChoices("Cheese", "Pepperoni", "Mushrooms", "Olives", "Onions"));
```text
---
## Live Displays
Live displays update in-place for dynamic content that changes over time.
```csharp
var table = new Table()
.AddColumn("Time")
.AddColumn("Status");
await AnsiConsole.Live(table)
.AutoClear(false)
.Overflow(VerticalOverflow.Ellipsis)
.Cropping(VerticalOverflowCropping.Bottom)
.StartAsync(async ctx =>
{
table.AddRow(DateTime.Now.ToString("T"), "[yellow]Starting...[/]");
ctx.Refresh();
await Task.Delay(1000);
table.AddRow(DateTime.Now.ToString("T"), "[green]Processing...[/]");
ctx.Refresh();
await Task.Delay(1000);
table.AddRow(DateTime.Now.ToString("T"), "[blue]Complete![/]");
ctx.Refresh();
});
```text
### Replacing the Target
```csharp
await AnsiConsole.Live(new Markup("[yellow]Initializing...[/]"))
.StartAsync(async ctx =>
{
await Task.Delay(1000);
ctx.UpdateTarget(new Markup("[green]Ready![/]"));
await Task.Delay(1000);
ctx.UpdateTarget(
new Panel("Final result: [bold]42[/]")
.Header("Done")
.Border(BoxBorder.Rounded));
});
```text
---
## Spectre.Console.Cli Framework
Spectre.Console.Cli provides a structured command-line parsing framework with command hierarchies, typed settings, validation, and automatic help generation.
### Basic Command App
```csharp
using Spectre.Console.Cli;
var app = new CommandApp<GreetCommand>();
return app.Run(args);
// Command with typed settings
public sealed class GreetSettings : CommandSettings
{
[CommandArgument(0, "<name>")]
[Description("The person to greet")]
public string Name { get; init; } = string.Empty;
[CommandOption("-c|--count")]
[Description("Number of times to greet")]
[DefaultValue(1)]
public int Count { get; init; }
[CommandOption("--shout")]
[Description("Greet in uppercase")]
---
*Content truncated.*
When not to use it
- →For full TUI applications with windows, menus, and dialogs
- →For System.CommandLine parsing
- →For general CLI application architecture and distribution
Prerequisites
Limitations
- →Does not support full TUI applications
- →Requires a terminal emulator supporting ANSI escape sequences for full functionality
- →TrueColor values may not be supported on all terminals
How it compares
This skill provides a structured way to create rich console UIs with advanced formatting, unlike basic console output that lacks styling and complex layouts.
Compared to similar skills
dotnet-spectre-console side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| dotnet-spectre-console (this skill) | 0 | 5mo | Review | Beginner |
| component-development | 1 | 4mo | Review | Intermediate |
| avalonia-viewmodels-zafiro | 0 | 6mo | No flags | Intermediate |
| syncfusion-blazor-toolkit-calendars | 0 | 1mo | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by rudironsoni
View all by rudironsoni →You might also like
component-development
FritzAndFriends
Guidance for creating Blazor components that emulate ASP.NET Web Forms controls. Use this when implementing new components or extending existing ones in the BlazorWebFormsComponents library.
avalonia-viewmodels-zafiro
davila7
Optimal ViewModel and Wizard creation patterns for Avalonia using Zafiro and ReactiveUI.
syncfusion-blazor-toolkit-calendars
syncfusion
Build and customize calendar-based components in Syncfusion Blazor Toolkit. Covers Calendar, DatePicker, DateTimePicker, and TimePicker. Use when implementing date/time selection features, handling date range restriction, formatting dates, managing calendar events, validating dates, or customizing c
syncfusion-blazor-toolkit-buttons
syncfusion
Implement interactive Blazor button components with Syncfusion Toolkit. Covers SfButton, SfButtonGroup with styling and accessibility.
dotnet-blazor
managedcode
Build and review Blazor applications across server, WebAssembly, web app, and hybrid scenarios with correct component design, state flow, rendering, and hosting choices.
blazor
aalmada
Write, review, and fix Blazor Server components in the BookStore project — covering render modes (InteractiveServer), lifecycle with IDisposable cleanup, DI via @inject/[Inject], ReactiveQuery<T> for SSE-driven data loading, MudBlazor forms/dialogs/tables, tenant-aware services, and AuthorizeView gu