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...

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 majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
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