godot-gdscript-mastery by thedivergentai/gd-agentic-skills
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-gdscript-mastery遵循官方 Godot 标准编写高性能、可维护 GDScript 的专家指南。
使用静态类型化数组和字典进行专家级性能优化。
使用 reduce()、all() 和 any() 以及简洁的 lambda 语法进行高级列表处理。
使用 as 操作符进行防崩溃对象识别的最佳实践。
使用严格类型化的信号参数在脚本边界强制实施类型安全。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
使用 Callable.bind() 向信号回调注入额外上下文。
使用 Callable.unbind() 安全地丢弃不需要的信号参数。
使用 await 管理复杂的异步流和计时器,无需阻塞线程。
通过使用 resize() 预分配大型数组的大小来消除内存重新分配延迟。
使用 static var 进行全局状态管理,作为重型 Autoloads 的替代方案。
在迭代时删除字典键以避免运行时错误的正确模式。
@onready 和 @export — 初始化顺序会导致 @onready 覆盖检查器中的值 [1]。dict.keys().duplicate() 或迭代一个副本来安全地删除元素 [2, 3]。connect("signal", ...) — 始终使用信号对象语法 (button.pressed.connect(...)) 以获得编译时安全性 [4]。queue_free() 或 get_class() 不受支持,引擎回调将忽略它们 [5, 6]。_process() 内部使用动态的 get_node() 或 $ — 每帧都获取路径会拖慢 CPU。应缓存并使用 @onready [7, 8]。Parent.method() 调用 — 这违反了“信号向上,调用向下”的原则。应使用信号与父节点通信。is 检查后紧接着进行硬转换 — 如果类型检查通过但对象发生了变化,会导致崩溃。应使用 as 并检查是否为 null。print() — 使用 push_error()、push_warning() 或断点来确保错误在控制台/日志中可见。_ready() 中预加载巨大资源 — 这会导致帧卡顿。使用 ResourceLoader.load_threaded_request() 进行异步加载。static var 足够的情况下使用 Autoloads 中的全局变量 — 静态变量提供更好的封装性,并且对项目的污染更少 [24]。始终使用静态类型。它能提高性能并及早发现错误。规则:优先使用 var x: int = 5 而不是 var x = 5。规则:始终为函数指定返回类型:func _ready() -> void:。
_ready() 中连接:最好在代码中连接信号以保持可见性,而不仅仅是在编辑器中。signal item_collected(item: ItemResource)。%UniqueNames。@onready var sprite = %Sprite2D,而不是在每个函数中调用 get_node()。遵循标准的 Godot 脚本布局:
extendsclass_namesignals / enums / constants@export / @onready / properties_init() / _ready() / _process()_ 为前缀)如果你不能 100% 确定键存在,请避免使用 dict["key"]。使用 dict.get("key", default)。
在构建复杂的 UI 时,始终为关键节点(标签、按钮)启用“作为场景唯一名称访问”选项,并通过 %Name 访问它们。
tutorials/scripting/gdscript/gdscript_styleguide.rsttutorials/best_practices/logic_preferences.rst每周安装量
80
代码仓库
GitHub 星标数
59
首次出现
2026年2月10日
安全审计
安装于
opencode77
gemini-cli74
codex74
github-copilot70
kimi-cli69
amp69
Expert guidance for writing performant, maintainable GDScript following official Godot standards.
Expert performance optimization using statically typed Arrays and Dictionaries.
Advanced list processing using reduce(), all(), and any() with clean lambda syntax.
Best practices for using the as operator for crash-proof object identification.
Enforcing type safety across script boundaries using strictly typed signal arguments.
Injecting extra context into signal callbacks using Callable.bind().
Safely discarding unneeded signal arguments using Callable.unbind().
Managing complex asynchronous flows and timers using await without thread-blocking.
Eliminating memory reallocation lag by pre-sizing large arrays with resize().
Using static var for global state management as an alternative to heavy Autoloads.
The correct pattern for erasing dictionary keys while iterating to avoid runtime errors.
@onready and @export on the same variable — Initialization order will cause @onready to overwrite the Inspector value [1].dict.keys().duplicate() or iterate a clone to safely erase elements [2, 3].connect("signal", ...) — Always use the Signal object syntax (button.pressed.connect(...)) for compile-time safety [4].queue_free() or get_class() is unsupported and will be ignored by engine callbacks [5, 6].Always use static typing. It improves performance and catches bugs early. Rule : Prefer var x: int = 5 over var x = 5. Rule : Always specify return types for functions: func _ready() -> void:.
_ready(): Preferably connect signals in code to maintain visibility, rather than just in the editor.signal item_collected(item: ItemResource).%UniqueNames for nodes that are critical to the script's logic.@onready var sprite = %Sprite2D over calling get_node() in every function.Follow the standard Godot script layout:
extendsclass_namesignals / enums / constants@export / @onready / properties_init() / _ready() / _process()Avoid dict["key"] if you aren't 100% sure it exists. Use dict.get("key", default).
When building complex UI, always toggle "Access as Scene Unique Name" on critical nodes (Labels, Buttons) and access them via %Name.
tutorials/scripting/gdscript/gdscript_styleguide.rsttutorials/best_practices/logic_preferences.rstWeekly Installs
80
Repository
GitHub Stars
59
First Seen
Feb 10, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode77
gemini-cli74
codex74
github-copilot70
kimi-cli69
amp69
Kotlin 开发模式与最佳实践 | 构建健壮高效应用程序的惯用指南
1,100 周安装
Memory-Merger:AI辅助记忆合并工具,优化VS Code提示词管理,减少冗余知识
10,000 周安装
summarize CLI工具:快速总结URL、PDF文件和YouTube视频内容,支持多AI模型
10,200 周安装
SQL优化模式实战指南:索引策略与查询计划分析提升数据库性能
10,100 周安装
Google Workspace Tasks CLI 命令指南:任务列表与任务管理 API 操作详解
10,300 周安装
Java Spring Boot 3.x 开发指南:REST API、安全配置、数据访问与监控
10,100 周安装
Mastra框架指南:快速构建AI智能体和流程应用,掌握最新文档查询方法
10,300 周安装
get_node() or $ inside _process()@onreadyParent.method() calls — Violates "Signal Up, Call Down". Use signals to communicate with parents.is followed by a hard cast — If the type check passes but the object changes, it crashes. Use as and check for null.print() for production debugging — Use push_error(), push_warning(), or breakpoints to ensure errors are visible in the console/logs._ready() — This causes frame stutters. Use ResourceLoader.load_threaded_request() for async loading.static var is sufficient — Static variables offer better encapsulation and less project pollution [24]._)