1---2name: godot3description: Use for Godot Engine 3/4 games and interactive apps — GDScript, C#, scene composition, signals, export pipeline, performance. Triggers — .gd/.tscn/project.godot files, scene tree, 'gdscript'.4---56# Godot Engine Development78## When to use9- Writing or reviewing GDScript or C# game scripts10- Designing scene trees, node hierarchies, and resource types11- Implementing signals, groups, and the Godot event model12- Profiling and fixing draw-call, physics, or script bottlenecks13- Configuring export templates and platform-specific settings14- Integrating GDExtension (native C/C++) plugins1516## Workflow17181. **Confirm Godot version** — Godot 3 (GDScript 1, `KinematicBody`) vs Godot 4 (GDScript 2, `CharacterBody3D`, Vulkan, `@tool` decorators, typed arrays). API differs substantially.192. **Model the scene tree first** — sketch the node hierarchy on paper or in comments before scripting. Child nodes should not call methods on parents; use signals upward.203. **Choose the right node base**:21 - Static world geometry → `StaticBody3D` + `MeshInstance3D`.22 - Player / NPC → `CharacterBody3D` (Godot 4) or `KinematicBody` (Godot 3) with `move_and_slide`.23 - UI → `Control` nodes inside a `CanvasLayer`.24 - Data-only shared state → `Resource` subclass (saved as `.tres`).254. **Script the node** — attach a script; use `class_name` for autocompletion and type hints. Type all variables: `var speed: float = 5.0`.265. **Emit signals upward, call methods downward** — parent can call `$Child.do_thing()`; child must emit a signal that parent connects to. Never `get_parent().something()` in child scripts.276. **Use `_ready`, `_process`, `_physics_process` correctly**:28 - `_ready`: one-time init after node enters the scene tree.29 - `_physics_process(delta)`: physics-safe movement; use `move_and_slide` here.30 - `_process(delta)`: per-frame logic (input, animation state).317. **Test in-editor** with the debugger and Profiler panel open. Check Monitor → Physics/Process for budget.328. **Optimize**:33 - Reduce draw calls: use `MultiMeshInstance3D` for repeated objects.34 - Disable `_process` when node is off-screen via `set_process(false)`.35 - Pool nodes with `Queue` autoload instead of `queue_free` + `instantiate` every frame.369. **Export**: Project → Export → add template for each platform. Set VRAM compression, PCK embed, and verify export template version matches editor version.3710. **Audit** using .claude/checklists/performance.md and .claude/checklists/qa.md.3839## Standards4041### GDScript (Godot 4)42- Use static typing everywhere: `func move(direction: Vector2) -> void:`.43- Prefer `@export var speed: float = 5.0` over bare `var` for designer-editable fields.44- Use `@onready var _label: Label = $UI/Label` (GD4) instead of `onready` (GD3).45- Group related signals at the top of the file with `signal health_changed(new_health: int)`.46- Keep `_process` bodies under 0.5 ms; offload heavy computation to `Thread` or `WorkerThreadPool`.4748### C# (GodotSharp)49- Use `[Export]` attribute for inspector properties.50- Connect signals via `SignalName` constants (`EmitSignal(SignalName.HealthChanged, newHealth)`).51- Dispose `Timer`, `Tween`, and `AudioStreamPlayer` nodes explicitly or let the scene tree own them.52- Async/await: use `ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame)` for Godot-aware awaiting.5354### Scene and resource hygiene55- One scene per logical game object; nest prefab-like scenes with inherited scenes for variants.56- Store shared data as `Resource` files (`.tres`) not as singleton state.57- Autoloads (singletons) only for truly global services: `GameState`, `AudioBus`, `SaveManager`.5859### Do not60- Do not use `get_node("/root/GameState")` absolute paths — use typed autoloads or dependency injection via `@export`.61- Do not call `get_children()` every frame — cache the reference in `_ready`.62- Do not block the main thread with `File.open` / HTTP requests — use `FileAccess` async or `HTTPRequest` node.63- Do not mix GDScript 1 and GDScript 2 idioms in Godot 4 projects — they are not compatible.6465## Common mistakes to avoid6667| Mistake | Fix |68|---|---|69| Modifying nodes in `_init` before they're in the scene tree | Move to `_ready`; `_init` runs before tree entry. |70| Connecting signal to a freed node | Use `is_instance_valid(target)` check or disconnect in `_exit_tree`. |71| Using `yield` (GD3) syntax in Godot 4 | Replace with `await`. |72| Physics jitter from moving objects in `_process` | Always move physics bodies in `_physics_process`. |73| Giant monolithic `GameManager` autoload | Split into focused singletons: `SaveManager`, `SceneLoader`, `EventBus`. |74| Exporting without matching template version | Download templates from Project → Install Export Templates matching editor version. |7576## Output format7778- New script: `.gd` file with `class_name`, typed properties, signals, and lifecycle methods in order.79- Scene layout: text tree showing node types and nesting.80- Signal diagram: emitter → signal name → receiver for multi-node interactions.81- Performance fix: before/after profiler reading + one-line change description.8283## Related checklists84- .claude/checklists/performance.md85- .claude/checklists/qa.md86- .claude/checklists/accessibility.md8788## Related agents89- .claude/agents/core/orchestrator.md90- .claude/agents/engineering/devops-engineer.md