godot-composition

Applies composition-over-inheritance conventions to structure Godot entities with component nodes and signals.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/arthur0n/xenodot-twin --skill godot-composition-arthur0n
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: godot-composition
Source: https://github.com/arthur0n/xenodot-twin/tree/main/plugin/skills/godot-composition
Command: npx skills add https://github.com/arthur0n/xenodot-twin --skill godot-composition-arthur0n

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Godot projects often decay into god scripts, deep inheritance trees, and hidden coupling through autoloads or parent lookups, making entities hard to refactor and reuse. This Skill enforces a consistent component-based architecture so entities stay modular and behavior stays decoupled. ## Core Features & Use Cases - Composition rules: Defines seven conventions translating SOLID to Godot — component nodes over inheritance, one script per job, signals up / calls down, scenes as the composition unit, dependency injection via @export, duck typing, and @export data variants instead of subclasses. - Signal hygiene: Prescribes guarded connect/disconnect, past-tense event naming, typed payloads, and fire-and-forget emission without a global event-bus autoload. - Refactor protocol: Provides a mechanical extraction workflow gated by verification runs, with explicit criteria for when to modularize and when not to. - Use Case: When a player script grows to handle input, movement, and combat, apply this Skill to split it into Health, Hitbox, and MoveInput component scenes wired by signals and exports. ## Quick Start Review my Godot entity script and refactor it into component nodes following the composition conventions, keeping behavior unchanged.

Frequently Asked Questions about godot-composition

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Godot entity with multiple behaviors?▼

Build the entity as a base engine node like CharacterBody3D plus component child nodes such as Health, Hitbox, and MoveInput, each with one script doing one job. Parents call methods on children, and children report upward only through signals.

How should components communicate in Godot without tight coupling?▼

Use signals up and calls down: parents call child methods directly, while children emit past-tense signals like health_changed with typed payloads. Components never call get_parent(), use absolute paths, or assume their parent's type.

When should I extract a reusable component in Godot?▼

Extract only when a second consumer exists in the current scope, a script demonstrably does two jobs, or a design doc names the mechanic as reusable. Reusable behavior with state becomes a component scene; stateless functions become static utilities.

Should I use an autoload as a global signal bus in Godot?▼

No. Routing every signal through a shared autoload re-creates hidden coupling. Inject the emitter via @export and connect directly, or reach it through a duck-typed seam, keeping the composition decoupled.

When is subclassing wrong for Godot entity variants?▼

Subclassing is wrong when variants differ only in data such as a color, speed, or scene. Use one script with an @export property set per-scene instead of creating stub subclasses that only change a constant.