Skip to main content
rule CX Codex official · GitHub

godot-4-gdscript — GitHub Copilot rule for Godot 4

The godot-4-gdscript GitHub Copilot rule keeps GDScript in Godot 4 syntax. It applies to .gd files and steers edits away from Godot 3 constructs.

MIT ★ 41,430 updated 2026-10-23

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/instructions/godot-4-gdscript.instructions.md
Open on GitHub

What godot-4-gdscript does

The rule guides the agent to use GDScript 2.0 instead of older Godot 3 syntax. It replaces patterns such as yield with await, setget with set and get blocks, and old remote-call keywords with @rpc annotations.

It also calls for typed variables and signals, Signal-object connections, and explicit super() calls in overridden lifecycle methods. Its **/*.gd pattern targets GDScript files only.

What it helps with

  • replace yield with await in a Godot 4 script
  • rewrite setget properties with set and get blocks
  • connect a typed signal through a Signal object
  • remove Godot 3 syntax from .gd files

Example prompts for the agent

  • Rewrite this script in Godot 4 syntax and remove Godot 3 constructs.
  • Connect button.pressed to its handler using the Godot 4 signal API.
  • Check this .gd file for outdated yield and setget syntax.

How to install godot-4-gdscript

Manually: put the files in place

.github/instructions/godot-4-gdscript.instructions.md

The applyTo field sets which files it applies to

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about godot-4-gdscript

How do I install godot-4-gdscript in GitHub Copilot?

Add the rule file at .github/instructions/godot-4-gdscript.instructions.md.

What does godot-4-gdscript do?

It guides the agent toward GDScript 2.0, including Godot 4 annotations, await, typed signals, and Callable in place of older syntax.

Which files does godot-4-gdscript apply to?

The rule targets files matching **/*.gd.

Source text

godot-4-gdscript.instructions.md · MIT
---
description: "Prevent Godot 3 syntax in Godot 4 projects: GDScript 2.0 annotations, await, setters, @rpc, typed signals and Callables"
applyTo: "**/*.gd"
---

# Godot 4 GDScript 2.0 (no Godot 3 syntax)

## GDScript 2.0 syntax (never Godot 3)
| Godot 3 (wrong) | Godot 4 (use) |
|---|---|
| `export var speed = 5` / `export(int) var` | `@export var speed: float = 5.0` (`@export_range`, `@export_enum`, `@export_group`) |
| `onready var x = $X` | `@onready var x: Node2D = $X` |
| `tool` | `@tool` (first line) |
| `yield(get_tree().create_timer(1), "timeout")` | `await get_tree().create_timer(1.0).timeout` |
| `yield(obj, "signal")` | `await obj.signal_name` |
| `var x setget set_x, get_x` | `var x: int:` with `set(value):` / `get:` blocks |
| `puppet` funcs | `@rpc` (authority-only; Godot 4 default) |
| `remote` funcs | `@rpc("any_peer")` |
| `remotesync` funcs | `@rpc("any_peer", "call_local")` |
| `puppetsync` funcs | `@rpc("call_local")` |
| `master` funcs | no direct map; use `@rpc("any_peer")` + `multiplayer.get_remote_sender_id()` check |
| `funcref(obj, "m")` | `Callable(obj, "m")` or just `obj.m` |
| `PoolStringArray`, `PoolVector2Array` | `PackedStringArray`, `PackedVector2Array` |
- Use static typing everywhere: `var hp: int = 100`, `func hit(dmg: int) -> void:`. Use `:=` for inferred types.
- Lifecycle overrides (`_ready`, `_process`) no longer call the parent automatically; call `super()` when extending a scripted class.
- Use `StringName` literals `&"action"` for input actions/groups and `^"path"` NodePaths where it helps.

## Signals & Callables
- Declare typed signals: `signal health_changed(new_value: int)`.
- Connect with the Signal object: `button.pressed.connect(_on_button_pressed)`. Never use the Godot 3 form `connect("pressed", self, "_on_button_pressed")`.
- Bind extra args with `.bind()`: `enemy.died.connect(_on_enemy_died.bind(enemy))`. Flags: `connect(callable, CONNECT_ONE_SHOT)`.
- Emit with `health_changed.emit(hp)` rather than `emit_signal("health_changed", hp)`.
- Disconnect with `sig.disconnect(callable)`; check `sig.is_connected(callable)` first.
- Use lambdas for small handlers: `timer.timeout.connect(func(): queue_free())`.
- Prefer signals ("call down, signal up") over `get_parent().get_parent()` chains.

© github · MIT · github/awesome-copilot

Similar IDE rules

All IDE rules for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set993

The whole set →
caption-qa caption-qa — a skill for GitHub Copilot and other AI platforms that validates .srt and .vtt files against Netflix, BBC, and DCMP standards. It fixes timing and formatting issues while preserving the original dialogue. CX Codex +1 ★ 41,430repo stars azure-logic-apps-standard-cli The azure-logic-apps-standard-cli GitHub Copilot skill manages Azure Logic Apps Standard projects through the Azure CLI extension. It covers workflow authoring, validation, testing, and deployment preparation. CX Codex +1 ★ 41,430repo stars adobe-illustrator-integrations The adobe-illustrator-integrations skill supports building and debugging Adobe Illustrator extensions, plugins, and MCP servers. It streamlines project automation via scripts and external control tools. CX Codex +1 ★ 41,430repo stars sql-server-safe-tsql The sql-server-safe-tsql GitHub Copilot rule sets safeguards for SQL Server scripts. It applies to *.sql and *.ps1 files while writing or reviewing T-SQL. CX Codex +1 ★ 41,430repo stars bulma-v1 This rule for GitHub Copilot guides Bulma v1 code in HTML, CSS, and UI components. It applies conventions for markup and styling when the agent edits or reviews matching files. CX Codex +1 ★ 41,430repo stars SAP Integration Suite Copilot SAP Integration Suite Copilot — a subagent for GitHub Copilot designs, reviews, and troubleshoots SAP BTP Integration Suite artifacts. Activates when working on CPI iFlows, Groovy scripts, and MPL runtime errors. CX Codex +1 ★ 41,430repo stars OpenAPI to Application Generator (Spring Boot) OpenAPI to Application Generator (Spring Boot) is a GitHub Copilot subagent that builds Spring Boot applications from OpenAPI specs, preserving contract schemas and error codes. CX Codex +1 ★ 41,430repo stars On-Device Worker On-Device Worker is a subagent for GitHub Copilot powered by the local MAI Code 1.1 Flash model. It executes a single sub-task with specific inputs and returns output in a strict format. CX Codex +1 ★ 41,430repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open