roblox-debug

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/debug - Iterative Debug Loop

/debug - 迭代调试循环

You are performing an iterative debug loop on a Roblox project. Follow these 7 steps. The loop has a maximum of 5 iterations before escalating to the user.

你正在对一个Roblox项目执行迭代调试循环。遵循以下7个步骤。该循环在升级给用户前最多进行5次迭代

Step 1: Error Gathering

步骤1:错误收集

Sync Mode (files on disk): Read the error from the user's description or ask them to paste the error message, stack trace, and any relevant output.
MCP Mode: Use MCP tools to retrieve console output or playtest errors if available.
Record:
  • Error message (exact text)
  • Stack trace (script name + line number)
  • When it occurs (on join, on action, on timer, etc.)

同步模式(磁盘上的文件): 从用户描述中读取错误,或要求他们粘贴错误消息、堆栈跟踪以及任何相关输出。
MCP模式: 如果可用,使用MCP工具检索控制台输出或 playtest 错误。
记录:
  • 错误消息(精确文本)
  • 堆栈跟踪(脚本名称 + 行号)
  • 错误发生时机(加入时、执行操作时、定时触发时等)

Step 2: Code Discovery

步骤2:代码查找

Read the relevant script(s) from the synced folder (or via MCP if in MCP-Only Mode). Search for the error message, relevant function names, or the script from the stack trace.

从同步文件夹(或在仅MCP模式下通过MCP)读取相关脚本。搜索错误消息、相关函数名称或堆栈跟踪中的脚本。

Step 3: Root Cause Analysis

步骤3:根本原因分析

Analyze the error against common Roblox issue categories. Load
skills/roblox-sharp-edges/SKILL.md
for known gotchas.
Categorize the error:
  • Syntax - Missing
    end
    , typos, incorrect syntax
  • Runtime - nil access, missing service, Instance destroyed
  • Logic - Wrong calculation, incorrect condition, missing state
  • Security - Client-side issue that should be server-side, unvalidated remote
  • Performance - Timeout, memory, script contention
If the
roblox-sharp-edges
skill is available, load it for known gotchas. Otherwise, proceed with general Luau knowledge.
Identify:
  1. The exact line(s) causing the error
  2. Why the error occurs (root cause, not symptom)
  3. Whether this is a standalone bug or a symptom of a deeper issue

针对常见Roblox问题类别分析错误。加载
skills/roblox-sharp-edges/SKILL.md
以了解已知陷阱。
对错误进行分类:
  • 语法错误 - 缺少
    end
    、拼写错误、语法不正确
  • 运行时错误 - nil值访问、服务缺失、实例已销毁
  • 逻辑错误 - 计算错误、条件不正确、状态缺失
  • 安全错误 - 应在服务器端处理的客户端问题、未验证的远程调用
  • 性能错误 - 超时、内存问题、脚本竞争
如果
roblox-sharp-edges
技能可用,加载它以了解已知陷阱。否则,使用通用Luau知识继续。
确定:
  1. 导致错误的确切代码行
  2. 错误发生的原因(根本原因,而非症状)
  3. 这是独立bug还是更深层次问题的症状

Step 4: Generate Fix

步骤4:生成修复方案

Produce corrected Luau code with an explanation of:
  • What was wrong (the root cause)
  • Why the fix works
  • Any related code that should also be checked
If the fix involves architectural changes (not just a line fix), explain the change clearly and suggest where else the same pattern applies.

生成修正后的Luau代码,并解释:
  • 问题所在(根本原因)
  • 修复方案为何有效
  • 任何也应检查的相关代码
如果修复涉及架构变更(不仅仅是单行修复),清晰解释变更内容,并建议其他适用相同模式的地方。

Step 5: Apply & Test

步骤5:应用与测试

Write the fix to the synced file. If MCP is available, use it to verify the fix applies cleanly. If playtest is running, check for errors after the fix.
If in offline mode, provide the corrected code with clear before/after diff and manual test instructions.

将修复写入同步文件。如果MCP可用,使用它验证修复是否能顺利应用。如果正在进行playtest,修复后检查是否有错误。
如果处于离线模式,提供带有清晰前后差异的修正代码以及手动测试说明。

Step 6: Verify

步骤6:验证

Check if the error is resolved:
  • If resolved: Proceed to Step 7
  • If new errors appear: Update error record, return to Step 1 with new information
  • If same error persists: Try a different root cause hypothesis, return to Step 3
  • If iteration count = 5: Stop and escalate to user with full diagnosis
Track iteration count. After 5 attempts, output:
  1. All attempted fixes and why each was rejected
  2. Remaining hypotheses
  3. Recommended next steps (manual investigation, Roblox DevForum search, etc.)

检查错误是否已解决:
  • 如果已解决:进入步骤7
  • 如果出现新错误:更新错误记录,携带新信息返回步骤1
  • 如果相同错误持续存在:尝试不同的根本原因假设,返回步骤3
  • 如果迭代次数=5:停止并向用户升级问题,提供完整诊断结果
跟踪迭代次数。5次尝试后,输出:
  1. 所有尝试过的修复方案及其被否决的原因
  2. 剩余的假设
  3. 建议的下一步操作(手动调查、搜索Roblox开发者论坛等)

Step 7: Summary

步骤7:总结

Document the completed fix:
  1. Bug description - What was happening
  2. Root cause - Why it was happening
  3. Fix applied - Exact changes made
  4. Verification - How it was confirmed fixed
  5. Related risks - Other places that might have the same issue
  6. Prevention - Pattern to follow to avoid this class of bug in the future
If the bug revealed a systemic issue, recommend running
/code-review
for a full scan.
记录已完成的修复:
  1. Bug描述 - 发生了什么问题
  2. 根本原因 - 问题发生的原因
  3. 应用的修复 - 做出的具体变更
  4. 验证方式 - 如何确认问题已修复
  5. 相关风险 - 其他可能存在相同问题的地方
  6. 预防措施 - 避免此类Bug应遵循的模式
如果该Bug暴露出系统性问题,建议运行
/code-review
进行全面扫描。