debug
Use this skill to locate a runtime bug. Add targeted instrumentation, collect reproduction evidence, and confirm the root cause before changing code.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 4.0k
- Forks
- 305
01 前言 Front Matter
- name
- debug
- description
- Use this skill to locate a runtime bug. Add targeted instrumentation, collect reproduction evidence, and confirm the root cause before changing code.
02 资源文件 2
- 参考文档references/scanning-methodology.md3.6 KB
- 脚本scripts/debug-log-server.mjs5.3 KB
03 SKILL.md 正文
Evidence-driven debugging
Evidence-driven debugging mode activated. Follow the workflow below:
-
Generate multiple hypotheses based on the problem described by the user.
-
Insert narrow, hypothesis-specific instrumentation for each hypothesis.
-
Provide reproduction steps and ask the user to reproduce the issue.
-
Read the captured runtime data and identify the confirmed root cause.
-
Implement fix based on the confirmed root cause.
-
If the user confirms the issue has been resolved, clean up all inserted log statements; otherwise, add more logs or generate new hypotheses
IMPORTANT: Do not implement a fix until it is supported by runtime evidence. IMPORTANT: Do not clean up instrumentation until the user confirms the issue has been fixed.
Rules
-
Before reading
debug-agent.log, check its size and approximate entry count. Do not read a large log end-to-end in one pass; filter by hypothesis ID, location, time range, or other relevant keywords, and write a small analysis script when aggregation or correlation is needed. -
Before each new request for the user to reproduce the issue, clear the existing
debug-agent.logso that the next capture is attributable to that reproduction. If the historical entries may be needed, create a separate backup first (for example, with a timestamp or reproduction-batch suffix), then clear the active log. -
Separate diagnosis from repair selection. Assess whether the confirmed cause calls for a root-cause fix, a smaller mitigation, or both. A mitigation that merely masks the symptom must not be presented as the root-cause fix.
-
If there are multiple viable fixes, or the root-cause fix has a materially larger change surface, present the options, trade-offs, and verification implications to the user and ask them to choose before editing production code. If one proportionate root-cause fix is clearly preferred, explain why and proceed only after the runtime evidence supports it.
How to Write to Log Files
-
All logs must be written to
{project_root}/debug-agent.log. Note: absolute paths must be used. -
Inserted log statements should be wrapped with appropriate comment statements for location and cleanup
-
Log content should include: hypothesis ID (A/B/C/...), log location (e.g., api-get_weather), and specific information
-
Backend: write via file IO
// #region agent log
{
use std::io::Write;
if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(r"absolute\path\to\debug-agent.log") {
let _ = writeln!(f, "log_content");
}
}
// #endregion
- Frontend: start the bundled receiver script, then write via
fetch.
node <this-skill-directory>/scripts/debug-log-server.mjs --root <project-root>
This uses the default local port (7469) and writes to debug-agent.log in the
project root. Run the script with --help to see options for a different
project root, port, log path, or startup behavior.
Inserted frontend logs should use this pattern:
// #region agent log
void fetch('http://127.0.0.1:7469/log', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 'A',
loc: 'ComponentName.eventName',
msg: 'specific observation',
data: { value },
}),
}).catch(() => {});
// #endregion
The receiver exposes:
POST /clearto clear the log fileGET /healthto confirm the server and log path
Keep frontend instrumentation project-agnostic: avoid importing app-specific debug utilities unless the project already has a logging adapter that can POST to this receiver cleanly.
04 同仓库更多 Skills
miniapp-dev
Generate, operate, and refine OpenBitFun MiniApps. Use when the user wants a new MiniApp, asks the Agent to inspect or operate a running MiniApp, or wants an existing MiniApp redesigned or extended. Typical triggers: "做一个小应用", "操作这个 MiniApp", "查看小应用当前状态", "改造 mini app".
openbitfun-frontend-dev
Safely customize the running packaged OpenBitFun desktop frontend through a draft, a provisional hot apply, and a 15-second user-confirmed rollback window. Use only in OpenBitFun Creative mode when the user asks to change OpenBitFun's own client UI.
ppt-design
使用 HTML 设计与生成高质量演讲幻灯片(PPT/Deck)。当用户希望生成、设计、修改幻灯片、deck、slides、presentation、汇报、提案、pitch、课件时触发。主干:1280×720px 可编辑 HTML 幻灯片 + 唯一 editable HTML→EditableSlideScene→OOXML 管线 + 数据/信息可视化意识 + 5 种设计哲学 + 反 AI slop + 单页自包含 `slide-XX.html`。不生图;缺图用可编辑原语或占位并标注建议补图。
create-agent
Create or update OpenBitFun custom modes and subagents. Turn the user's needs into a role prompt and a suitable tool selection, then save an agent definition. Use for reusable roles, not ordinary delegation to an existing subagent.
plan
Research and write an actionable implementation plan without implementing it. Use when the user asks to plan, design an approach, or inspect a change before coding; stop applying the planning restriction once the user explicitly asks to implement.
find-skills
Discover and install reusable agent skills when users ask for capabilities, workflows, or domain-specific help that may already exist as an installable skill.