csharp-scripts

Execute single-file C# programs as scripts with NuGet package support.

5.1k|377|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/dotnet/skills --skill csharp-scripts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-scripts
Source: https://github.com/dotnet/skills/tree/main/plugins/dotnet/skills/csharp-scripts
Command: npx skills add https://github.com/dotnet/skills --skill csharp-scripts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill allows you to quickly write, test, and run small C# programs as scripts without the overhead of creating a full project, enabling rapid experimentation and prototyping.

Core Features & Use Cases

  • Script Execution: Run single-file C# programs directly.
  • Prototyping: Test C# concepts, APIs, or language features quickly.
  • Dependency Management: Easily add NuGet packages using the #:package directive.
  • Use Case: You need to quickly calculate the sum of a list of numbers in C#. You can write a short script, run it, and get the result immediately.

Quick Start

Use the csharp-scripts skill to execute the following C# code: Console.WriteLine("Hello, world!");

Frequently Asked Questions about csharp-scripts

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

FAQPage Schema
How do I run C# code snippets without creating a full project?

You can run C# code snippets instantly by executing single-file C# programs as scripts. This approach allows rapid experimentation and prototyping without the overhead of generating a complete project structure.

Can I add NuGet packages to a C# script for prototyping?

Yes, you can easily add NuGet packages to a C# script using the `#:package` directive. This enables quick integration of external libraries for testing APIs and language features.

What is the best way to quickly test C# concepts and APIs?

The best way to test C# concepts and APIs is using single-file C# scripts for rapid experimentation. This method supports top-level statements, allowing you to write and run short programs immediately.

Do I need a specific .NET SDK version to run C# scripts?

The script execution handles .NET SDK version checks automatically and provides a fallback for older SDKs. This ensures your C# scripts run correctly even if your environment is not fully up to date.

Can I execute C# scripts directly from the command line?

Yes, you can execute C# scripts directly by using a Unix shebang for direct execution. This allows running single-file C# programs seamlessly from the command line.