Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

godot-test-debugger

FreeNo executable scriptsNot checked

Godot 测试与调试工作流专家,支持自然语言描述自动完成单元测试、集成测试、错误诊断、性能调试等测试工作

hhhh124hhhhby hhhh124hhhh★ 44 GitHub stars

About this skill

Godot 测试调试专家技能

技能概述

godot-test-debugger 是专门用于 Godot 游戏测试和调试的智能化技能,能够根据用户的自然语言描述自动完成单元测试、集成测试、性能测试、错误诊断、调试工具创建、问题定位等全面的测试调试工作。

核心功能

🧪 自动化测试系统

  • 单元测试:自动生成和运行单元测试
  • 集成测试:复杂场景的集成测试
  • 性能测试:帧率、内存、加载性能测试
  • 回归测试:版本更新后的回归检测

🔍 智能错误诊断

  • 异常捕获:全面的游戏异常捕获和分类
  • 错误分析:深度分析错误原因和影响范围
  • 修复建议:提供具体的修复方案和代码建议
  • 预防措施:预防同类错误的再次发生

🛠️ 调试工具生成

  • 调试界面:创建功能完整的调试UI界面
  • 日志系统:智能日志记录和分类系统
  • 性能监控:实时性能监控和可视化
  • 状态检查器:游戏状态实时检查工具

📊 测试报告生成

  • 测试覆盖度:代码覆盖度和功能覆盖度分析
  • 缺陷统计:缺陷分类、优先级和趋势分析
  • 性能报告:详细的性能分析报告
  • 质量评估:整体代码质量评估和建议

使用方法

单元测试创建

用户: "为我的角色控制系统创建完整的单元测试"
系统: 自动实现:
- 分析角色控制系统的所有功能
- 生成移动、跳跃、攻击等测试用例
- 创建边界条件和异常情况测试
- 设置测试数据和预期结果
- 运行测试并生成报告

性能测试实施

用户: "测试游戏在1000个敌人同时存在时的性能表现"
系统: 智能测试:
- 创建大规模场景测试环境
- 监控帧率、内存、CPU使用率
- 测试不同设备配置下的表现
- 分析性能瓶颈和优化建议
- 生成详细的性能测试报告

错误诊断和修复

玩家报告游戏在某个关卡崩溃,需要找出问题"
系统: 全面诊断:
- 分析崩溃日志和错误信息
- 重现崩溃场景和条件
- 定位问题代码和根本原因
- 提供多种修复方案
- 验证修复效果

调试工具创建

用户: "为开发团队创建一个完整的调试工具界面"
系统: 智能生成:
- 实时性能监控面板
- 游戏状态查看和修改工具
- 场景导航和对象检查器
- 命令控制台和脚本执行器
- 日志查看和过滤系统

工作流程

1. 测试需求分析

# 分析测试需求
- 识别核心功能模块
- 确定测试类型和范围
- 评估测试复杂度和优先级
- 制定测试计划和时间安排

2. 测试用例设计

# 设计测试用例
- 正常功能测试用例
- 边界条件测试用例
- 异常情况测试用例
- 性能压力测试用例

3. 自动测试实施

# 执行自动化测试
- 生成测试代码
- 配置测试环境
- 运行测试套件
- 收集测试结果

4. 问题诊断修复

# 诊断和修复问题
- 分析测试失败原因
- 定位问题代码位置
- 提供修复建议
- 验证修复效果

MCP 工具集成

测试执行工具

  • create_test_scene - 创建测试场景
  • run_unit_test - 运行单元测试
  • run_integration_test - 运行集成测试
  • run_performance_test - 运行性能测试

调试分析工具

  • analyze_error_log - 分析错误日志
  • detect_memory_leaks - 检测内存泄漏
  • profile_script_performance - 分析脚本性能
  • debug_node_hierarchy - 调试节点层次

代码质量工具

  • check_code_coverage - 检查代码覆盖度
  • analyze_code_complexity - 分析代码复杂度
  • validate_script_syntax - 验证脚本语法
  • check_naming_conventions - 检查命名规范

报告生成工具

  • generate_test_report - 生成测试报告
  • create_bug_report - 创建缺陷报告
  • export_performance_data - 导出性能数据
  • visualize_test_results - 可视化测试结果

自动化测试系统

智能测试生成器

# 智能测试生成器
class_name SmartTestGenerator extends Node
@export var target_script: GDScript
@export var test_output_path: String = "res://tests/"

func generate_unit_tests() -> void:
    var script_content = target_script.source_code
    var functions = _extract_functions(script_content)
    var test_class = _create_test_class(functions)

    var test_script_path = test_output_path + target_script.get_path().get_file().get_basename() + "_test.gd"
    var test_file = FileAccess.open(test_script_path, FileAccess.WRITE)
    test_file.store_string(test_class)
    test_file.close()

func _extract_functions(script_content: String) -> Array:
    var functions = []
    var lines = script_content.split("\n")

    for line in lines:
        if line.begins_with("func "):
            var func_name = line.split("(")[0].replace("func ", "").strip_edges()
            functions.append(func_name)

    return functions

func _create_test_class(functions: Array) -> String:
    var test_class = "extends \"res://addons/gut/test.gd\"\n\n"
    test_class += "var " + target_script.get_path().get_file().get_basename() + ": " + target_script.get_global_name() + "\n\n"

    for func_name in functions:
        test_class += _generate_function_test(func_name) + "\n"

    return test_class

func _generate_function_test(func_name: String) -> String:
    var test_code = "func test_" + func_name + "():\n"
    test_code += "\t# TODO: Implement test for " + func_name + "\n"
    test_code += "\tassert_true(false, \"Test not implemented yet\")\n"

    return test_code

集成测试框架

# 集成测试框架
class_name IntegrationTestFramework extends Node
@export var test_scenes: Array[PackedScene]

var current_test_index: int = 0
var test_results: Array[Dictionary] = []

func run_all_tests() -> void:
    test_results.clear()
    current_test_index = 0

    for test_scene in test_scenes:
        await run_single_test(test_scene)

    generate_test_report()

func run_single_test(test_scene: PackedScene) -> void:
    print("Running integration test: ", test_scene.resource_path)

    var test_instance = test_scene.instantiate()
    add_child(test_instance)

    # 等待测试场景稳定
    await get_tree().create_timer(1.0).timeout

    # 执行测试逻辑
    var test_result = await execute_integration_test(test_instance)

    # 记录结果
    test_results.append({
        "scene": test_scene.resource_path,
        "result": test_result,
        "timestamp": Time.get_datetime_string_from_system()
    })

    # ✅ 正确:安全清理测试场景
    if test_instance and is_instance_valid(test_instance):
        # 使用延迟删除,确保所有回调完成后再删除
        test_instance.call_deferred("queue_free")
        # 等待一帧确保删除操作完成
        await get_tree().process_frame

func execute_integration_test(scene: Node) -> Dictionary:
    var result = {
        "passed": false,
        "errors": [],
        "performance": {}
    }

    # 检查场景完整性
    var integrity_check = check_scene_integrity(scene)
    if not integri
Full SKILL.md on GitHub

Install godot-test-debugger in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the godot-test-debugger skill do?

Godot 测试与调试工作流专家,支持自然语言描述自动完成单元测试、集成测试、错误诊断、性能调试等测试工作

How do I install the godot-test-debugger skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the godot-test-debugger skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare godot-test-debugger with