$npx -y skills add thedivergentai/GD-Agentic-Skills --skill godot-builderExpert-level toolkit for modular Godot 4.7+ CLI automation and headless build orchestration. Use when you need to: (1) Build complex scene trees or UI layouts programmatically, (2) Automate expert 3D asset pipelines (glTF -> Collision), (3) Optimize procedural geometry headlessly
| 1 | # Godot Builder Skill |
| 2 | |
| 3 | The `godot-builder` skill provides an expert-grade foundation for programmatic game development and headless automation using the Godot 4.7-stable CLI. Override paths via `GODOT_PATH` and `GODOT_CONSOLE_PATH` environment variables. |
| 4 | |
| 5 | ## Expert Automation Mindset |
| 6 | |
| 7 | - **Headless Isolation via XDG**: When running multiple concurrent Godot instances, always override `XDG_DATA_HOME` and `XDG_CONFIG_HOME` to prevent cache corruption between instances. |
| 8 | - **Cache Invalidation (Force Import)**: Programmatically delete the `.godot/imported/` directory to force the engine to re-evaluate modified global import settings. |
| 9 | - **Explicit Ownership**: Scene nodes MUST have their `owner` property set to the scene root, or they will be discarded during serialization. |
| 10 | - **Latency-Sensitive Multi-threading**: GPU interactions (textures, image data) must stay on the main thread to avoid pipeline stalls and deadlocks. |
| 11 | |
| 12 | ## Hardened Anti-Patterns (NEVER List) |
| 13 | |
| 14 | - **NEVER** save runtime-generated UIDs headlessly; `ResourceSaver.save()` does NOT serialize UIDs in headless mode. Invoke `godot -e --headless --import` as a post-process. |
| 15 | - **NEVER** use `Resource.duplicate(true)` in Godot 4.4+; use `duplicate_deep(Resource.DEEP_DUPLICATE_ALL)` to prevent procedural state-bleed. |
| 16 | - **NEVER** hardcode `.tscn` or `.tres` extensions; always load via `uid://` or without extensions to avoid failures in exported binary builds. |
| 17 | - **NEVER** execute GPU-bound calls on secondary threads. Use `RenderingServer.call_on_render_thread()`. |
| 18 | - **NEVER** enable the Shader Baker for Dedicated Server builds; the headless backend ignores it. |
| 19 | - **NEVER** call `ResourceUID.set_id()` without calling `has_id()` first; it causes a fatal CLI crash. |
| 20 | - **NEVER** skip `RenderingServer.canvas_item_reset_physics_interpolation()` when programmatically moving low-level CanvasItems on their first frame; failure causes visual desync between rendering and physics systems. |
| 21 | |
| 22 | ## Expert Automation Workflows |
| 23 | |
| 24 | ### Workflow #1: The Hardened 3D Asset Pipeline |
| 25 | **Purpose**: Automates the ingestion of raw 3D assets into production-ready scenes with accurate physics collisions. |
| 26 | - **Sequence**: `gltf_processor.py` -> `collision_generator.py` -> `save_scene.py`. |
| 27 | - **Expert Defense**: Sets explicit `owner` for every node. Forces a final headless import to fix the missing UID serialization. |
| 28 | |
| 29 | ### Workflow #2: Procedural Level Optimization & 4.4+ Scaling |
| 30 | **Purpose**: Generates optimized procedural level chunks without shared resource state corruption between instances. |
| 31 | - **Sequence**: `csg_optimizer.py` -> `duplicate_deep(ALL)` -> `navmesh_baker.py`. |
| 32 | - **Expert Defense**: Uses `duplicate_deep` to isolate materials/resources. Bakes CSG to static geometry before triggering NavMesh pathfinding. |
| 33 | |
| 34 | ### Workflow #3: Production CI/CD & Force-Import Validation |
| 35 | **Purpose**: Validates cross-platform builds and ensures global project settings (VRAM compression) are strictly applied. |
| 36 | - **Sequence**: `rm -rf .godot/imported` -> `test_runner.py` -> `profile_generator.py` -> `ci_exporter.py`. |
| 37 | - **Expert Defense**: Forces full re-import to validate asset compression. Isolates CI runs via XDG variables. Injects secure keystore paths from environment variables. |
| 38 | |
| 39 | --- |
| 40 | |
| 41 | ## Automation & CI/CD Pipelines (Godot 4.7) |
| 42 | |
| 43 | Professional Godot building requires a "Zero-Touch" philosophy for assets and binary exports. |
| 44 | |
| 45 | ### 1. Programmatic Asset Re-import |
| 46 | - **NEVER** manually select 500 textures to change their compression. |
| 47 | - Use `ConfigFile` to mutate `.import` files and `EditorFileSystem.reimport_files()` to trigger a batch update on the main thread safely. |
| 48 | |
| 49 | ### 2. Orphan Asset Detection (Slop Scan) |
| 50 | - **NEVER** trust `res://` is clean. Over time, deleted scenes leave behind orphaned textures and sounds that bloat the final build. |
| 51 | - Use `ResourceLoader.get_dependencies()` to recursively trace exactly which assets are linked to your "Main Scene" and flag anything else as slop. |
| 52 | |
| 53 | ### 3. Headless CI/CD Context |
| 54 | - Use `--headless --script` for versioning tasks (mutating `export_presets.cfg`) before running the final `--export-release`. |
| 55 | - **Tip**: Always call `quit()` at the end of a headless script, or your CI runner will hang indefinitely. |
| 56 | |
| 57 | --- |
| 58 | |
| 59 | ## Full Modular Skill Index (25 Scripts) |
| 60 | |
| 61 | ### Project & Process Management |
| 62 | 1. **launch_editor.py**: Opens the Godot visual editor for the project. |
| 63 | 2. **run_project.py**: Launches the game project in debug or release mode. |
| 64 | 3. **get_debug_output.py**: Captures and redirects engin |