csharp-scripts
Run file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without creating a project. Use for C# language/API experiments, one-file C# apps, small multi-file C# apps composed with `#:include`/`#:exclude`, or C# file-based apps linked with `#:ref`. Do not use for language-agnostic throwaway scripts, generic computations, Python/PowerShell-style automation, full projects, or existing app integration.
npx skills add dotnet/skills --skill csharp-scripts --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# File-Based C# Apps ## When to Use - Testing a C# concept, API, or language feature with a quick file-based app - Prototyping logic before integrating it into a larger project - Building a small utility from one entry-point file and a few helper `.cs` files ## When Not to Use - The user asks for a language-agnostic quick script, throwaway computation, or shell/Python/PowerShell-style automation - The user needs a full project, solution integration, or project references in an existing app - The user is working inside an existing .NET solution and wants to add code there - The app is large enough that project structure, build customization, tests, or publish configuration should live in a `.csproj` ## Inputs | Input | Required | Description | |-------|----------|-------------| | C# code or intent | Yes | The code to run, or a description of what the file-based app should do | ## Workflow ### Step 1: Check the .NET SDK version Run `dotnet --version` to verify the SDK is installed and note the full version, including the feature band. File-based apps require .NET 10 or later. `#:include`, `#:exclude`, and transitive directive processing require SDK 10.0.300 or later; SDK 10.0.100/10.
- When to Use
- When Not to Use
- Inputs
- Workflow
- Step 1: Check the .NET SDK version
- Step 2: Write the app file
- Step 3: Run the app
- Step 4: Add directives (if needed)
- Step 5: Clean up
- Unix shebang support
- Source-generated JSON
- Converting to a project
- Fallback for .NET 9 and earlier
- Validation
dotnet hello.cs dotnet hello.cs -- arg1 arg2 "multi word arg" dotnet clean hello.cs chmod +x hello.cs dotnet project convert hello.cs mkdir -p /tmp/csharp-file-based-app && cd /tmp/csharp-file-based-app dotnet new console -o . --force
What does the csharp-scripts skill do?
Run file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without creating a project. Use for C# language/API experiments, one-file C# apps, small multi-file C# apps composed with `#:include`/`#:exclude`, or C# file-based apps linked with `#:ref`. Do not use for language-agnostic throwaway scripts, generic computations, Python/PowerShell-style automation, full projects, or existing app integration.
How do I install it?
Run `npx skills add dotnet/skills --skill csharp-scripts --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
