godot-4-migration – skill Khác cho agent AI
Hướng dẫn chuyên biệt để chuyển dự án Godot 3.x sang Godot 4 (GDScript 2.0), bao gồm thay đổi cú pháp, Tweens và exports.
Cài skill godot-4-migration bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/godot-4-migration-c9092.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /godot-4-migration – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/godot-4-migration-c9092.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $godot-4-migration – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/godot-4-migration-c9092.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /godot-4-migration – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/godot-4-migration-c9092.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /godot-4-migration – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Godot 4 Migration Guide
Overview
A critical guide for developers transitioning from Godot 3.x to Godot 4. This skill focuses on the major syntax changes in GDScript 2.0, the new Tween system, and export annotation updates.
When to Use This Skill
- Use when porting a Godot 3 project to Godot 4.
- Use when encountering syntax errors after upgrading.
- Use when replacing deprecated nodes (like
Tweennode vscreate_tween). - Use when updating
exportvariables to@exportannotations.
Migration procedure
Work in a backed-up branch or copy. Choose an exact Godot 4 version, validate conversion before changing files, and inspect converter gaps, renamed nodes, shaders, physics, plugins and export targets. Test scenes and saved games before replacing the working Godot 3 build. Examples below are fragments in an appropriate Node script; Enemy must be a declared project type.
Official guide: [Upgrading to Godot 4](https://docs.godotengine.org/en/stable/tutorials/migrating/upgrading_to_godot_4.html).
Key Changes
1. Annotations (@)
Godot 4 uses @ for keywords that modify behavior.
export var x->@export var xonready var y->@onready var ytool->@tool(at top of file)
2. Setters and Getters
Properties now define setters/getters inline.
Godot 3:
var health setget set_health, get_health
func set_health(value):
health = valueGodot 4:
signal health_changed(health: int)
var health: int = 100:
set(value):
health = value
emit_signal("health_changed", health)
get:
return health3. Tween System
The Godot 3 Tween node was removed in Godot 4. Use create_tween() in code.
Godot 3:
$Tween.interpolate_property(...)
$Tween.start()Godot 4:
var tween = create_tween()
tween.tween_property($Sprite, "position", Vector2(100, 100), 1.0)
tween.parallel().tween_property($Sprite, "modulate:a", 0.0, 1.0)4. Signal Connections
String-based connections are discouraged. Use callables.
Godot 3:
connect("pressed", self, "_on_pressed")Godot 4:
pressed.connect(_on_pressed)Examples
Example 1: Typed Arrays
GDScript 2.0 supports typed arrays for type checking; measure performance rather than assuming a speedup.
# Godot 3
var enemies = []
# Godot 4
var enemies: Array[Node] = []
func _ready():
for child in get_children():
if child is Enemy:
enemies.append(child)Example 2: Awaiting Signals (Coroutines)
yield is replaced by await.
Godot 3:
yield(get_tree().create_timer(1.0), "timeout")Godot 4:
await get_tree().create_timer(1.0).timeoutBest Practices
- ✅ Do: Use
@export_range,@export_file, etc., for better inspector UI. - ✅ Do: Use static types (
var x: int) for clearer contracts and type checking; measure performance in the target engine and workload. - ✅ Do: Use
super()to call parent methods instead of.function_name(). - ❌ Don't: Use string names for signals (
emit_signal("name")) if you can use the signal object (name.emit()).
Troubleshooting
Problem: "Identifier 'Tween' is not a valid type."
Solution: Godot 4 uses a Tween object returned by create_tween(), not a scene node or a SceneTreeTween type. Use var tween: Tween = create_tween() in a Node context.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Skill liên quan
- godot-gdscript-patterns – Làm chủ các mẫu GDScript của Godot 4 gồm signals, scenes, state machines và tối ưu hóa…
- gpu-server-management – Thiết lập và quản lý máy chủ GPU NVIDIA cho khối lượng công việc AI
- graceful-shutdown – Triển khai graceful shutdown cho server và worker: drain kết nối, hoàn tất công việc…
- grafana-dashboards – Tạo và quản lý dashboard Grafana sẵn sàng cho production để giám sát toàn diện hệ thống.
- hashicorp-vault – Quản lý secrets và PKI với HashiCorp Vault.
- headline-psychologist – Soạn thảo và so sánh các tiêu đề phù hợp với đối tượng, giúp nội dung liên quan và hấp…
- health-trend-analyzer – Phân tích xu hướng và mô hình của dữ liệu sức khỏe theo thời gian. Tìm mối liên hệ giữa…
- health-wellness – Sổ ghi nhận kiểm tra sức khỏe: cờ ẩn danh, phòng ban, ngày kiểm tra, điểm sức khỏe, mức…