Logo vun Godot Gdscript

Godot Gdscript

Communautéit
fetasty
godot-gdscript

Godot 4 GDScript code quality: static typing, signal architecture, coroutines, design patterns, performance optimization, and GDScript-specific idioms. Use when writing or reviewing .gd files in Godot 4 projects for: (1) Enforcing static typing standards, (2) Designing signal and node communication patterns, (3) Implementing state machines/command/observer patterns in GDScript, (4) Optimizing GDScript performance, (5) Reviewing GDScript code for anti-patterns.

Iwwersiicht

Editeurfetasty
Repositorygodot-skills
Skill-Nummgodot-gdscript
Stären
35
Forks
0
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum fetasty op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Godot Gdscript an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/fetasty/godot-skills/tree/main/godot-gdscript
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

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-gdscript .claude/skills/godot-gdscript
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Godot Gdscript an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Godot Gdscript automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Godot Gdscript net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Godot GDScript Specialist

GDScript 2.0 code quality, patterns, and optimization for Godot 4.6 projects.

Static Typing (Mandatory)

ALL variables, parameters, and return types must have explicit type annotations:

gdscript
# YES — typed
var health: float = 100.0
var inventory: Array[Item] = []
func take_damage(amount: float, source: Node3D) -> void:
func get_items() -> Array[Item]:

# NO — untyped
var health = 100.0
func take_damage(amount, source):

Use @onready for typed node references:

gdscript
@onready var health_bar: ProgressBar = %HealthBar
@onready var sprite: Sprite2D = $Visuals/Sprite2D

Enable unsafe_* warnings in project settings to catch untyped code.

File Organization

  • One class_name per file — file name matches class in snake_case
    • player_character.gd → class_name PlayerCharacter
  • Scripts extend the node type they're attached to
  • Use @export_group and @export_subgroup for inspector organization

Signal Architecture

gdscript
signal health_changed(new_health: float, old_health: float)
signal died(source: Node)

# Modern emit syntax (Godot 4)
health_changed.emit(_current_health, _previous_health)
died.emit(killer)

# Typed connections
health_changed.connect(_on_health_changed)
# One-shot
health_changed.connect(_on_damaged_once, CONNECT_ONE_SHOT)
  • Prefer signals for decoupled communication between nodes
  • Never connect signals in _process() — connects every frame
  • Always disconnect in _exit_tree() if node may outlive the connection
  • Use EventBus autoload for global events, direct signals for parent-child

Coroutines and Async

gdscript
# Await a signal
await get_tree().create_timer(0.5).timeout

# Await a tween
var tween := create_tween()
tween.tween_property(sprite, "modulate:a", 0.0, 0.3)
await tween.finished

# Await parallel operations
var timer := get_tree().create_timer(1.0)
var tween := create_tween().tween_property(self, "position", target, 1.0)
await timer.timeout  # or await tween.finished

Never use yield() — that's Godot 3 syntax. Use await exclusively.

Design Patterns

State Machine

gdscript
enum State { IDLE, RUNNING, JUMPING, FALLING, ATTACKING }
var _current_state: State = State.IDLE

func _physics_process(delta: float) -> void:
    match _current_state:
        State.IDLE:
            _process_idle(delta)
        State.RUNNING:
            _process_running(delta)

For complex states, use node-based state machines (each state is a child Node).

Resource Pattern

gdscript
class_name WeaponData extends Resource
@export var damage: float = 10.0
@export var attack_speed: float = 1.0
@export var weapon_type: WeaponType

Resources are shared by default — use resource.duplicate() for per-instance data. Use duplicate_deep() for nested resources (Godot 4.5+).

Composition Over Inheritance

gdscript
@onready var health_component: HealthComponent = %HealthComponent
@onready var hitbox_component: HitboxComponent = %HitboxComponent

func _ready() -> void:
    health_component.died.connect(_on_died)
    hitbox_component.hit_received.connect(_on_hit_received)

Maximum inheritance depth: 3 levels after Node base.

Post-4.3 GDScript Features

From references/current-best-practices.md in the godot skill:

  • Variadic arguments (4.5+): func log(prefix: String, values: Variant...) -> void:
  • Abstract classes (4.5+): @abstract class_name BaseEnemy and @abstract func get_pattern()
  • Script backtracing: Call stacks available even in Release builds (4.5+)

Performance

  • Disable _process and _physics_process when not needed:
    gdscript
    set_process(false)
    set_physics_process(false)
  • Use _physics_process for movement/physics, _process for visuals/UI
  • Cache node references in @onready — never get_node() in _process
  • Use StringName for frequently compared strings: &"animation_name"
  • Avoid Array.find() in hot paths — use Dictionary lookups
  • Object pooling for frequently spawned objects (projectiles, particles)
  • Typed arrays (Array[Type]) are faster than untyped arrays
  • Threshold for GDScript → GDExtension: if a function runs >1000 times per frame

Common GDScript Anti-Patterns

  • Untyped variables and functions — disables compiler optimizations
  • Using $NodePath in _process instead of caching with @onready
  • Deep inheritance trees instead of composition
  • Signals for synchronous communication — use direct method calls
  • String comparisons instead of enums or StringName
  • Dictionaries for structured data instead of typed Resources
  • God-class Autoloads that manage everything
  • Editor signal connections — invisible in code, hard to track
  • Using yield() instead of await

Tooling

ripgrep for GDScript: No gdscript type exists. Always use --glob "*.gd" or glob: "*.gd". Using --type gdscript produces a hard error.

Heefeg gestallte Froen

Wat mécht de KI-Skill Godot Gdscript?

Godot 4 GDScript code quality: static typing, signal architecture, coroutines, design patterns, performance optimization, and GDScript-specific idioms. Use when writing or reviewing .gd files in Godot 4 projects for: (1) Enforcing static typing standards, (2) Designing signal and node communication patterns, (3) Implementing state machines/command/observer patterns in GDScript, (4) Optimizing GDScript performance, (5) Reviewing GDScript code for anti-patterns.

Firwat Godot Gdscript op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Godot Gdscript besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Godot Gdscript an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/fetasty/godot-skills/tree/main/godot-gdscript an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Godot Gdscript benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Godot Gdscript benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Godot Gdscript domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Godot Gdscript gratis?

Jo. De Skill gëtt vum fetasty ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇