All skills
thedivergentai avatar

/godot-signal-architecture

@9d6e91e

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, CONNECT_REFERENCE_COUNTED, event bus, AutoLoad, decoupling.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-signal-architecture

This session only. Nothing lands on disk.

referencesimplementation-patterns.md

≈490 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Signal implementation patterns

Pattern 1: Typed signals

signal health_changed(new_health: int, max_health: int)
signal died()

Pattern 2: Emit on setter

var health: int = 100:
    set(value):
        health = clamp(value, 0, max_health)
        health_changed.emit(health, max_health)
        if health <= 0:
            died.emit()

Pattern 3: Parent connects child

func _ready() -> void:
    player.health_changed.connect(_on_player_health_changed)
    player.died.connect(_on_player_died)

func _on_player_health_changed(current: int, maximum: int) -> void:
    ui.update_health_bar(current, maximum)

Pattern 4: AutoLoad bus

# events.gd (AutoLoad)
signal level_completed(level_number: int)

Pattern 5: Signal chains

Enemy died → combat manager → score bus. Prefer typed payloads.

Pattern 6: CONNECT_ONE_SHOT

timer.timeout.connect(_on_timer_timeout, CONNECT_ONE_SHOT)

Pattern 7: Custom signal arguments (Dictionary payloads)

Use typed fields when possible; Dictionary only for prototype loot tables.

Best practices

  • Descriptive names: enemy_defeated(enemy_type: String) not done().
  • Mediator breaks A↔B circular graphs.
  • Group related signals (combat / movement / inventory).

Testing (GdUnit4)

Use signal monitors from peer skill godot-testing-patterns / signal_emission_test.gd — not GUT watch_signals.

Gotchas

Issue Fix
Silent no-op Typo in connect; verify emit path runs
Double fire Duplicate connect; use is_connected or ONE_SHOT
Null instance Disconnect in _exit_tree; capturing lambdas need manual disconnect

[!CAUTION] CONNECT_REFERENCE_COUNTED stacks identical connects — it does not auto-clean capturing lambdas.

Source: SKILL.md on GitHub

No alerts16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides blueprint patterns and scripts for implementing signal-driven architecture in Godot Engine. No security issues or malicious patterns were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    4 files scanned · No issues

Signed by skilld at 9d6e91e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago

README badge

README badge for thedivergentai/gd-agentic-skills/godot-signal-architecture