local-link/skills/debug-by-commits/SKILL.md
通过 Git Commit 二分法调试前端白屏/卡死问题。 当用户报告页面白屏、无响应、卡死,且怀疑是代码问题时使用。 特别适用于: 1. 开发服务器能启动但页面显示白屏 2. 页面无响应或卡死(可能是死循环) 3. 需要快速定位引入问题的具体 commit 4. 需要排除缓存、配置等干扰因素
npx skillsauth add lionad-morotar/local-tools debug-by-commitsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
当页面出现白屏或卡死时,通过 Git 回退到之前的 commit,逐个验证,快速定位问题引入点。
# 查看当前状态
git status --short
git log --oneline -10
# 保存当前工作(包括未跟踪文件)
git stash push -m "stash: debug 问题" --include-untracked
# 查看最近提交历史
git log --oneline -10
选择要回退的目标 commit(通常是已知正常的版本)。
# 回退到指定 commit
git checkout <commit-hash>
# 清理依赖(关键!排除缓存干扰)
rm -rf node_modules .nuxt
# 杀掉残留进程
pkill -f "nuxt" || true
pnpm install && pnpm dev
让用户验证页面是否正常:
重复步骤 3-4,使用二分法快速缩小范围:
正常 ←——————————————————→ 白屏
↑
检查中间点
找到第一个出现问题的 commit 后:
# 查看该 commit 的具体改动
git show <commit-hash>
# 查看改动的文件列表
git show <commit-hash> --stat
# 查看具体改动内容
git show <commit-hash> --no-patch
根据改动内容分析可能的问题。重点检查该 commit 引入的新代码:
分析思路:
不要预设立场 - 白屏可能由多种原因导致,需要根据具体改动分析,而不是套用固定模式。
修复完成后,恢复之前 stash 的工作:
# 回到原分支
git checkout <branch-name>
# 恢复 stash
git stash pop
node_modules 和 .nuxt,排除缓存干扰定位到问题后,记录:
问题 commit: <hash>
问题文件: <file-path>
问题类型: <死循环/异步/生命周期/响应式/其他>
根本原因: <具体解释>
修复方案: <如何修复>
tools
理解用户意图;listen 模式通过 grill-me 深挖任务并归档经验
development
给 VSCode(Insiders/Stable) 内置 ripgrep 加 5s 超时包装,防止搜索卡死吃满 CPU。--on 包装(幂等) / --off 还原 / 不带参数查状态。Use when VSCode 搜索卡死、rg 进程占满 CPU,或 VSCode 更新后超时保护失效需要重包。
development
为指定项目创建完全隔离的 hapi(Claude Code On the Go)实例,包括独立数据目录、LaunchAgent 持久化、zsh wrapper 和 app.hapi.run 直连 URL。与全局 ~/.hapi 互不干扰。
development
关闭承载当前 Claude Code 会话的宿主(VSCode 窗口或其终端面板),连同 claude 一起退出。通过 close-host-window 扩展触发:先 SIGTERM claude(走完 SessionEnd hooks)再关 host,不抢焦点、不丢 hooks。--host vscode 关窗口、--host terminal(默认)只关终端面板。Use when 任务结束要随宿主退出,或需精确关闭某 claude 终端所在窗口/面板。