Godot Csharp logo

Godot Csharp

Community
fetasty
godot-csharp

Godot 4 C# code quality: .NET patterns, attribute-based exports, signal delegates, async patterns, type-safe node access, and C#-specific Godot idioms. Use when writing or reviewing .cs files in Godot 4 projects for: (1) Enforcing partial class and nullable reference types, (2) Designing [Signal] delegate architecture, (3) Implementing C# design patterns with Godot integration, (4) Managing .csproj and NuGet dependencies, (5) Reviewing C# for Godot-specific anti-patterns.

Overview

Publisherfetasty
Repositorygodot-skills
Skill namegodot-csharp
Stars
35
Forks
0
Bundled files
Instructions only
LicenseMIT
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 fetasty on GitHub. Read the source before you install it.

Installation

Install the Godot Csharp 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.
    https://github.com/fetasty/godot-skills/tree/main/godot-csharp
  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/fetasty/godot-skills.git /tmp/godot-skills
mkdir -p .claude/skills
cp -r /tmp/godot-skills/godot-csharp .claude/skills/godot-csharp
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Godot Csharp 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 Godot Csharp 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 Godot Csharp 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.

Godot C# Specialist

C# code quality, patterns, and performance for Godot 4.6 projects.

The partial class Requirement (Mandatory)

ALL node scripts MUST be declared as partial class:

csharp
// YES — partial class, matches node type
public partial class PlayerController : CharacterBody3D { }

// NO — source generator fails silently
public class PlayerController : CharacterBody3D { }

Godot 4's source generator requires partial to inject _GodotClass infrastructure. Missing this causes silent failures that are very hard to debug.

Static Typing and Null Safety

  • Enable nullable reference types: <Nullable>enable</Nullable> in .csproj
  • Use ? for nullable references; never assume a reference is non-null:
csharp
private HealthComponent? _healthComponent;   // nullable — may not be assigned yet
private Node3D _cameraRig = null!;            // non-nullable — guaranteed in _Ready()
  • Prefer explicit types; var is acceptable when type is obvious from RHS

Naming Conventions

ElementConventionExample
ClassesPascalCasePlayerController, WeaponData
Public membersPascalCaseMoveSpeed, JumpVelocity
Private fields_camelCase_currentHealth, _isGrounded
MethodsPascalCaseTakeDamage(), GetCurrentHealth()
ConstantsPascalCaseMaxHealth, DefaultMoveSpeed
Signal delegatesPascalCaseEventHandlerHealthChangedEventHandler
Signal callbacksOn prefixOnHealthChanged()
FilesPascalCase.csPlayerController.cs

Export and Inspector Attributes

csharp
using Godot;

[Export] public float MoveSpeed { get; set; } = 5.0f;
[Export] public bool IsEnabled { get; set; } = true;

// Enums
public enum DamageType { Physical, Magical, TrueDamage }
[Export] public DamageType DamageType { get; set; }

// Node references — use unique names (%) in .tscn
[Export] public HealthComponent? HealthComponent { get; set; }

// Resources
[Export] public WeaponData? StartingWeapon { get; set; }

Signal Architecture

csharp
// Declare delegate outside class OR use delegate keyword
[Signal]
public delegate void HealthChangedEventHandler(float newHealth, float oldHealth);

[Signal]
public delegate void DiedEventHandler(Node source);

// Emit
EmitSignal(SignalName.HealthChanged, _currentHealth, _previousHealth);
EmitSignal(SignalName.Died, killer);

// Connect
HealthChanged += OnHealthChanged;

// In _ExitTree():
HealthChanged -= OnHealthChanged;
  • Signal delegate names MUST end with EventHandler — source generator requires this
  • Always use SignalName.X (not string literals) for type safety
  • Unsubscribe in _ExitTree() to prevent memory leaks

Async Patterns

csharp
// Timers — use SceneTree, not Task.Delay()
await ToSignal(GetTree().CreateTimer(0.5f), SceneTreeTimer.SignalName.Timeout);

// Await signal
await ToSignal(animationPlayer, AnimationMixer.SignalName.AnimationFinished);

// Tween
var tween = CreateTween();
tween.TweenProperty(sprite, "modulate:a", 0.0f, 0.3f);
await ToSignal(tween, Tween.SignalName.Finished);

Never use Task.Delay() — it breaks frame synchronization with the engine.

Design Patterns

Composition Over Inheritance

csharp
private HealthComponent _healthComponent = null!;
private HitboxComponent _hitboxComponent = null!;

public override void _Ready()
{
    _healthComponent = GetNode<HealthComponent>("%HealthComponent");
    _hitboxComponent = GetNode<HitboxComponent>("%HitboxComponent");
    _healthComponent.Died += OnDied;
    _hitboxComponent.HitReceived += OnHitReceived;
}

Maximum inheritance depth: 3 levels after GodotObject.

Resource Pattern

csharp
[GlobalClass]
public partial class WeaponData : Resource
{
    [Export] public float Damage { get; set; } = 10.0f;
    [Export] public float AttackSpeed { get; set; } = 1.0f;
    [Export] public WeaponType WeaponType { get; set; }
}

Autoload Access

csharp
// In GameManager.cs
public partial class GameManager : Node
{
    public static GameManager Instance { get; private set; } = null!;

    public override void _Ready()
    {
        Instance = this;
    }
}

// Usage elsewhere
GameManager.Instance.PauseGame();

Performance

  • Disable _Process and _PhysicsProcess when not needed:
    csharp
    SetProcess(false);
    SetPhysicsProcess(false);
  • _Process(double delta) uses double — cast to float for engine math: (float)delta
  • Cache GetNode<T>() in _Ready() — never call inside _Process
  • Use StringName for frequently compared strings: new StringName("group_name")
  • Avoid LINQ in hot paths (_Process, collision callbacks) — allocates garbage
  • Prefer List<T> over Godot.Collections.Array<T> for C#-internal collections
  • Use object pooling for frequently spawned objects
  • Profile with Godot's profiler AND dotnet counters for GC pressure

GDScript/C# Boundary

  • Keep in C#: complex game systems, data processing, AI, anything unit-tested
  • Keep in GDScript: scenes needing fast iteration, level scripts, simple behaviors
  • At the boundary: prefer signals over direct cross-language method calls
  • Avoid GodotObject.Call() (string-based) — define typed interfaces
  • Threshold for C# → GDExtension: if a method runs >1000 times per frame AND profiling shows bottleneck

Common C# Anti-Patterns

  • Missing partial on node classes — source generator fails silently
  • Using Task.Delay() instead of GetTree().CreateTimer() — breaks frame sync
  • Calling GetNode() without generics — drops type safety
  • Forgetting to disconnect signals in _ExitTree() — memory leaks
  • Using Godot.Collections.* for internal C# data — unnecessary marshalling overhead
  • Static fields holding node references — breaks scene reload/multiple instances
  • Calling lifecycle methods directly — never call _Ready(), _Process() yourself
  • Capturing this in long-lived lambda signal handlers — prevents GC
  • Signal delegate names without EventHandler suffix — source generator fails

Frequently asked questions

What does the Godot Csharp AI skill do?

Godot 4 C# code quality: .NET patterns, attribute-based exports, signal delegates, async patterns, type-safe node access, and C#-specific Godot idioms. Use when writing or reviewing .cs files in Godot 4 projects for: (1) Enforcing partial class and nullable reference types, (2) Designing [Signal] delegate architecture, (3) Implementing C# design patterns with Godot integration, (4) Managing .csproj and NuGet dependencies, (5) Reviewing C# for Godot-specific anti-patterns.

Why use Godot Csharp on TypingMind?

Because you install it once and use it with any model. Godot Csharp 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 Godot Csharp in TypingMind?

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

Which AI models can use Godot Csharp?

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 Godot Csharp?

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

Is the Godot Csharp AI skill free?

Yes. It is published on GitHub by fetasty under the MIT license. 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 👇