Skills · Coding

Godot Gdscript Patterns

Unverified30/40

Master Godot 4 GDScript patterns including signals, scenes, state machines, and optimization. Use when building Godot games, implementing game systems, or learning GDScript best practices.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
CursorPartialPlain prose you can paste in — but no Cursor rules file
CodexPartialPlain prose you can paste in — but no AGENTS.md
Gemini CLIPartialPlain prose you can paste in
CopilotPartialPlain prose you can paste in — but no Copilot instructions file
npx agentalley add godot-gdscript-patterns

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

Master Godot 4 GDScript patterns including signals, scenes, state machines, and optimization. Use when building Godot games, implementing game systems, or learning GDScript best practices.

The whole source

No sign-in, no blur, nothing truncated
godot-gdscript-patterns/SKILL.md79 lines2.1 KBRawView on GitHub
Frontmatter — 2 properties
namegodot-gdscript-patterns
descriptionMaster Godot 4 GDScript patterns including signals, scenes, state machines, and optimization. Use when building Godot games, implementing game systems, or learning GDScript best practices.
1---
2name: godot-gdscript-patterns
3description: Master Godot 4 GDScript patterns including signals, scenes, state machines, and optimization. Use when building Godot games, implementing game systems, or learning GDScript best practices.
4---A5No allowed-tools declared — no way to tell what this skill may touch
5 
6# Godot GDScript Patterns
7 
8Production patterns for Godot 4.x game development with GDScript, covering architecture, signals, scenes, and optimization.
9 
10## When to Use This Skill
11 
12- Building games with Godot 4
13- Implementing game systems in GDScript
14- Designing scene architecture
15- Managing game state
16- Optimizing GDScript performance
17- Learning Godot best practices
18 
19## Core Concepts
20 
21### 1. Godot Architecture
22 
23```
24Node: Base building block
25├── Scene: Reusable node tree (saved as .tscn)
26├── Resource: Data container (saved as .tres)
27├── Signal: Event communication
28└── Group: Node categorization
29```
30 
31### 2. GDScript Basics
32 
33```gdscript
34class_name Player
35extends CharacterBody2D
36 
37# Signals
38signal health_changed(new_health: int)
39signal died
40 
41# Exports (Inspector-editable)
42@export var speed: float = 200.0
43@export var max_health: int = 100
44@export_range(0, 1) var damage_reduction: float = 0.0
45@export_group("Combat")
46@export var attack_damage: int = 10
47@export var attack_cooldown: float = 0.5
48 
49# Onready (initialized when ready)
50@onready var sprite: Sprite2D = $Sprite2D
51@onready var animation: AnimationPlayer = $AnimationPlayer
52@onready var hitbox: Area2D = $Hitbox
53 
54# Private variables (convention: underscore prefix)
55var _health: int
56var _can_attack: bool = true
57 
58func _ready() -> void:
59 _health = max_health
60 
61func _physics_process(delta: float) -> void:
62 var direction := Input.get_vector("left", "right", "up", "down")
63 velocity = direction * speed
64 move_and_slide()
65 
66func take_damage(amount: int) -> void:
67 var actual_damage := int(amount * (1.0 - damage_reduction))
68 _health = max(_health - actual_damage, 0)
69 health_changed.emit(_health)
70 
71 if _health <= 0:
72 died.emit()
73```
74 
75## Detailed patterns and worked examples
76 
77Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
78 
79 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Coding