godot-composition
Installation
SKILL.md
Godot Composition Architecture
Core Philosophy
This skill enforces Composition over Inheritance ("Has-a" vs "Is-a"). In Godot, Nodes are components. A complex entity (Player) is simply an Orchestrator managing specialized Worker Nodes (Components).
The Golden Rules
- Single Responsibility: One script = One job.
- Encapsulation: Components are "selfish." They handle their internal logic but don't know who owns them.
- The Orchestrator: The root script (e.g.,
player.gd) does no logic. It only manages state and passes data between components. - Decoupling: Components communicate via Signals (up) and Methods (down).
Anti-Patterns (NEVER Do This)
- NEVER use deep inheritance chains (e.g.,
Player > Entity > LivingThing > Node). This creates brittle "God Classes." - NEVER use
get_node("Path/To/Thing")or$syntax for components. This breaks if the scene tree changes. - NEVER let components reference the Parent directly (unless absolutely necessary via typed injection).
- NEVER mix Input, Physics, and Game Logic in a single script.