godotnodesscenes

godotnodesscenes: Dedicated to Godot engine node and scene tasks, helping AI agents efficiently complete work related to node and scene structure, configuration, or organization.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "godotnodesscenes" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-6711cdce8b4cffc40551fd7bc62a75c0dd411273cac03e280b0f710c32c6a5a4. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/godot-nodes-scenes-kzo0 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

godotnodesscenes: Dedicated to Godot engine node and scene tasks, helping AI agents efficiently complete work related to node and scene structure, configuration, or organization.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
Compose games from nodes and scenes, instance them at runtime, and access the tree without crashing on freed or missing nodes. Targets **Godot 4.3+**.
Audience
Use when structuring `.tscn` scenes, choosing how to break a feature into nodes, instancing a `PackedScene` (bullets, enemies, UI), or setting up autoload singletons. Use when debugging `get_node()` / `$Path` returning `null`, or "Attempt to call on a previously freed instance". When _not_ to use:** GDScript language/syntax → `godot-gdscript`; signal-based decoupling → `godot-signals-groups`; physics bodies/collisions → `godot-physics`.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: Godotnodesscenes
slug: godot-nodes-scenes
version: 1.0.0
displayName: Godotnodesscenes
description: >
  GodotNodesScenes专用技能,帮助AI Agent高效完成相关任务。
summary: "GodotNodesScenes专用技能,帮助AI Agent高效完成相关任务。"
license: Apache-2.0
category: 游戏开发
framework:
  - Claude Code
  - Codex
  - Hermes Agent
  - OpenClaw
  - QClaw
  - WorkBuddy
platform: multi-platform
homepage: https://github.com/1991513ccie-png
repository: https://github.com/1991513ccie-png

Godot Nodes & Scenes (4.x)

Compose games from nodes and scenes, instance them at runtime, and access the tree without crashing on freed or missing nodes. Targets Godot 4.3+.

When to use

  • Use when structuring .tscn scenes, choosing how to break a feature into nodes, instancing a PackedScene (bullets, enemies, UI), or setting up autoload singletons.
  • Use when debugging get_node() / $Path returning null, or "Attempt to call on a previously freed instance".

When not to use: GDScript language/syntax → godot-gdscript; signal-based decoupling → godot-signals-groups; physics bodies/collisions → godot-physics.

Core workflow

  1. Model with composition. A scene is a tree of nodes saved as .tscn. Build small, single-purpose scenes (Player, Bullet, Enemy) and compose larger scenes from them. Favor adding child nodes over deep inheritance.
  2. Make a scene reusable by giving its root a script and exposing @export config. Save it; it becomes a PackedScene you can instance many times.
  3. Instance at runtime with preload/load → scene.instantiate() → add_child(instance). Set position/state after adding (or before, both work).
  4. Access nodes safely. Use @onready var x = $Path for fixed children; use unique names (%Name) for nodes deep in the tree; never assume a node still exists.
  5. Use autoloads for global state/services (game state, audio, scene switching) — registered in Project Settings > Globals (Autoload), accessible by name everywhere.
  6. Free nodes with queue_free() and guard later access with is_instance_valid().

Patterns

1. Instance a scene at runtime

extends Node2D

const BULLET := preload("res://bullet.tscn")   # preload: loaded at compile time

func shoot(at: Vector2, dir: Vector2) -> void:
    var bullet := BULLET.instantiate()         # create an instance of the scene
    bullet.global_position = at
    bullet.direction = dir                      # set exported/public state
    add_child(bullet)                           # now it's in the tree and runs

2. Safe node access: $, get_node_or_null, and unique names

@onready var label: Label = $UI/Label            # $ is sugar for get_node("UI/Label")
@onready var health_bar: ProgressBar = %HealthBar # % = scene-unique name (rename-proof)

func update() -> void:
    var optional := get_node_or_null("Maybe/Missing")  # returns null instead of erroring
    if optional:
        optional.queue_free()

3. An autoload singleton (global game state)

# game_state.gd — add in Project Settings > Globals > Autoload as "GameState".
extends Node

var score := 0
signal score_changed(value: int)

func add_score(points: int) -> void:
    score += points
    score_changed.emit(score)         # any scene can: GameState.score_changed.connect(...)

4. Change the running scene

func go_to_level_2() -> void:
    # Swaps the current scene for another. Frees the old scene tree.
    get_tree().change_scene_to_file("res://levels/level_2.tscn")
    # Or, with a preloaded PackedScene:
    # get_tree().change_scene_to_packed(LEVEL_2)

Pitfalls

  • $Path / get_node() return null or error when the path is wrong or the node isn't in the tree yet. Use @onready, verify the path matches the scene, or use get_node_or_null() for optional nodes.
  • Renaming a node breaks $Path. Use unique names (%Name, set via right-click

    Access as Unique Name) so deep references survive renames and reparenting.

  • free() mid-frame can crash other code still using the node. Prefer queue_free() (deletes at end of frame) and check is_instance_valid(node).
  • Setting child state before add_child() is fine, but _ready() on the child only runs after it enters the tree — don't expect its @onready vars before that.
  • Autoload order matters: autoloads are added before the main scene, in list order. An autoload can't depend on the main scene existing yet.
  • instance() was renamed to instantiate() in Godot 4. preload runs at parse time (path must be constant); load runs at runtime (path can be a variable).
  • change_scene_to_file() is deferred, not immediate — Godot swaps and frees the old scene at the end of the current frame. Any code after the call still runs against the old tree, and get_tree().current_scene isn't the new scene until next frame. Don't read the new scene's nodes on the same line; do it from the new scene's _ready().

References

  • For scene inheritance, owner/ownership when saving scenes from code, groups vs unique names, and node-path edge cases, read references/tree-and-instancing.md.

Related skills

  • godot-gdscript — language, lifecycle, and @onready.
  • godot-signals-groups — decouple instanced scenes from their spawner.
  • godot-resources — share data between instances without duplicating it.
  • save-systems — persist scene/game state across runs.

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 提供 Godot 节点与场景的完整工作流,解决游戏开发中的高频刚需任务
  • 涵盖场景实例化、安全节点访问、自动加载单例等核心模式,实用价值高
Trigger Precision95/100

Highlights

  • 触发词精准完整,明确界定适用与不适用场景,边界清晰
  • 覆盖 .tscn 构建、PackedScene 实例化、autoload 设置等多种变体
Structure and Standards95/100

Areas to improve

  • description 内容重复 Reported severity: Minor

    顶层 frontmatter 和 skill_body 内部均包含 description,内容一致但冗余

    Recommendation: 建议移除 skill_body 内部的 description 字段,保留顶层 frontmatter 中的定义

Highlights

  • Phase/步骤清晰(Core workflow 6步),含端到端代码示例
  • frontmatter 完整,单文件结构良好,Pitfalls 和 Related skills 增强完整性
Execution Reliability93/100

Areas to improve

  • 缺少显式 When to Use 章节标题 Reported severity: Minor

    When to use 内容存在但未作为独立加粗标题突出显示

    Recommendation: 建议将 'When to use' 设为独立章节标题(如 ## When to Use)以提升可读性

Highlights

  • 工具来源明确(Godot 4.3+ 官方 API),参数正确
  • 覆盖主要异常场景(节点不存在、重命名、释放后访问、场景切换时序),不可逆操作有确认机制
Evidence Verifiability (mean of the first four)94/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.