Building Godot games without proper architecture leads to unmaintainable code and performance issues. This skill provides production-ready GDScript patterns including state machines, component systems, object pooling, and save systems to help you build clean, scalable games.
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「godot-gdscript-patterns」。 Create a state machine for an enemy with Idle, Patrol, and Chase states
預期結果:
Generates StateMachine class (extends Node), State base class, and three concrete state scripts: EnemyIdle, EnemyPatrol, and EnemyChase. Includes transition logic based on player distance detection and signal connections for state changes.
正在使用「godot-gdscript-patterns」。 Create an object pool for bullets with 20 initial instances
預期結果:
Provides ObjectPool script with get_instance() and return methods, plus PooledBullet script with lifetime management, velocity-based movement, and returned_to_pool signal. Includes initialization code that pre-creates 20 disabled bullet instances.
安全審計
安全Static analysis detected 60 potential security issues, all confirmed as false positives after review. All 'external_commands' findings are markdown code fence delimiters in GDScript examples. 'Weak cryptographic algorithm' findings refer to Godot 4's built-in encrypted file API (FileAccess.open_encrypted_with_pass) used legitimately in save system examples. 'Generic API keys' finding is a placeholder encryption key in example code (your_secret_key_here). 'Network' findings are documentation links to legitimate Godot resources. This skill contains only educational GDScript code examples and documentation with no executable content or security risks.
品質評分
你能建構什麼
Implement Player State Machine
Create a state machine for player character with idle, move, attack, and jump states. Use this when building platformers or action games where player behavior changes based on game state.
Object Pooling for Bullets
Implement object pooling for frequently spawned objects like bullets or projectiles. Use this to reduce garbage collection hitches and improve performance in games with many spawned entities.
Component-Based Health System
Create reusable health, hitbox, and hurtbox components that can be attached to any game entity. Use this when building games with many characters that need combat functionality.
試試這些提示
Create a state machine for a [ENTITY_TYPE] with states: [LIST_STATES]. Include the StateMachine class, State base class, and one concrete state implementation.
Create an object pool system for [OBJECT_TYPE] that pre-instantiates [NUMBER] objects and can grow dynamically. Include the pool script and a pooled object script with spawn/despawn callbacks.
Design a component system with [COMPONENT_1] and [COMPONENT_2] that interact via signals. Each component should be standalone and attachable to any node.
Implement a save system that saves [DATA_TYPES] to an encrypted file. Include the SaveManager autoload and a Saveable component for individual objects.
最佳實務
- Cache node references with @onready instead of calling get_node() in process loops
- Use signals for communication between nodes to avoid tight coupling
- Separate data into Resources (extending Resource) and keep logic in Nodes
- Use static typing on all variables and function parameters for better performance
- Disable processing on nodes when not needed (set_process, set_physics_process)
避免
- Do not call get_node() or $ notation in _process() or _physics_process() loops
- Do not store direct node references across scenes - use signals or autoloads
- Do not put game logic in Resource scripts - keep them as data containers
- Do not create new objects in hot code paths - use object pooling instead
- Do not use string names for signals when you can use Callable with type safety