Csharp Scripts logo

Csharp Scripts

Community
wshaddix
csharp-scripts

Run single-file C# programs as scripts for quick experimentation, prototyping, and concept testing. Use when the user wants to write and execute a small C# program without creating a full project.

Overview

Publisherwshaddix
Repositorydotnet-skills
Skill namecsharp-scripts
Stars
79
Forks
13
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by wshaddix on GitHub. Read the source before you install it.

Installation

Install the Csharp Scripts AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wshaddix/dotnet-skills.git /tmp/dotnet-skills
mkdir -p .claude/skills
cp -r /tmp/dotnet-skills/skills/csharp-scripts .claude/skills/csharp-scripts
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Csharp Scripts in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Csharp Scripts on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Csharp Scripts is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

C# Scripts

When to Use

  • Testing a C# concept, API, or language feature with a quick one-file program
  • Prototyping logic before integrating it into a larger project

When Not to Use

  • The user needs a full project with multiple files or project references
  • The user is working inside an existing .NET solution and wants to add code there
  • The program is too large or complex for a single file

Inputs

InputRequiredDescription
C# code or intentYesThe code to run, or a description of what the script should do

Workflow

Step 1: Check the .NET SDK version

Run dotnet --version to verify the SDK is installed and note the major version number. File-based apps require .NET 10 or later. If the version is below 10, follow the fallback for older SDKs instead.

Step 2: Write the script file

Create a single .cs file using top-level statements. Place it outside any existing project directory to avoid conflicts with .csproj files.

csharp
// hello.cs
Console.WriteLine("Hello from a C# script!");

var numbers = new[] { 1, 2, 3, 4, 5 };
Console.WriteLine($"Sum: {numbers.Sum()}");

Guidelines:

  • Use top-level statements (no Main method, class, or namespace boilerplate)
  • Place using directives at the top of the file
  • Place type declarations (classes, records, enums) after all top-level statements

Step 3: Run the script

bash
dotnet hello.cs

Builds and runs the file automatically. Cached so subsequent runs are fast. Pass arguments after --:

bash
dotnet hello.cs -- arg1 arg2 "multi word arg"

Step 4: Add NuGet packages (if needed)

Use the #:package directive at the top of the file to reference NuGet packages. Always specify a version:

csharp
#:package Humanizer@2.14.1

using Humanizer;

Console.WriteLine("hello world".Titleize());

Step 5: Clean up

Remove the script file when the user is done. To clear cached build artifacts:

bash
dotnet clean hello.cs

Unix shebang support

On Unix platforms, make a .cs file directly executable:

  1. Add a shebang as the first line of the file:

    csharp
    #!/usr/bin/env dotnet
    Console.WriteLine("I'm executable!");
  2. Set execute permissions:

    bash
    chmod +x hello.cs
  3. Run directly:

    bash
    ./hello.cs

Use LF line endings (not CRLF) when adding a shebang. This directive is ignored on Windows.

Source-generated JSON

File-based apps enable native AOT by default. Reflection-based APIs like JsonSerializer.Serialize<T>(value) fail at runtime under AOT. Use source-generated serialization instead:

csharp
using System.Text.Json;
using System.Text.Json.Serialization;

var person = new Person("Alice", 30);
var json = JsonSerializer.Serialize(person, AppJsonContext.Default.Person);
Console.WriteLine(json);

var deserialized = JsonSerializer.Deserialize(json, AppJsonContext.Default.Person);
Console.WriteLine($"Name: {deserialized!.Name}, Age: {deserialized.Age}");

record Person(string Name, int Age);

[JsonSerializable(typeof(Person))]
partial class AppJsonContext : JsonSerializerContext;

Converting to a project

When a script outgrows a single file, convert it to a full project:

bash
dotnet project convert hello.cs

Fallback for .NET 9 and earlier

If the .NET SDK version is below 10, file-based apps are not available. Use a temporary console project instead:

bash
mkdir -p /tmp/csharp-script && cd /tmp/csharp-script
dotnet new console -o . --force

Replace the generated Program.cs with the script content and run with dotnet run. Add NuGet packages with dotnet add package <name>. Remove the directory when done.

Validation

  • dotnet --version reports 10.0 or later (or fallback path is used)
  • The script compiles without errors (can be checked explicitly with dotnet build <file>.cs)
  • dotnet <file>.cs produces the expected output
  • Script file and cached artifacts are cleaned up after the session

Common Pitfalls

PitfallSolution
.cs file is inside a directory with a .csprojMove the script outside the project directory, or use dotnet run --file file.cs
#:package without a versionSpecify a version: #:package PackageName@1.2.3 or @* for latest
Reflection-based JSON serialization failsUse source-generated JSON with JsonSerializerContext (see Source-generated JSON)
Unexpected build behavior or version errorsFile-based apps inherit global.json, Directory.Build.props, Directory.Build.targets, and nuget.config from parent directories. Move the script to an isolated directory if the inherited settings conflict

More info

See https://learn.microsoft.com/en-us/dotnet/core/sdk/file-based-apps for a full reference on file-based apps.

Frequently asked questions

What does the Csharp Scripts AI skill do?

Run single-file C# programs as scripts for quick experimentation, prototyping, and concept testing. Use when the user wants to write and execute a small C# program without creating a full project.

Why use Csharp Scripts on TypingMind?

Because you install it once and use it with any model. Csharp Scripts is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Csharp Scripts in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wshaddix/dotnet-skills/tree/master/skills/csharp-scripts. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Csharp Scripts?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Csharp Scripts?

As many as you like. As long as a model supports skills, you can use Csharp Scripts with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Csharp Scripts AI skill free?

It is published on GitHub by wshaddix. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇