当前位置:首页 » AI资讯 » AI快讯

Claude Code Stop hook 技巧:用 exit code 2 让 Claude 在检查失败时自动重试

2026-11-14 5

Lydia Hallie 分享一个 Claude Code 使用技巧:用 Stop hook 让 Claude 在检查失败后自动重试,关键是让 hook 以 exit code 2 退出。exit 2 会把 hook 的 stderr 返回给 Claude 触发重试,exit 1 则是非阻塞的,即使检查失败 Claude 也会直接结束。

来源:X:Lydia Hallie(Anthropic,Claude Code) (@lydiahallie)

相关推荐

扫码关注

qrcode

联系我们

回顶部