Godot Gdscriptのロゴ

Godot Gdscript

コミュニティ
fetasty
godot-gdscript

Godot 4 GDScript code quality: static typing, signal architecture, coroutines, design patterns, performance optimization, and GDScript-specific idioms. Use when writing or reviewing .gd files in Godot 4 projects for: (1) Enforcing static typing standards, (2) Designing signal and node communication patterns, (3) Implementing state machines/command/observer patterns in GDScript, (4) Optimizing GDScript performance, (5) Reviewing GDScript code for anti-patterns.

概要

公開者fetasty
リポジトリgodot-skills
スキル名godot-gdscript
スター
35
フォーク
0
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    fetastyがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Godot Gdscript」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/fetasty/godot-skills/tree/main/godot-gdscript
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/fetasty/godot-skills.git /tmp/godot-skills
mkdir -p .claude/skills
cp -r /tmp/godot-skills/godot-gdscript .claude/skills/godot-gdscript
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでGodot Gdscriptを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にGodot Gdscriptを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Godot Gdscriptは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Godot GDScript Specialist

GDScript 2.0 code quality, patterns, and optimization for Godot 4.6 projects.

Static Typing (Mandatory)

ALL variables, parameters, and return types must have explicit type annotations:

gdscript
# YES — typed
var health: float = 100.0
var inventory: Array[Item] = []
func take_damage(amount: float, source: Node3D) -> void:
func get_items() -> Array[Item]:

# NO — untyped
var health = 100.0
func take_damage(amount, source):

Use @onready for typed node references:

gdscript
@onready var health_bar: ProgressBar = %HealthBar
@onready var sprite: Sprite2D = $Visuals/Sprite2D

Enable unsafe_* warnings in project settings to catch untyped code.

File Organization

  • One class_name per file — file name matches class in snake_case
    • player_character.gd → class_name PlayerCharacter
  • Scripts extend the node type they're attached to
  • Use @export_group and @export_subgroup for inspector organization

Signal Architecture

gdscript
signal health_changed(new_health: float, old_health: float)
signal died(source: Node)

# Modern emit syntax (Godot 4)
health_changed.emit(_current_health, _previous_health)
died.emit(killer)

# Typed connections
health_changed.connect(_on_health_changed)
# One-shot
health_changed.connect(_on_damaged_once, CONNECT_ONE_SHOT)
  • Prefer signals for decoupled communication between nodes
  • Never connect signals in _process() — connects every frame
  • Always disconnect in _exit_tree() if node may outlive the connection
  • Use EventBus autoload for global events, direct signals for parent-child

Coroutines and Async

gdscript
# Await a signal
await get_tree().create_timer(0.5).timeout

# Await a tween
var tween := create_tween()
tween.tween_property(sprite, "modulate:a", 0.0, 0.3)
await tween.finished

# Await parallel operations
var timer := get_tree().create_timer(1.0)
var tween := create_tween().tween_property(self, "position", target, 1.0)
await timer.timeout  # or await tween.finished

Never use yield() — that's Godot 3 syntax. Use await exclusively.

Design Patterns

State Machine

gdscript
enum State { IDLE, RUNNING, JUMPING, FALLING, ATTACKING }
var _current_state: State = State.IDLE

func _physics_process(delta: float) -> void:
    match _current_state:
        State.IDLE:
            _process_idle(delta)
        State.RUNNING:
            _process_running(delta)

For complex states, use node-based state machines (each state is a child Node).

Resource Pattern

gdscript
class_name WeaponData extends Resource
@export var damage: float = 10.0
@export var attack_speed: float = 1.0
@export var weapon_type: WeaponType

Resources are shared by default — use resource.duplicate() for per-instance data. Use duplicate_deep() for nested resources (Godot 4.5+).

Composition Over Inheritance

gdscript
@onready var health_component: HealthComponent = %HealthComponent
@onready var hitbox_component: HitboxComponent = %HitboxComponent

func _ready() -> void:
    health_component.died.connect(_on_died)
    hitbox_component.hit_received.connect(_on_hit_received)

Maximum inheritance depth: 3 levels after Node base.

Post-4.3 GDScript Features

From references/current-best-practices.md in the godot skill:

  • Variadic arguments (4.5+): func log(prefix: String, values: Variant...) -> void:
  • Abstract classes (4.5+): @abstract class_name BaseEnemy and @abstract func get_pattern()
  • Script backtracing: Call stacks available even in Release builds (4.5+)

Performance

  • Disable _process and _physics_process when not needed:
    gdscript
    set_process(false)
    set_physics_process(false)
  • Use _physics_process for movement/physics, _process for visuals/UI
  • Cache node references in @onready — never get_node() in _process
  • Use StringName for frequently compared strings: &"animation_name"
  • Avoid Array.find() in hot paths — use Dictionary lookups
  • Object pooling for frequently spawned objects (projectiles, particles)
  • Typed arrays (Array[Type]) are faster than untyped arrays
  • Threshold for GDScript → GDExtension: if a function runs >1000 times per frame

Common GDScript Anti-Patterns

  • Untyped variables and functions — disables compiler optimizations
  • Using $NodePath in _process instead of caching with @onready
  • Deep inheritance trees instead of composition
  • Signals for synchronous communication — use direct method calls
  • String comparisons instead of enums or StringName
  • Dictionaries for structured data instead of typed Resources
  • God-class Autoloads that manage everything
  • Editor signal connections — invisible in code, hard to track
  • Using yield() instead of await

Tooling

ripgrep for GDScript: No gdscript type exists. Always use --glob "*.gd" or glob: "*.gd". Using --type gdscript produces a hard error.

よくある質問

AIスキル「Godot Gdscript」では何ができますか?

Godot 4 GDScript code quality: static typing, signal architecture, coroutines, design patterns, performance optimization, and GDScript-specific idioms. Use when writing or reviewing .gd files in Godot 4 projects for: (1) Enforcing static typing standards, (2) Designing signal and node communication patterns, (3) Implementing state machines/command/observer patterns in GDScript, (4) Optimizing GDScript performance, (5) Reviewing GDScript code for anti-patterns.

TypingMindでGodot Gdscriptを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Godot Gdscriptはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにGodot Gdscriptをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/fetasty/godot-skills/tree/main/godot-gdscriptを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Godot Gdscriptを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Godot Gdscriptで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもGodot Gdscriptを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Godot Gdscript」は無料ですか?

はい。fetastyがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇