Godot signal architecture

From thedivergentai/GD-Agentic-Skills · View interactive version

Godot signal architecture is an AI agent skill from the GitHub repository thedivergentai/GD-Agentic-Skills. Expert blueprint for signal-driven architecture using \"Signal Up, Call Down\" pattern for loose coupling. Covers typed signals, signal chains, one-shot connections, and AutoLoad event buses. Use when implementing event systems OR decoupling nodes. Keywords signal, emit, connect, CONNECT_ONE_SHOT, C

How to use this skill

Skill file

NEVER Do in Signal Architecture


Signal Up / Call Down

Use signals for: UI presses, death → game over, loot → inventory, cross-scene bus events.

Use direct calls for: parent commanding child, local property access.

Decision Tree: Where to Connect

| Scope | Pattern | MANDATORY script |

|-------|---------|------------------|

| Child notifies parent / UI | Local signal.connect in parent _ready | signal_up_call_down_pattern.gd |

| Parent orchestrates children | Method calls down (not signals) | same |

| Cross-scene / systems (achievements, save) | Autoload bus | global_signal_bus_router.gd / global_event_bus.gd |

| Linear async steps (load → fade → spawn) | await signal sequence | await_signal_sequencing.gd / complex_signal_sequencer.gd |

| Retarget tracking (new enemy) | Disconnect old first | disconnect_ghost_signals.gd |

| One-shot / physics-safe | CONNECT_ONE_SHOT / CONNECT_DEFERRED | one_shot_deferred_connections.gd |

| Extra context / drop args | Callable.bind / unbind | callable_bind_context.gd / unbind_unwanted_args.gd |

Available Scripts

Lambda Capture Cleanup (complete)

Godot auto-disconnects most connections when a node frees. Exception: lambdas that capture locals — you must disconnect manually.

var my_lambda: Callable

func _ready() -> void:
    var x := 10
    my_lambda = func(): print(x)
    player.died.connect(my_lambda)

func _exit_tree() -> void:
    if player and player.died.is_connected(my_lambda):
        player.died.disconnect(my_lambda)

Prefer named methods or disconnect_ghost_signals.gd when retargeting.

CONNECT_REFERENCE_COUNTED — Correct Semantics

CONNECT_REFERENCE_COUNTED means multiple identical connects share one connection with a refcount (connect N times / disconnect N times). It is not "auto-cleanup when the emitter frees" and does not fix capturing-lambda leaks.

Deep recipes (on demand)

LLM-ignorance rule: if a general agent would not know it before reading, it lives here or in scripts/ — never delete, only move.

| Topic | Reference |

|-------|-----------|

| Patterns 1–7 + gotchas | implementation-patterns.md |

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.