# Gdscript Advanced

Use when writing production-grade GDScript, performance idioms, metaprogramming, @tool...

- Repository: https://github.com/jame581/GodotPrompter (914 stars)
- Category: Writing
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add jame581/GodotPrompter --skill gdscript-advanced -g -a claude-code -y`
Codex: `npx skills add jame581/GodotPrompter --skill gdscript-advanced -g -a codex -y`
Cursor: `npx skills add jame581/GodotPrompter --skill gdscript-advanced -g -a cursor -y`
Gemini CLI: `npx skills add jame581/GodotPrompter --skill gdscript-advanced -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add jame581/GodotPrompter`

## Description

Use when writing production-grade GDScript, performance idioms, metaprogramming, @tool lifecycle, async pitfalls, signal/Callable trade-offs, profiler-driven idioms, and common pitfalls

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# GDScript Advanced

Production-grade GDScript depth, for shipping games, not for learning the language. Pair with **gdscript-patterns** for fundamentals.

> **Related skills:** **gdscript-patterns** for language fundamentals, **godot-optimization** for engine-side perf work, **godot-debugging** for runtime diagnosis, **csharp-godot** for the C# alternative.

> **Intent:** This skill is GDScript-only by design (allowlisted). C# users should read `csharp-godot`. Adding C# parity here would undermine the audience split.

## 1. When to reach for advanced GDScript

You're past `gdscript-patterns` when:

- You're hitting a profiler bottleneck and need to know which idioms are fast
- You're writing editor tools and need `@tool` lifecycle correctness
- You're seeing coroutines that never resume or `Callable` lifetime bugs
- You need metaprogramming (calling functions by name, dynamic dispatch) without footguns
- You're shipping a real game and want to avoid the patterns that look fine but break under load

This skill assumes you already know typed parameters, `@onready`, `await`, `match`, and lambdas (covered in `gdscript-patterns`).

## 2. Performance idioms

**Static vars and methods** (static vars since Godot 4.1) avoid per-instance overhead:

```gdscript
class_name Tally extends Node

static var _global_score: int = 0

static func add_score(amount: int) -> void:
    _global_score += amount

static func get_score() -> int:
    return _global_score
```

Avoid singletons-as-autoloads when a static method on a class would do.

**Vector2i vs Vector2 / Vector3i vs Vector3**, integer vectors keep tile coords and grid math exact (no float drift, usable as `Dictionary` keys). Measure before assuming a speed gain. Convert to float only at the rendering boundary:

```gdscript
var grid_pos: Vector2i = Vector2i(8, 12)              # cheap
var world_pos: Vector2 = Vector2(grid_pos) * TILE_SIZE  # convert at boundary
```

The rest: https://github.com/jame581/GodotPrompter/blob/HEAD/skills/gdscript-advanced/SKILL.md
