godot-gdscript-patterns
Skill8 starsChanged 5 months agoMITView on GitHub
GDScript best practices for Godot 4.x: node composition, typed signals, scene instantiation, resource management, singletons, event buses, and common design patterns. Use when writing or reviewing GDScript code in Godot.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- xfstudio/skillstheir own version, first seen Oct 13, 2026
- Samueladewole/claude-skillstheir own version, first seen Oct 13, 2026
- jwd83/skillstheir own version, first seen Jun 18, 2026
- ai4brands-design/claude-skillstheir own version, first seen Mar 22, 2026
- CodeWithBehnam/cc-docstheir own version, first seen Mar 15, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- xfstudio/skills★ 9same name
- ai4brands-design/claude-skills★ 2same name
- CodeWithBehnam/cc-docs★ 2same name
- jwd83/skills★ 1same name
- Samueladewole/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- godot-47-migrationSkill
- godot-animationSkill
- godot-architectureSkill
- godot-audioSkill
- godot-brainstormingSkill
- godot-code-reviewSkill
- godot-csharp-patternsSkill
- godot-debuggingSkill
- godot-dialog-systemsSkill
- godot-headless-workflowSkill
- godot-i18nSkill
- godot-inputSkill
- godot-inventory-economySkill
- godot-networkingSkill
- godot-performanceSkill
- godot-physicsSkill
- godot-project-setupSkill
- godot-save-systemsSkill
- godot-shaders-vfxSkill
- godot-state-managementSkill
- godot-uiSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 168
When the MCP bridge is running (Phase 2), these tools can inspect and modify your project live:
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GDScript Patterns for Godot 4.x
Best practices and patterns for writing clean, maintainable GDScript code.
Node Hierarchy Best Practices
Composition Over Inheritance
# Good: Small, focused scenes composed together
# Player.tscn contains:
# - CharacterBody2D (root)
# - Sprite2D (visual)
# - CollisionShape2D (physics)
# - AnimatedSprite2D (animation)
# - HealthComponent (Node — logic)
# - InventoryComponent (Node — logic)
# Avoid: Deep inheritance chains
# Player extends CharacterBody2D extends Node2D...Scene Instantiation Patterns
# preload() — Compile-time, for always-needed resources
@onready var bullet_scene = preload("res://scenes/entities/bullet.tscn")
# load() — Runtime, for conditional loading
var dialog_scene = load("res://scenes/ui/dialog.tscn")
# instantiate() — Create instance from scene
func spawn_bullet():
var bullet = bullet_scene.instantiate()
add_child(bullet)Typed Signals (Godot 4.x)
Declaring Typed Signals
# Godot 4.x typed signal syntax
signal health_changed(new_health: int, max_health: int)
signal player_died(position: Vector2)
signal item_collected(item_data: Resource)Connecting Signals
# Auto-connect in editor (rename method to on_NodeName_signal)
func _on_health_changed(new_health: int, _max_health: int):
update_health_bar(new_health)
# Manual connection
func _ready():
enemy.health_depleted.connect(_on_enemy_defeated)
# Callable syntax (Godot 4.x)
button.pressed.connect(func: do_something())Scene Loading Patterns
Resource Loading
# Preload for compile-time constants
const PlayerScene = preload("res://scenes/entities/player.tscn")
# Load for runtime/conditional loading
func load_level(level_name: String):
var path = "res://levels/%s.tscn" % level_name
var scene = load(path)
if scene:
current_level = scene.instantiate()
add_child(current_level)Resource Management
# Use Resource for game data
@export_file("*.tres") var player_data: String
var data: PlayerData = load(player_data) as PlayerData
# Scene packs for level data
var level_pack = preload("res://resources/data/level_pack.tscn")Common Patterns
Singleton (Autoload) Pattern
# Add to Project Settings > Autoload as "GameData"
class_name GameData extends Node
var player_score: int = 0
var high_score: int = 0
func add_score(points: int):
player_score += points
if player_score > high_score:
high_score = player_scoreEvent Bus Pattern
# Add to Project Settings > Autoload as "EventBus"
class_name EventBus extends Node
signal game_started()
signal level_completed(level_id: int)
signal player_died()
signal game_paused(paused: bool)
# Usage in any script
func _ready():
EventBus.level_completed.connect(on_level_completed)Node Path Best Practices
# Good: Use @onready for scene tree paths
@onready var health_bar = $UI/HealthBar as ProgressBar
@onready var sprite = $Sprite2D as Sprite2D
# Avoid: Hardcoded paths
var health_bar = get_node("UI/HealthBar") # Fragile to hierarchy changesGodot 4.7 GDScript Notes
- DrawableTexture2D — Create dynamic textures at runtime for procedural rendering
- tween_await() — Use await with tweens for sequential animations
- Typed signals are now the standard — prefer typed over untyped
MCP Bridge Tools (Optional — Live Editor Integration)
When the MCP bridge is running (Phase 2), these tools can inspect and modify your project live:
script_read— Read any script file from the projectscript_edit— Write updated script contents directly to diskscript_validate— Validate GDScript syntax withsuggestTweenAwait: truefor Godot 4.7 migrationscene_tree— Inspect the current scene hierarchyclass_db_info— Query available methods/properties on any Godot class
Note: MCP tools require the Godot editor to be running with the MCP plugin enabled. Skills work independently without the bridge.
References
- GDScript Style Guide
- Signal Patterns Deep Dive
- Resource Management
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

