- Home
- Skills
- Game Development
- Godot 4 GDScript Patterns
More screenshots
Works with the AI Agents you already use
Godot 4 GDScript Patterns
Build Godot 4 games on the scene tree instead of against it: signals up, calls down, data in resources, legible state machines — plus a scored pattern audit for reviewing existing code.
$5
Godot 4 GDScript Patterns
Example session with this skill installed
My Godot 4 2D platformer is getting messy. I have about 40 enemies, and every one of them checks the player's distance in _process. Damage code is copy-pasted across six enemy scripts, and adding a flying enemy last week meant editing almost everything. How do I restructure this using your patterns?
- Read your context and instructions
- Compiled the godot 4 gdscript
Diagnosis first, by pattern. Three violations are doing the damage: (1) communication direction — 40 enemies polling the player in _process is sideways access at frame cost; (2) data placement — damage and health values live inside six scripts, so every balance change is six edits; (3) composition — enemies are six scripts instead of one scene composed from parts, which is why a new enemy type touches everything.
The restructure, in dependency order:
-
Extract a
Healthchild scene. It ownsmax_health,take_damage(amount), and a typedsignal died. It knows nothing about enemies. All six scripts delete their pasted damage code and instance this instead. -
Replace polling with detection areas. Each enemy gets an
Area2Ddetection zone;body_entered/body_exiteddrive its state. Idle enemies cost zero per frame, and physics-adjacent checks move to_physics_processwhere they belong. -
Give enemies one state machine each: PATROL / CHASE / ATTACK (plus HURT via
take_hit), a single_change_state, enter logic inside it. The flying enemy is not a new architecture — it is the same machine with a different movement function inside CHASE. -
Move tuning into an
EnemyStatsresource: max_health, contact_damage, move_speed, score_value. Walker, flyer, and brute become three.tresfiles on one composed scene. The flying enemy that cost a week of edits becomes an afternoon: one scene variant, one resource, one movement function.
Score the result against the audit rubric before calling it done: communication direction 2, composition 2, data placement 2, state legibility 2, frame discipline 2 (polling gone, refs cached), save hygiene untouched at 1 until enemies join the "persist" group. 11/12 — ship it.
Connects securely to your tools. The creator never sees your data.
About this skill
Most bad GDScript comes from fighting the engine: deep class hierarchies where a scene would do, singletons where a signal would do, physics running in the wrong callback. This skill is the pattern set that falls out of trusting the scene tree, for Godot 4.x GDScript.
It starts with the communication rules everything else depends on — a direction table (signals up the tree, direct calls and exports down, autoloads sparingly across), a signal-contract template to write before implementing any component, and a complete typed-signal example. Then state machines as one legible pattern: a full guard enemy with patrol, chase, attack, and stunned states, one _change_state entry point, enter logic centralized, timers owned by the state, and a clear decision point for when a state machine has outgrown one script.
Composition over inheritance is covered concretely: small contract-bearing child scenes (Health, Hitbox, Interactable) instanced into parents, a scene-build checklist, and resource-driven data — an EnemyStats resource pattern so variants and difficulty tiers become data files instead of branches. Performance habits are ranked by measured impact: no allocations in frame callbacks, physics in _physics_process, groups and signals over polling, disabling idle processing, queue_free discipline. Save/load follows the same philosophy: serialize plain data, reconstruct nodes, with a complete ConfigFile-based save system.
Reviews get a scored pattern-audit rubric (ship at 10 of 12, fix any zero), and an edge-case section states plainly where the patterns stop: Godot 3.x, multiplayer authority, streamed worlds, and editor tooling.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Game Development.
Godot 4.x GDScript only: signal syntax, annotations, and emit calls differ in 3.x, and the skill says to stop rather than mix idioms. Multiplayer authority and replication are out of scope — the patterns assume one local scene tree. The code patterns are architecture guidance, not a full game template; art, audio, and level design are separate concerns.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 24 days ago
Permissions
No special permissions declared or detected