Skip to content
godot-add-signals logo

Replace Coupling with Signals

godot-add-signals

Use when Godot code has tight coupling via get_node(), get_parent(), or direct references creating brittle dependencies. Detects coupling patterns and transforms to signal-based communication. Components become independent, testable, and reusable. Preserves exact behavior while improving architec...

Asreonn/godot-superpowers0installs4stars

SKILL.md

Full skill instructions

Replace Coupling with Signals

Core Principle

Components communicate via signals, not direct references. Coupling makes code brittle and hard to test.

What This Skill Does

Finds patterns like:

# player.gd
func take_damage(amount):
    health -= amount
    get_node("../​UI/​HealthBar").update(health)  # TIGHT COUPLING
    get_parent().get_node("ScoreManager").reduce_score()  # FRAGILE PATH

Transforms to:

# player.gd
signal health_changed(new_health)

func take_damage(amount):
    health -= amount
    health_changed.emit(health)  # SIGNAL - NO COUPLING
# main.gd (or scene setup)
func _ready():
    player.health_changed.connect(ui.health_bar.update)
    player.health_changed.connect(score_manager.on_player_damaged)

Detection Patterns

Identifies:

  • get_node("../​path") - Upward path navigation
  • get_parent().something - Parent dependencies
  • find_child("name") - Runtime searches
  • has_method() - Tight interface coupling
  • Direct owner references creating circular dependencies

When to Use

You're Refactoring Legacy Code

Old code has spaghetti dependencies via get_node chains.

You're Building Testable Systems

Want to test components in isolation without full scene tree.

You're Creating Reusable Components

Components should work in different contexts without modification.

You're Experiencing Brittle Code

Changes to scene structure break unrelated functionality.

Process

  1. Scan - Find all get_node(), get_parent(), find_child() usage
  2. Analyze - Identify what information flows between nodes
  3. Define Signals - Create signal definitions for communication
  4. Replace - Convert direct calls to signal emissions
  5. Connect - Wire signals in appropriate orchestration points
  6. Validate - Ensure behavior preserved exactly
  7. Commit - Git commit per coupling removal

Example Transformation

Before (Tight Coupling):

# enemy.gd
extends CharacterBody2D

func die():
    var player = get_node("../​Player")  # FRAGILE PATH
    player.add_score(100)

    var audio = get_parent().get_node("AudioManager")  # TIGHT COUPLING
    audio.play_sound("enemy_death")

    queue_free()

After (Signal-Based):

# enemy.gd
extends CharacterBody2D

signal died(score_value: int)
signal death_sound_requested(sound_name: String)

func die():
    died.emit(100)
    death_sound_requested.emit("enemy_death")
    queue_free()
# main.gd (orchestrator)
func _ready():
    for enemy in enemies:
        enemy.died.connect(player.add_score)
        enemy.death_sound_requested.connect(audio_manager.play_sound)

Signal Patterns

One-to-Many

One emitter, multiple listeners (health changed → update UI + save game + achievement check).

Event Broadcasting

Announce something happened without knowing who cares.

Request-Response

Request service without knowing provider (request_ammo → whoever handles ammo).

State Change Notification

Notify when state changes (entered_water, jumped, landed).

What Gets Created

  • Signal definitions with typed parameters
  • Signal emission at appropriate points
  • Signal connections in orchestrator scripts
  • Documentation of signal purpose and parameters
  • Git commits documenting each decoupling

Smart Analysis

Identifies coupling types:

  • Structural coupling - Depends on scene tree structure
  • Interface coupling - Calls specific methods on other nodes
  • Data coupling - Accesses data from other nodes

Chooses appropriate solution:

  • Signals for events and notifications
  • Dependency injection for services
  • Scene composition for reusable components

Integration

Works with:

  • godot-split-scripts - Split first, then decouple
  • godot-extract-to-scenes - Extract scenes, then add signals
  • godot-refactor (orchestrator) - Runs as part of full refactoring

Safety

  • Behavior preserved exactly
  • Signal connections tested automatically
  • Rollback on validation failure
  • Original coupling preserved in git history

When NOT to Use

Don't add signals if:

  • Parent-child relationship is intentional design
  • Component genuinely needs specific parent type
  • Coupling is within same responsibility boundary
  • Adding signals makes code more complex, not simpler

Examples of valid coupling:

  • UI button calling parent dialog's close method
  • Child node accessing parent's exported properties
  • Component accessing owner's public API

Signal Naming Conventions

Events (past tense):

  • health_changed
  • item_collected
  • enemy_died

Requests (imperative):

  • damage_requested
  • play_sound
  • spawn_particle

State Changes:

  • entered_state
  • exited_state
  • state_changed

Benefits

  • Testability - Test components without full scene tree
  • Reusability - Components work in different contexts
  • Flexibility - Add/​remove listeners without changing emitter
  • Maintainability - Changes don't break distant code
  • Clarity - Signal connections show system architecture

Common Transformations

Before (Coupled)After (Signal-Based)
get_node("../​Player").damage()damage_dealt.emit() → player listens
get_parent().update_ui()ui_update_requested.emit() → UI listens
owner.score += 10score_changed.emit(10) → owner listens
find_child("Camera").shake()screen_shake_requested.emit() → camera listens

More skills from Asreonn

godot-refactor logo
Asreonn/godot-superpowers

godot-refactor

Use when Godot project has code-created objects, tight coupling via direct references, monolithic scripts over 150 lines, or needs scene-first architecture with signals and composition. Orchestrates all 5 code quality mini-skills: extract-to-scenes, split-scripts, add-signals, extract-resources, ...

4 0
View
godot-split-scripts logo
Asreonn/godot-superpowers

godot-split-scripts

Use when Godot scripts exceed 150 lines or have multiple responsibilities. Detects scripts doing too many things (player movement + combat + inventory + UI). Automatically splits into focused scripts following Single Responsibility Principle, preserves behavior exactly, and creates git commits pe...

4 0
View
godot-convert-shaders logo
Asreonn/godot-superpowers

godot-convert-shaders

Converts Godot 3.x shader code to Godot 4.x shader syntax. Updates SCREEN_TEXTURE to screen_texture uniform, DEPTH_TEXTURE to depth_texture uniform, texture() function changes, built-in varyings updates, and light function signature changes. Essential for rendering and visual effect migrations.

4 0
View
godot-migrate-tilemap logo
Asreonn/godot-superpowers

godot-migrate-tilemap

Migrates legacy TileMap (Godot 4.0-4.2) to new TileMapLayer system (Godot 4.3+). Handles TileMap node conversion, API migration (set_cell to set_cells_terrain_connect), TileSet resource updates, physics layer mapping, navigation layer conversion, and custom data preservation. Essential for upgrad...

4 0
View
godot-setup-animationtree logo
Asreonn/godot-superpowers

godot-setup-animationtree

Use when setting up AnimationTree nodes for state machine-driven animation, creating AnimationNodeStateMachine graphs, configuring BlendSpace2D/3D for locomotion blending, implementing state transition conditions, or creating animation blend trees for complex animation mixing. Supports player cha...

4 0
View
godot-extract-resources logo
Asreonn/godot-superpowers

godot-extract-resources

Use when Godot code has hardcoded game data in const arrays, dictionaries, or embedded values. Detects inline data like enemy stats, item definitions, level configurations. Automatically extracts to .tres resource files, making data visible in editor, easily modifiable, and supports data-driven d...

4 0
View
godot-modernize-input logo
Asreonn/godot-superpowers

godot-modernize-input

Use when handling input in Godot 4.x projects and need to modernize patterns. Generates Input Map configurations from hardcoded key checks, sets up joypad rumble (Godot 4.x feature), implements gyroscope/accelerometer input on mobile, creates context-sensitive input handling for different game st...

4 0
View
godot-sync-parallax logo
Asreonn/godot-superpowers

godot-sync-parallax

Use when Godot ParallaxBackground/ParallaxLayer nodes show incorrect positions in editor due to parallax multipliers. Calculates correct editor positions based on camera start position and parallax motion scale. Makes parallax layers preview realistically in editor, matching gameplay appearance.

4 0
View
godot-generate-tests logo
Asreonn/godot-superpowers

godot-generate-tests

Use when developing Godot games and need comprehensive test coverage for GDScript classes, signals, scene initialization, and integration flows. Generates GUT framework unit tests, integration tests, mock/stub helpers, and CI/CD test runner configuration.

4 0
View
godot-setup-export logo
Asreonn/godot-superpowers

godot-setup-export

Use when setting up multi-platform exports for Godot projects, configuring export presets, icons, feature tags, build scripts, or CI/CD pipelines

4 0
View
godot-fix-positions logo
Asreonn/godot-superpowers

godot-fix-positions

Use when Godot project has position conflicts between editor (.tscn) and code (.gd), camera-following backgrounds, or runtime positions don't match editor preview. Orchestrates all 3 position sync mini-skills: sync-static-positions, sync-camera-positions, and sync-parallax. Each operation targets...

4 0
View
godot-organize-assets logo
Asreonn/godot-superpowers

godot-organize-assets

Use when Godot project has disorganized assets (sprites, audio, fonts, materials). Detects scattered asset files and organizes them into clear categories with consistent naming. Creates sprite atlases where beneficial, organizes audio by type, and groups related assets together.

4 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View