godot-gdscript

Provides GDScript syntax patterns, idioms, and common mistake fixes for Godot 4.3+.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/zerox-core/AI_Game --skill godot-gdscript-zerox-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: godot-gdscript
Source: https://github.com/zerox-core/AI_Game/tree/main/.claude/skills/godot-gdscript
Command: npx skills add https://github.com/zerox-core/AI_Game --skill godot-gdscript-zerox-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing GDScript for Godot 4 often trips developers on renamed APIs, changed signal syntax, and lifecycle pitfalls carried over from Godot 3 or other engines. This Skill supplies a concise reference of correct Godot 4.3+ patterns so generated or reviewed code avoids common errors. ## Core Features & Use Cases - Syntax Quick Reference: Covers typed variables, functions, signals, core callbacks, input handling, scene management, groups, timers, tweens, and file I/O. - Common Mistake Table: Maps frequent errors (e.g., move_and_slide(velocity), rand_range(), old-style connect) to their correct Godot 4 equivalents. - Reusable Patterns: Includes singleton/autoload, state machine, and component patterns ready to adapt. - Use Case: When asking an AI to write a player controller or debug a signal connection error, this Skill ensures the output uses @onready, signal.emit(), and load() instead of outdated or fragile constructs. ## Quick Start Ask the AI to write a Godot 4 GDScript player movement script with a health component and signal-based damage handling.

Frequently Asked Questions about godot-gdscript

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

FAQPage Schema
How do I connect signals in Godot 4 GDScript?

In Godot 4, use the callable syntax: `button.pressed.connect(_on_pressed)` or `signal_name.connect(func(v): ...)`. The old Godot 3 style `connect("signal", obj, "method")` is deprecated and should be replaced.

How do I write a state machine in GDScript?

Define an enum for states, store the current state in a variable, and use a `match` statement inside `_physics_process` to dispatch to per-state handler functions. Add a `change_state` guard to avoid redundant transitions.

Why does move_and_slide not work with arguments in Godot 4?

In Godot 4, `move_and_slide()` takes no arguments. Assign the built-in `velocity` property first, then call `move_and_slide()` with no parameters.

Should I use preload or load for scenes in generated GDScript code?

Use `load()` for runtime-instantiated scenes, especially in generated code, because `preload()` fails at parse time if the file does not exist yet. `load()` resolves the resource at call time.

Why is my node reference null when using $NodeName?

`$NodeName` returns null if accessed before the node enters the tree and `_ready()` runs. Use `@onready var label = $UI/Label` or resolve the node inside `_ready()` to guarantee it exists.